Commit Graph

62 Commits

Author SHA1 Message Date
Andreas Kling
5582a0a254 Kernel: When a lock is busy, donate remaining process ticks to lock holder.
Since we know who's holding the lock, and we're gonna have to yield anyway,
we can just ask the scheduler to donate any remaining ticks to that process.
2019-02-07 11:14:58 +01:00
Andreas Kling
443d1c2237 WindowServer: Coordinate double-buffering with the BochsVGA card.
Use the BochsVGA card's virtual-height + virtual-y features to implement
a "hardware double buffering" type scheme.

This is a performance degradation since we now draw a bunch more than before.
But there's also no tearing or cursor flickering. I'm gonna commit this and
try to improve upon it. :^)
2019-02-07 08:56:26 +01:00
Andreas Kling
e29060620f WindowServer: Improve parsing of mouse packets. 2019-02-07 08:08:08 +01:00
Andreas Kling
a1b63bb6d4 Bootloader: Locate the kernel's data segment and clear it.
This was a constant source of stupid bugs and I kept postponing it because
I wasn't in the mood to write assembly code. Until now! :^)
2019-02-06 16:02:10 +01:00
Andreas Kling
731fc5a7c8 Kernel: Much improved BochsVGA (BXVGA) support.
Instead of cowboy-calling the VESA BIOS in the bootloader, find the emulator
VGA adapter by scanning the PCI bus. Then set up the desired video mode by
sending device commands.
2019-02-06 10:17:26 +01:00
Andreas Kling
caff611ca3 WindowServer: Tweak window title bar look. 2019-02-05 13:20:36 +01:00
Andreas Kling
0a183df655 WindowServer: Tweak look of window close button. 2019-02-05 12:01:47 +01:00
Andreas Kling
38f589a9cb SharedGraphics: Add some useful painting helpers and make use of them. 2019-02-05 11:42:58 +01:00
Andreas Kling
cd1bbdf052 WindowServer: Make the window close button look a bit nicer. 2019-02-05 11:05:24 +01:00
Andreas Kling
11db8c1697 Add a simple close button ("X") to windows.
Clicking the button generates a WindowCloseRequest event which the client app
then has to deal with. The default behavior for GWindow is to close() itself.

I also added a flag, GWindow::should_exit_event_loop_on_close() which does
what it sounds like it does.

This patch exposed some bugs in GWindow and GWidget teardown.
2019-02-05 10:31:37 +01:00
Andreas Kling
b1e054ffe8 Rename LizaBold to LizaRegular and LizaBlack to LizaBold.
LizaRegular is quickly becoming my favorite bitmap font. It's so pretty :^)
2019-02-05 09:08:25 +01:00
Andreas Kling
0c38a4c30f WindowServer: Sever the WSWindow/Process link when the process dies.
This fixes a deadlock where the WindowServer would get stuck trying to
acquire a dead process's event stream lock.
2019-02-05 08:32:32 +01:00
Andreas Kling
cacba45f1c LizaBold8x10: Import a bold variant of Liza8x10 and make it the default bold.
Start using it right away for window titles.
2019-02-04 11:37:15 +01:00
Andreas Kling
5e9ba2ac84 Kernel: Rewrite ProcFS.
Now the filesystem is generated on-the-fly instead of manually adding and
removing inodes as processes spawn and die.

The code is convoluted and bloated as I wrote it while sleepless. However,
it's still vastly better than the old ProcFS, so I'm committing it.

I also added /proc/PID/fd/N symlinks for each of a process's open fd's.
2019-02-03 12:33:11 +01:00
Andreas Kling
2a093ada33 WindowServer: Add some stripes to the window titles.
I like the look of this right now. Maybe later I'll feel differently.
2019-02-03 03:38:44 +01:00
Andreas Kling
5e0b7f1a56 Add basic automatic dependency management to Makefiles. 2019-02-02 04:41:59 +01:00
Andreas Kling
ffab6897aa Big, possibly complete sweep of naming changes. 2019-01-31 17:31:23 +01:00
Andreas Kling
5c25f0c4db Destroy all remaining windows in a process when it dies. 2019-01-30 19:35:38 +01:00
Andreas Kling
027d26cd5d Add a String::format() and use that in place of ksprintf() in the Kernel.
You're never gonna be right 100% of the time when guessing how much buffer
space you need. This avoids having to make that type of decision in a bunch
of cases. :^)
2019-01-30 16:28:51 +01:00
Andreas Kling
069d21ed7f Make buttons unpress when the cursor leaves the button rect.
Implement this functionality by adding global cursor tracking.
It's currently only possible for one GWidget per GWindow to track the cursor.
2019-01-27 08:48:34 +01:00
Andreas Kling
d72575d196 LibGUI: Start bringing up GTextBox in the standalone world. 2019-01-26 06:39:13 +01:00
Andreas Kling
f34c0e414b WindowServer: Remove unused WSMessage::is_paint_event(). 2019-01-26 05:49:04 +01:00
Andreas Kling
9fa8d4e22f WindowServer: Rename the two painting phases.
Work now happens in terms of two messages:

    - WM_ClientWantsToPaint
    - WM_ClientFinishedPaint

