Andreas Kling
7e5b81fe48
Make a SharedGraphics directory for classes shared between Kernel and LibGUI.
2019-01-19 23:22:46 +01:00
Andreas Kling
b75ee4aacb
Coding style fixes in AK.
2019-01-19 22:53:05 +01:00
Andreas Kling
7e044cf293
Add a simple /bin/sysctl that wraps the files in /proc/sys.
2019-01-18 15:35:38 +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
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
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
Andreas Kling
9d7da26b4e
StringBuilder: Use a ByteBuffer internally instead of a Vector<String>.
2019-01-18 03:27:51 +01:00
Andreas Kling
074edffc44
Add a simple StringBuilder::appendf() and use it for ProcFS.
...
Okay, now ProcFS doesn't crash due to the crappy buffer size estimates
not really working out. This thing has dogshit performance and I will
fix that separately.
2019-01-18 02:46:39 +01:00
Andreas Kling
dad58db757
Add WindowActivated and WindowDeactivated events.
...
Use this to implement different looking Terminal cursors depending on
the window active state.
2019-01-17 17:38:04 +01:00
Andreas Kling
e9e57c5f65
Rename SpinLock to Lock. It hasn't been a SpinLock for some time.
...
I'm pretty happy with the mechanism of AK::Lock for now.
2019-01-17 16:25:02 +01:00
Andreas Kling
dc20f00872
PS2MouseDevice: Try to synchronize the data reporting stream.
...
Turns out this was the reason QEMU wouldn't boot us.
2019-01-17 02:13:21 +01:00
Andreas Kling
a2ec09bc20
Allow the scheduler to unblock the current process.
...
It's a bit confusing that the "current" process is not actually running
while we're inside the scheduler. Perhaps the scheduler should redirect
"current" to its own dummy Process. I'm not sure.
Regardless, this patch improves responsiveness by allowing the scheduler
to unblock a process right after it calls select() in case it already has
a pending wakeup request.
2019-01-16 17:47:18 +01:00
Andreas Kling
4fef895eda
Rework WindowServer to use select() in its main event loop.
...
The system can finally idle without burning CPU. :^)
There are some issues with scheduling making the mouse cursor sloppy
and unresponsive that need to be dealt with.
2019-01-16 17:20:58 +01:00
Andreas Kling
f7ca6d254d
Tear out or duplicate what's unique for WindowServer from Widgets.
...
This turned into a huge refactoring that somehow also includes
making locks recursive/reentrant.
2019-01-16 16:03:50 +01:00
Andreas Kling
e655aebd70
Window: Update coding style.
2019-01-16 13:50:24 +01:00
Andreas Kling
9dd29f9aa9
Add a PTY multiplexer (/dev/ptmx) device.
...
When you open /dev/ptmx, you get a file descriptor pointing to one of the
available MasterPTY's. If none are available, you get an EBUSY.
This makes it possible to open multiple (up to 4) Terminals. :^)
To support this, I also added a CharacterDevice::open() that gets control
when VFS is opening a CharacterDevice. This is useful when we want to return
a custom FileDescriptor like we do here.
2019-01-16 13:39:32 +01:00
Andreas Kling
b46ae2bf09
Get rid of Vnode concept.
...
We already have an abstraction between Process and Inode/CharacterDevice/FIFO
and it's called FileDescriptor. :^)
2019-01-16 12:57:07 +01:00
Andreas Kling
310a5f4199
Let each MasterPTY create its slave.
2019-01-16 02:11:50 +01:00
Andreas Kling
9c51d9dfcd
Catch anyone trying to use a DoubleBuffer with interrupts disabled.
2019-01-16 01:58:11 +01:00
Andreas Kling
09ba129bcf
Use a CircularQueue for the PS/2 mouse driver.
2019-01-16 01:52:39 +01:00
Andreas Kling
8ad2dfb6e1
Rename FileDescriptor::has_data_available_for_reading() -> can_read().
2019-01-16 00:47:00 +01:00
Andreas Kling
a8baee4dcd
Tidy up memory map a bit and write out the general map in MemoryManager.
...
There was a bug that given enough supervisor page allocation, we would
eventually start dipping into the kmalloc range.
2019-01-16 00:44:09 +01:00
Andreas Kling
bd3e77cc16
Pass the process to CharacterDevice::read/write.
...
This is much nicer than grabbing directly at 'current' inside a read().
2019-01-16 00:20:38 +01:00
Andreas Kling
08bfe518f9
Rename CharacterDevice::has_data_available_for_reading() -> can_read().
2019-01-16 00:10:13 +01:00
Andreas Kling
10387beda7
Implement basic support for POSIX-style select().
...
Now we can block on both the PTY *and* the GUI event stream in Terminal.
2019-01-16 00:09:58 +01:00
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