Commit graph

369 commits

Author SHA1 Message Date
Andreas Kling
46181cf023 Oops, finish WindowServer rename. 2019-01-15 21:46:15 +01:00
Andreas Kling
52c004eb53 Add internal locking to DoubleBuffer. 2019-01-15 21:43:38 +01:00
Andreas Kling
e42f090ed3 Rename WindowComposer -> WindowServer.
I keep referring to it as the windowing server anyway.
2019-01-15 21:16:04 +01:00
Andreas Kling
e452303c66 Allow character devices to block write attempts until there is more space. 2019-01-15 09:17:22 +01:00
Andreas Kling
49b63281a0 Make it possible for a process to switch controlling terminals.
Via the TIOCSCTTY and TIOCNOTTY ioctls.
2019-01-15 08:49:24 +01:00
Andreas Kling
6f61eb4a87 Slap an InterruptDisabler on gui$invalidate_window().
This is obviously not a permanent solution but it works now to allow
the windowing system to withstand invalidation spam.
2019-01-15 08:23:13 +01:00
Andreas Kling
14712ad9c5 Let's do dword-at-a-time memcpy() and memset() in userspace as well.
Also fix a dumb bug that showed up when I was memsetting something other
than zeroes.
2019-01-15 08:14:44 +01:00
Andreas Kling
78696236d3 Add very basic KeyDown events to the GUI event stream.
The Terminal program now hosts an interactive shell. :^)
2019-01-15 06:51:00 +01:00
Andreas Kling
c0ef060a7c Let's just assume we have 32MB of physical memory to work with.
I should eventually figure out the exact amount of memory but not now.
2019-01-15 06:48:36 +01:00
Andreas Kling
2f74c2f430 Add basic PTY support.
For now, there are four hard-coded PTYs: /dev/pt{m,s}[0123]
Use this in the Terminal to open a pty pair and spawn a shell.
2019-01-15 06:30:19 +01:00
Andreas Kling
6d8043767e Start working on a graphical Terminal program. 2019-01-15 04:30:55 +01:00
Andreas Kling
b673c1a77d Build Painter & friends into LibC. Use it in the GUI test app. 2019-01-14 20:02:51 +01:00
Andreas Kling
0c5ecd303c Share GraphicsBitmaps between the windowing server and the client process.
This is pretty cool. :^)

GraphicsBitmaps are now mapped into both the server and the client address
space (usually at different addresses but that doesn't matter.)

Added a GUI syscall for getting a window's backing store, and another one
for invalidating a window so that the server redraws it.
2019-01-14 15:25:34 +01:00
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
e7b1101f62 TTY::write() should return the number of bytes written. 2019-01-14 00:19:03 +01:00
Andreas Kling
0ead888821 gui$create_widget() shouldn't try to make button corners opaque. 2019-01-13 07:33:10 +01:00
Andreas Kling
f7261d7b26 Let's use the existing Rect and Color types in the GUI API.
Any type that doesn't depend on indirect data can probably be used here.
2019-01-13 05:31:07 +01:00
Andreas Kling
b2d86b7597 Add basic GUI API for creating labels and buttons. 2019-01-13 05:03:17 +01:00
Andreas Kling
17c7bf01a5 Fix Userland build. 2019-01-13 04:31:16 +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
c43903eebd Don't use dword-by-dword memset/memcpy if the addresses are unaligned.
Also don't enable the large kmalloc catcher by default.
2019-01-12 23:36:08 +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
2e2d883c09 Print process name and PID when kmalloc() panics. 2019-01-12 21:48:41 +01:00
Andreas Kling
edc827077e Optimize WindowManager::flush() with fast_dword_copy(). 2019-01-12 21:45:45 +01:00
Andreas Kling
24b2cadb82 Make the kernel's memcpy() and memset() go fast with dword copies.
Also I learned that the ABI allows us to assume DF=0 on function entry.
2019-01-12 18:14:40 +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
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
0e6c19ffa6 Reduce PS2MouseDevice debug spam in every dang mouse interrupt. 2019-01-12 03:20:48 +01:00
Andreas Kling
fa6029eed0 Make the kernel's memset do a "rep stosb" because. 2019-01-12 02:23:09 +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
31667b47a5 Teach PS2MouseDevice to read the left and right buttons. 2019-01-11 02:45:06 +01:00
Andreas Kling
e740f1195a Add a simple PS/2 mouse device.
It's not hooked up to anything just yet, but it does read movement deltas.
2019-01-11 02:28:53 +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
659c54e32b Switch into 1024x768x32bpp VESA LFB mode at boot.
This is going to be pretty cool once I can hook up the Widgets/ code to it.
2019-01-09 02:29:11 +01:00
Andreas Kling
2735b7e50d Add PhysicalAddress::offset(). 2019-01-08 22:29:34 +01:00
Andreas Kling
355201f34d Vector<String>() -> { } 2019-01-08 22:28:11 +01:00
Andreas Kling
ba91ab1038 Don't omit frame pointers. Duh. This fixes /proc/PID/stack listings. 2019-01-04 19:02:21 +01:00
Andreas Kling
bad2fe33ad Fix crash when doing "ls -l" in the /proc/PID directory for a kernel process. 2019-01-04 18:50:16 +01:00
Andreas Kling
7731aef7b2 Let the "reaped unparented process" messages go straight to the debugger. 2019-01-01 03:56:39 +01:00
Andreas Kling
4b6a8f8a08 Unbreak ksym loading and make reading /proc/PID/stack not crash. 2019-01-01 02:20:01 +01:00
Andreas Kling
683185e4aa MM: Allocate page tables from a separate set of physical pages.
The old approach only worked because of an overpermissive accident.
There's now a concept of supervisor physical pages that can be allocated.
They all sit in the low 4 MB of physical memory and are identity mapped,
shared between all processes, and only ring 0 can access them.
2019-01-01 02:09:43 +01:00
Andreas Kling
a5ffa2eec7 Add a PageDirectory::flush() that does nothing if another PD is active.
This way callers can just flush() every time after making any modification
and the PageDirectory itself will decide if TLB invalidation is necessary.
2018-12-31 20:52:59 +01:00
Andreas Kling
9eca2ffd41 Make PhysicalPage eternally allocated. 2018-12-31 20:25:42 +01:00
Andreas Kling
3e37a1f5c3 Optimize PageDirectory destruction.
Remove an extra hash lookup and only iterate over the actually-used
PhysicalPages that we need to clean up.
2018-12-31 15:18:02 +01:00