Commit Graph

52 Commits

Author SHA1 Message Date
Andreas Kling
cc0be2e78a Keep back and front painters around in WindowManager.
The internal state never changes in some meaningful way for these (at this time.)
2019-01-13 07:41:31 +01:00
Andreas Kling
9053027dc0 Flush the old and new cursor rects in a single rect. 2019-01-13 07:23:07 +01:00
Andreas Kling
8e96cba7ef Make a nice bitmap cursor.
It's rendered as two CharacterBitmaps right now because I don't have a good
primitive for this and I wanted it right away. I should add 2-color bitmaps..

Also make a neat little effect where the cursor becomes inverted on press.
2019-01-13 07:17:12 +01:00
Andreas Kling
becc2c7fa5 Make GraphicsBitmaps be Region-backed when running in the kernel.
This is a lot better than having them in kmalloc memory. I'm gonna need
a way to keep track of which process owns which bitmap eventually,
maybe through some sort of resource keying system. We'll see.
2019-01-13 00:29:32 +01:00
Andreas Kling
e4cb9b2985 Have WindowManager::invalidate() unite dirty rects that intersect each other.
This is kinda primitive but it avoids double-draw when slowly dragging stuff.
2019-01-13 00:04:23 +01:00
Andreas Kling
edc827077e Optimize WindowManager::flush() with fast_dword_copy(). 2019-01-12 21:45:45 +01:00
Andreas Kling
4e9bcd3092 Draw the cursor *after* flushing all dirty rects. 2019-01-12 21:02:08 +01:00
Andreas Kling
bac9aa90dd Update Painter class to the new coding style. 2019-01-12 17:02:54 +01:00
Andreas Kling
3b955d8e99 Give WindowManager member copies of the Framebuffer& and the screen rect.
These are used all the time, let's avoid function calls for them.
2019-01-12 16:51:14 +01:00
Andreas Kling
e5fc2ca900 WindowManager::invalidate() can just use Rect::intersection(). 2019-01-12 16:46:57 +01:00
Andreas Kling
84ae4e5880 WindowManager should only flush pixels inside the screen rect. 2019-01-12 16:41:03 +01:00
Andreas Kling
8068b8e09e Add a Vector::clear_with_capacity() that doesn't release the backing store.
Use this for WindowManager's dirty rects to avoid kmalloc traffic.
2019-01-12 07:22:25 +01:00
Andreas Kling
57b13274da Let the EventLoop drive the WindowManager through WM_Compose events. 2019-01-12 06:47:55 +01:00
Andreas Kling
780e15a6cc All right, let's double buffer the display. It looks so much better.
This performs like dogshit. I need to make some optimizations. :^)
2019-01-12 06:39:34 +01:00
Andreas Kling
52e019f9aa Only initiate window title bar drags for left mouse button clicks. 2019-01-12 04:16:40 +01:00
Andreas Kling
783c64916b Tidy up window border rendering a bit. 2019-01-12 04:02:36 +01:00
Andreas Kling
bb28c31531 Get rid of the "root widget" concept in WindowManager.
Instead just create a GraphicsBitmap wrapper around the display framebuffer
and teach Painter how to draw directly into a GraphicsBitmap.
2019-01-12 03:42:50 +01:00
Andreas Kling
5db720dc59 Don't repaint the root layer in invalidated areas with windows over them. 2019-01-12 03:13:42 +01:00
Andreas Kling
83252397e4 Ignore WindowManager invalidations inside already invalidated rects. 2019-01-12 03:07:23 +01:00
Andreas Kling
d6bbd2126d Start refactoring the WindowManager to be invalidation driven. 2019-01-12 02:58:58 +01:00
Andreas Kling
a3c39ea9d6 Throw up some widgets on screen so we can see what they look like. 2019-01-11 04:10:07 +01:00
Andreas Kling
e5e295052f Hook up the PS2MouseDevice to the AbstractScreen+WindowManager.
Render the mouse cursor by xor'ing the pixels. I don't know anything about
hardware cursors yet and this way we don't need to recompose the window
hierarchy every time you move the mouse. :^)
2019-01-11 03:52:09 +01:00
Andreas Kling
f6d2c3ed87 Hook everything up to run the GUI on top of the kernel.
Okay things kinda sorta work. Both Bochs and QEMU now boot into GUI mode.
There's a ton of stuff that doesn't make sense and so many things to rework.

