Andreas Kling
b0e3f73375
Start refactoring the windowing system to use an event loop.
...
Userspace programs can now open /dev/gui_events and read a stream of GUI_Event
structs one at a time.
I was stuck on a stupid problem where we'd reenter Scheduler::yield() due to
having one of the has_data_available_for_reading() implementations using locks.
2019-01-14 14:42:49 +01:00
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
1d914cbd84
Minor GUI API things + make Button corners properly transparent.
2019-01-13 06:26:20 +01:00
Andreas Kling
8f8c8d1ca3
Start working on a GUI kernel API.
2019-01-13 02:02:34 +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
3ac977f50b
Paper over a race in DoubleBuffer.
...
I'm still somewhat okay throwing InterruptDisabler at races as they screw me.
Eventually I'm gonna have to devise a different strategy though.
2019-01-12 23:23:35 +01:00
Andreas Kling
edc827077e
Optimize WindowManager::flush() with fast_dword_copy().
2019-01-12 21:45:45 +01:00
Andreas Kling
6b4e88b515
Give GraphicsBitmap a member for the pitch.
2019-01-12 21:29:05 +01:00
Andreas Kling
6cc8c3799a
Make FrameBuffer::flush() a no-op when building outside of SDL.
2019-01-12 21:22:54 +01:00
Andreas Kling
4e9bcd3092
Draw the cursor *after* flushing all dirty rects.
2019-01-12 21:02:08 +01:00
Andreas Kling
defd899b38
Remove FrameBuffer::blit() since it was superseded by Painter::blit().
2019-01-12 20:59:09 +01:00
Andreas Kling
f2551c45ab
Add fast dword-sized copy and fill to the Painter code.
2019-01-12 20:56:09 +01:00
Andreas Kling
20156f9ec5
Fix broken focus rects (due to yet another Rect semantics bug.)
2019-01-12 17:34:47 +01:00
Andreas Kling
c0c1c88f9b
ListBox: Fix item rect inconsistency between paints and clicks.
2019-01-12 17:29:29 +01:00
Andreas Kling
ecb7e16202
Fix more underdraw bugs in Button due to new Rect semantics.
2019-01-12 17:18:52 +01:00
Andreas Kling
0570bbb6cc
Clip painters to widget rect by default to prevent overdraw.
2019-01-12 17:08:45 +01:00
Andreas Kling
bac9aa90dd
Update Painter class to the new coding style.
2019-01-12 17:02:54 +01:00
Andreas Kling
959ef2e681
Fix rect drawing to grok new Rect semantics.
2019-01-12 16:56:55 +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
8d78b0a8df
Tidy up the h/v line drawing loops a bit.
2019-01-12 16:39:56 +01:00
Andreas Kling
b4bd4f4b29
Make the Event class virtual.
...
I realized that we're leaking all the members in Event subclasses.
2019-01-12 07:24:38 +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
b7d83e3265
Redraw both incoming and outgoing widget when changing focus.
2019-01-12 07:11:24 +01:00
Andreas Kling
07873332e7
Coalesce mouse events to make the GUI go fast.
...
A simple but effective optimization that avoids tons of redraw. :^)
2019-01-12 06:59:10 +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
fd4e86460b
Make PS2MouseDevice behave more like a proper character device.
...
Get rid of the goofy MouseClient interface and have the GUI event loop just
read mouse data from the character device.
The previous approach was awful as it was sending us into random GUI code
in the mouse interrupt handler.
2019-01-12 05:23:16 +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
db0dbbd979
Fix unpainted area in Button rendering.
2019-01-12 04:11:44 +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
9bc7b128b2
Constrain the mouse cursor to keep it inside the screen rect.
2019-01-12 01:00:24 +01:00
Andreas Kling
b95aa18315
Hook up the Keyboard device to the AbstractScreen.
...
Basic text editing in a TextBox works. How very cool :^)
2019-01-11 04:40:05 +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
d1ceb4b603
Fix uninitialized AbstractScreen instance pointer.
...
...yeah yeah, one day I'm gonna zero out the kernel's BSS segment. Soon..
2019-01-11 01:43:41 +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
8626e95509
Make Widgets/ build inside the kernel.
2019-01-10 22:52:14 +01:00
Andreas Kling
e180e2553a
Rename CBitmap to CharacterBitmap.
2019-01-10 05:41:49 +01:00
Andreas Kling
305aa25aae
Let's have an RGBA32 typedef for raw pixel data.
2019-01-10 05:36:32 +01:00
Andreas Kling
df799e6d7b
ColorSDL.cpp -> Color.cpp
2019-01-10 05:29:36 +01:00
Andreas Kling
f603c17136
Merge EventLoopSDL into EventLoop.
2019-01-10 05:28:37 +01:00