This feels fairly obvious compared to the old Paint/Invalidate.
2019-01-26 05:45:47 +01:00
Andreas Kling
244d5bcce1 WindowServer: More event -> message renaming. 2019-01-26 05:35:45 +01:00
Andreas Kling
bba21adae3 WindowServer: Rename WSEvent to WSMessage.
Also do the same for WSMessageLoop and WSMessageReceiver. More to come.
2019-01-26 05:28:02 +01:00
Andreas Kling
7cf3c7461c Refactor GUI rendering model to be two-phased.
Instead of clients painting whenever they feel like it, we now ask that they
paint in response to a paint message.

After finishing painting, clients notify the WindowServer about the rect(s)
they painted into and then flush eventually happens, etc.

This stuff leaves us with a lot of badly named things. Need to fix that.
2019-01-26 05:20:32 +01:00
Andreas Kling
5f14e22a31 WindowServer: Make dragging window frames look kinda cool. 2019-01-25 05:19:45 +01:00
Andreas Kling
0db72786cf Snazz up the windows with some title bar gradients. :^) 2019-01-25 05:02:32 +01:00
Andreas Kling
c6b7b92625 WindowServer: Put the desktop background color in a member. 2019-01-25 03:48:50 +01:00
Andreas Kling
a915dd7b27 WindowServer: Retain window backing stores while blitting them. 2019-01-25 03:07:55 +01:00
Andreas Kling
86eae0f8df Let userland retain the window backing store while drawing into it.
To start painting, call:
gui$get_window_backing_store()

Then finish up with:
gui$release_window_backing_store()

Process will retain the underlying GraphicsBitmap behind the scenes.
This fixes racing between the WindowServer and GUI clients.

This patch also adds a WSWindowLocker that is exactly what it sounds like.
2019-01-24 23:44:19 +01:00
Andreas Kling
aa24547e12 Kernel: Finally stop exposing Region members to the public. 2019-01-24 18:09:46 +01:00
Andreas Kling
51595603bd WindowServer: Rename WSEvent subclasses WSFooEvent for consistency.
Add a WSWindowInvalidationEvent that carries a rect instead of having an
awkward single-purpose rect in WSEvent.
Flesh out WSKeyEvent a bit more.
2019-01-21 07:28:04 +01:00
Andreas Kling
aefbbeb3cb Flesh out keyboard event support a bit more. 2019-01-21 07:27:26 +01:00
Andreas Kling
291922b1af WindowServer: Show PID and window ID in title bars for now.
This is useful for debugging since I'm often wondering which process some
window belongs to (and what the window ID is.)
2019-01-21 02:43:38 +01:00
Andreas Kling
786b903d62 WindowServer: Don't invalidate already frontmost window for moving to front. 2019-01-21 02:19:08 +01:00
Andreas Kling
3271c115e2 WindowServer: Only blit dirty rect of windows to back buffer.
Previously we'd blit every pixel in every window that intersected any dirty
rect to the back buffer. With this patch, we limit ourselves to blitting the
pixels inside the actual dirty rects.

There's still a lot of optimizations to make in this code.
2019-01-20 23:42:36 +01:00
Andreas Kling
1586bc99e3 WSWindowManager: Add an invalidation and a FIXME. 2019-01-20 08:37:24 +01:00
Andreas Kling
ea6678b7b3 LibGUI: Hook up GWindow event dispatch for paint and mouse events. 2019-01-20 07:03:38 +01:00
Andreas Kling
8eae89a405 Start bringing up LibGUI properly (formerly Widgets.) 2019-01-20 05:48:43 +01:00
Andreas Kling
7e5b81fe48 Make a SharedGraphics directory for classes shared between Kernel and LibGUI. 2019-01-19 23:22:46 +01:00
Andreas Kling
b413e234e1 WSWindowManager: Minor style fixes. 2019-01-19 14:33:59 +01:00
Andreas Kling
102a5add16 Invalidate the window when starting to drag it.
This ensures that the drag color shows up immediately.
2019-01-19 14:29:59 +01:00
Andreas Kling
4bffdd2394 WindowServer: Use a different border color for windows being dragged.
Also get rid of an unnecessary invalidation on drag end.
2019-01-18 15:55:28 +01:00
Andreas Kling
f7cc454162 Add mechanism to expose kernel variables to userspace via ProcFS.
Only booleans are supported at first. More types can be added easily.
Use this to add /proc/sys/wm_flash_flush which when enabled flashes pending
screen flush rects in yellow before they happen.
2019-01-18 15:01:40 +01:00
Andreas Kling
9454c5dd52 WindowServer: Merge WSFrameBuffer into WSScreen. 2019-01-18 05:41:15 +01:00
Andreas Kling
bb28c143fd Update coding style in WSWindowManager. 2019-01-18 05:33:35 +01:00
Andreas Kling
dff5051905 Support polling with select() by using a zero timeout.
Use this in WindowServer to avoid getting blocked in select() when
there are pending injected events.
2019-01-18 05:28:07 +01:00
Andreas Kling
a01e119e05 WindowServer: Always select() in the event loop.
This fixes an issue where a steady stream of injected events would prevent
us from ever draining the mouse and keyboard inputs.
2019-01-18 04:59:08 +01:00
Andreas Kling
dff70021ab Make it possible to invalidate only a portion of a window.
Use this in Terminal to only invalidate rows where anything changed.
2019-01-18 04:37:49 +01:00