Still it's quite cool to have made it this far. :^)
2019-01-10 23:19:29 +01:00
Andreas Kling
3e908abfca Start separating out the SDL-related stuff in Widgets. 2019-01-10 05:21:19 +01:00
Andreas Kling
077f1007eb More window manager hacking. Get rid of TerminalWidget for now. 2019-01-10 05:11:07 +01:00
Andreas Kling
ceb373cf71 More window manager hacking. FocusIn/FocusOut events. 2019-01-09 05:40:04 +01:00
Andreas Kling
7577ee0c67 Remove some #if 0'd code. 2019-01-09 04:51:30 +01:00
Andreas Kling
cfd76ade73 Stop recomposing the window hierarchy after every dang widget paint. 2019-01-09 04:46:16 +01:00
Andreas Kling
f3ec96a1b9 Print the number of WindowManager recompose() calls to debugger. 2019-01-09 04:18:28 +01:00
Andreas Kling
39e236d346 Let WindowManager send out events for WindowBecame{Active,Inactive} 2019-01-09 04:15:17 +01:00
Andreas Kling
4775fd88e3 More window management work.
- Fix inverted mouse event hit test z-ordering.
- Let the RootWidget backing store simply be the display framebuffer.
2019-01-09 03:51:34 +01:00
Andreas Kling
723ff8c2ab Add basic z-order for Windows. 2019-01-09 03:16:58 +01:00
Andreas Kling
9963da9005 Start refactoring graphics system to have per-window backing stores.
It was fun for everyone to share a single framebuffer but it was also
kinda really awful. Let's move towards having a "GraphicsBitmap" as the
backing store for each Window.

This is going to need a lot of refactoring so let's get started.
2019-01-09 02:06:04 +01:00
Andreas Kling
ec1c487dcd Yet another pass of style fixes. 2018-12-21 02:10:45 +01:00
Andreas Kling
959a1b0750 Close the MsgBox when clicking the OK button.
This feels vaguely crashy. I haven't tested window/widget destruction
before so there's sure to be bugs.
2018-10-14 01:23:01 +02:00
Andreas Kling
1929cb6b71 Implement basic focus. 2018-10-13 17:52:47 +02:00
Andreas Kling
44a32039be Let the WindowManager track the active window.
We draw the active window in a different color, obviously. :^)
2018-10-13 17:42:43 +02:00
Andreas Kling
560405667e Start using WeakPtr for some of the WindowManager window pointers. 2018-10-13 17:00:45 +02:00
Andreas Kling
6ea8ce500c Use HashMap::remove() in some places that I wanted it. 2018-10-13 14:26:37 +02:00
Andreas Kling
e16d145cb4 Some color cleanup. 2018-10-12 23:02:23 +02:00
Andreas Kling
6f9e0e3876 After moving a window, try to repaint a bit less.
Only repaint windows that intersect either the old or the new rect.
Also only repaint those rects in the root widget.
2018-10-12 19:39:48 +02:00
Andreas Kling
16576112b0 Add a CheckBox widget. 2018-10-12 14:16:40 +02:00
Andreas Kling
73895ce043 Add a clock widget. 2018-10-12 12:18:59 +02:00
Andreas Kling
6f6f9bd84d Window contents move along with the window! 2018-10-12 02:41:27 +02:00
Andreas Kling
64127e0637 Very hacky support for dragging a window around. 2018-10-12 02:24:05 +02:00
Andreas Kling
22721e6729 The WindowManager can now react to mouse events on the window title bar. 2018-10-12 01:48:18 +02:00
Andreas Kling
5d125e40d9 Deliver mouse events to the appropriate Window. 2018-10-12 01:26:20 +02:00
Andreas Kling
f2fa7b615f Small refactor. 2018-10-12 01:20:06 +02:00
Andreas Kling
02f4d6ef8e Move windowing stuff from AbstractScreen to WindowManager. 2018-10-12 01:11:38 +02:00
Andreas Kling
415c4b90c5 Start adding a Window class. 2018-10-12 01:03:22 +02:00