Commit Graph

622 Commits

Author SHA1 Message Date
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
d0137f0e96 Terminal: optimize repaints a bunch.
We track dirty character cells + pending whole-terminal scrolls.
This drastically reduces the number of pixels pushed.
2019-01-15 10:23:15 +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
10308c6434 Let's not require TERM=ansi for tgetent() to work. 2019-01-15 08:32:53 +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
a8e42bacf4 Minor Terminal tweaks. 2019-01-15 07:57:30 +01:00
Andreas Kling
d14ec951ea Terminal: Add some inset and line spacing.
This is starting to feel vaguely usable! :^)
2019-01-15 07:39:51 +01:00
Andreas Kling
c24f543a57 Terminal: basic ANSI color support. 2019-01-15 07:30:24 +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
ecb4ab0943 Add Terminal/.gitignore 2019-01-15 04:49:01 +01:00
Andreas Kling
dfff2996d2 Factor out individual glyph drawing into Painter::draw_glyph(). 2019-01-15 04:44:47 +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
bfef4afa6a So long SDL stuff. You were a nice bootstrapping environment. 2019-01-14 15:30:37 +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
b4da4e8fbd Always inline the locks. 2019-01-14 14:14:30 +01:00
Andreas Kling
11331e9639 Add Vector::take_first(). 2019-01-14 02:49:30 +01:00
Andreas Kling
973ff14180 Make QtCreator stop complaining about the ASSERT macro. 2019-01-14 00:35:07 +01:00
Andreas Kling
e7b1101f62 TTY::write() should return the number of bytes written. 2019-01-14 00:19:03 +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
0ead888821 gui$create_widget() shouldn't try to make button corners opaque. 2019-01-13 07:33:10 +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
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
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
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
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
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
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