Commit Graph

331 Commits

Author SHA1 Message Date
Andreas Kling
f8b72ab3ab GTextEditor: Add basic PageUp/PageDown navigation support. 2019-03-07 17:11:17 +01:00
Andreas Kling
187d7cb400 GTextEditor: Add write_to_file(String path) :^) 2019-03-07 17:06:11 +01:00
Andreas Kling
a5bc20c733 GTextEditor: Support starting with an empty document. 2019-03-07 16:51:47 +01:00
Andreas Kling
43d56b6f3a GTextEditor: Support splitting lines at the cursor with the Return key. 2019-03-07 16:49:21 +01:00
Andreas Kling
a64b71fb3d GTextEditor: Support forward delete/merge with the Delete key. 2019-03-07 16:33:20 +01:00
Andreas Kling
38662f884d GTextEditor: Merge with previous line if backspacing at column 0. 2019-03-07 16:15:25 +01:00
Andreas Kling
6094f592a9 GTextEditor: More work on basic line editing. Insert/remove characters. 2019-03-07 16:04:21 +01:00
Andreas Kling
8425ea971a GTextEditor: Start working on editing, starting with inserting newlines. 2019-03-07 15:52:11 +01:00
Andreas Kling
b4df33e453 GTextEditor: Only paint lines inside the dirty rect.
This dramatically improves performance in large documents. :^)
2019-03-07 15:03:38 +01:00
Andreas Kling
ce35cddb1b GTextEditor: Let's use a Vector for the line backing store.
I'm eventually gonna want to replace this with something more clever,
like a automagically splicing vector or something, but for now, at least
we move away from immutable Strings.
2019-03-07 14:35:32 +01:00
Andreas Kling
a21ecd440a GTextEditor: Allow moving the cursor by clicking. 2019-03-07 14:02:10 +01:00
Andreas Kling
9997992907 GTextEditor: Make the cursor invalidation work with the padding(). 2019-03-07 13:54:02 +01:00
Andreas Kling
60c1ab5fbe GTextEditor: Scroll the cursor into view before updating it. 2019-03-07 13:34:00 +01:00
Andreas Kling
9591acc212 GTextEditor: Remove some debug spam. 2019-03-07 13:26:02 +01:00
Andreas Kling
77198ef735 GTextEditor: Simplify update_cursor(). 2019-03-07 13:23:17 +01:00
Andreas Kling
6a6bcc5daf GTextEditor: Add Home/End and Ctrl+Home/Ctrl+End navigation shortcuts.
For start/end of line and start/end of document respectively.
2019-03-07 13:21:51 +01:00
Andreas Kling
1ac71d1fb1 GTextEditor: Improvements to cursor rendering.
The view now scrolls along with you as you move the cursor around.
2019-03-07 13:13:25 +01:00
Andreas Kling
dff57909a7 GTextEditor: Only draw the cursor line background shade when focused. 2019-03-07 02:26:44 +01:00
Andreas Kling
6db132069f GTextEditor: Draw the cursor line in a slightly darker shade. 2019-03-07 02:24:46 +01:00
Andreas Kling
1f92636c6d GTextEditor: Make the cursor blink while the editor is focused. 2019-03-07 01:05:35 +01:00
Andreas Kling
ca65ca2f2d TextEditor: Show the current cursor position in the statusbar. 2019-03-07 00:46:29 +01:00
Andreas Kling
9158de6c41 Begin working on a graphical TextEditor.
It's gonna be a wrapper around a new GTextEditor widget so I can easily
reuse the functionality anywhere I need it. :^)
2019-03-07 00:31:06 +01:00
Andreas Kling
7df1121e1c LibGUI: GTableModel::data() should take a GModelIndex instead of int,int. 2019-03-06 19:56:47 +01:00
Andreas Kling
dc4e6dd7bc LibGUI: Fix LibGUI::to_string() for GVariant::Type::Float. 2019-03-06 19:49:59 +01:00
Andreas Kling
09ecef6299 GTableView: Ignore right clicks for now. 2019-03-06 19:44:18 +01:00
Andreas Kling
31d6b640eb Add a bold variant of Katica and make that the system's default bold font.
..and do some minor tweaks to the font rendering code.
2019-03-06 14:50:27 +01:00
Andreas Kling
66a5ddd94a More work on the variable-width font support.
Katica is now the default system font, and it looks quite nice. :^)
I'm gonna need to refine the GTextBox movement stuff eventually,
but it works well-enough for basic editing now.
2019-03-06 14:06:40 +01:00
Andreas Kling
7f6c81d90f Implement basic support for variable-width fonts.
Also add a nice new font called Katica. It's not used anywhere yet but
I'm definitely itching to start using it. :^)
2019-03-06 12:52:41 +01:00
Andreas Kling
0a86366c71 Make a preparation pass for variable-width fonts. 2019-03-06 11:03:10 +01:00
Andreas Kling
086a0fc969 LibGUI: Let GApplication::exec() call exit() instead of returning to main().
This sidesteps the problem of having various things on the heap that don't
get torn down. It's obviously not a great solution, but it'll work for now.
2019-03-05 12:48:59 +01:00
Andreas Kling
d932c03843 GTableView: Tweak focus appearance for selected items. 2019-03-04 11:17:25 +01:00
Andreas Kling
06bd2fb2d5 GTableView: Allow initiating keyboard navigation with no current selection. 2019-03-04 10:57:26 +01:00
Andreas Kling
7e955f7b60 GTableView: Tweak the look of column headers. 2019-03-04 10:54:34 +01:00
Andreas Kling
4ea7a51ecd LibGUI: Improve GStatusBar and GToolBar and share some code via GStyle. 2019-03-04 10:47:54 +01:00
Andreas Kling
ac2a3f7fdf GTableView: Make the last column header separator look right. 2019-03-04 10:26:16 +01:00
Andreas Kling
f91a20f9d0 LibGUI: Unbreak clearing GTableView selection by clicking outside items.
Also, clicking on the column headers should not clear selection.
2019-03-04 10:18:05 +01:00
Andreas Kling
ef4d517429 LibGUI: Tweak focus appearance and add it to GTableView. 2019-03-04 10:12:09 +01:00
Andreas Kling
57fe316e01 Detect the "Logo" (Windows/Apple/whatever) key and use it for window resize.
This will be comfortable enough while I'm still developing with emulators.
QEMU keeps eating my "Alt" key presses and it's making things difficult.
2019-03-03 12:56:48 +01:00
Andreas Kling
5e40aa4f1a LibGUI: Move shortcut actions from GEventLoop to GApplications.
I'm gonna want to have nested event loops sooner or later, so let's not
pollute GEventLoop with things that are meant to work globally.

This patch also changes key events to pass around their modifiers as a
bitfield all the way around the system instead of breaking them up.
2019-03-03 12:32:15 +01:00
Andreas Kling
b0c673265a Applications: Map Alt+F4 to Quit in FileManager/ProcessManager/Terminal. 2019-03-03 02:52:22 +01:00
Andreas Kling
d94abc4f81 FileManager+LibGUI: Add a simple location textbox.
The widget layout here is a bit off and needs work.
2019-03-03 00:34:40 +01:00
Andreas Kling
63cdc3d2d5 LibGUI: Support GTableView navigation with Page Up and Page Down.
Also base the vertical scrollbar's gutter range on the visible content rect,
making it very similar to a Page Up/Down. Maybe they should be exactly the
same, I don't know.
2019-03-02 23:58:45 +01:00
Andreas Kling
596a5ce5a4 LibGUI+WindowServer: Add app-global keyboard shortcuts.
This patch adds a GShortcut class. Each GAction can have a GShortcut which
will cause the event loop to listen for that key combination app-globally
and activate the event in case it's pressed.

The shortcut will also be displayed when the action is added to a menu.

Use this to hook up Alt+Up with the "open parent directory" action in the
FileManager app. :^)
2019-03-02 10:10:06 +01:00
Andreas Kling
574a399347 LibGUI: GTableView should scroll items into view when keyboard navigating. 2019-03-01 14:29:34 +01:00
Andreas Kling
b5dcad932e LibGUI: Allow basic keyboard navigation in GTableView.
Pressing Enter will now "activate" the selected index, meaning that
the model gets a call to activate(GModelIndex).
2019-03-01 13:48:08 +01:00
Andreas Kling
e1d0a3f226 LibGUI: Let GTableModel handle the selection instead of doing it virtually.
It's silly to force every subclass models to deal with selection.
2019-03-01 13:03:13 +01:00
Andreas Kling
9c21874d33 LibGUI: GTableView scrolling ranges should be based on the available area.
We have to subtract the headers and scrollbars to get the correct behavior.
2019-03-01 11:04:55 +01:00
Andreas Kling
6c2089c59d Put miscellaneous debug spam behind #ifdefs. 2019-03-01 10:51:58 +01:00
Andreas Kling
b5e5f26a82 Base: Add Csilla Bold 7x10 variant.
It's nice to have a thin and a bold variant to complement each other.
2019-03-01 02:50:50 +01:00
Andreas Kling
567a403683 LibGUI: Tweak GStatusBar margins. 2019-02-28 22:33:39 +01:00
Andreas Kling
bff5b71467 LibGUI: Add a GModelNotification class that views will receive.
I don't want to use GEvent here since these need to be synchronous
and mixing sync and async GEvents would be stupid.
2019-02-28 21:30:17 +01:00
Andreas Kling
b132150799 LibGUI: Support bitmaps in GTableView cells.
Use this to add an icon for each process in the ProcessManager.
Right now they all use a generic gear icon, but I'd like to have
per-process icons, obviously. :^)
2019-02-28 20:16:10 +01:00
Andreas Kling
3fe7ddadaf LibGUI: Clip to paint event rect in most widgets. 2019-02-28 19:34:55 +01:00
Andreas Kling
737a4d2377 LibGUI: Both GToolBar and GStatusBar should have highlight/shadow. 2019-02-28 19:31:37 +01:00
Andreas Kling
c5d88ff0d8 LibGUI: Top line on GStatusBar should be a highlight, not a shadow. 2019-02-28 19:17:08 +01:00
Andreas Kling
fd428d6ed3 SharedGraphics: Make Painter clipping work with translated clip origin. 2019-02-28 18:57:36 +01:00
Andreas Kling
8eefdbdce8 LibGUI: Add horizontal scrollbar to GTableView.
Now we can scroll content in both directions if it won't fit in the view.
2019-02-28 17:58:53 +01:00
Andreas Kling
28652a0bf7 LibGUI: GTableView was accidentally obscuring the last row. 2019-02-28 16:42:18 +01:00
Andreas Kling
75fabef57b LibGUI: Add GVariant class and use it for table model data. 2019-02-28 16:20:29 +01:00
Andreas Kling
62b4f39cd4 LibGUI: GTableView should clear the selection if clicking outside items. 2019-02-28 14:05:02 +01:00
Andreas Kling
6af2ce0f7e LibGUI: Re-enable the update rect coalescing. 2019-02-28 13:58:04 +01:00
Andreas Kling
7eb42b5ffb LibGUI: GTableView paints itself completely, no need for auto filling. 2019-02-28 13:57:41 +01:00
Andreas Kling
827ec99a8f LibGUI: Update GTableView's scrollbar range in response to resize. 2019-02-28 13:25:52 +01:00
Andreas Kling
fd280a6a03 LibGUI: Pad GTableView cells on the right side as well. 2019-02-28 11:31:07 +01:00
Andreas Kling
b4c20789fb LibGUI: Allow specifying per-column text alignment. 2019-02-28 11:27:04 +01:00
Andreas Kling
40c8dd80d1 LibGUI: Draw separators between GTableView column headers. 2019-02-28 11:04:03 +01:00
Andreas Kling
dc9f8a9361 LibGUI: Take ProcessManager's process view and turn it into GTableView.
Make it sufficiently generic that it can be reused for any table data. :^)
2019-02-28 10:57:09 +01:00
Andreas Kling
6e571b66f1 ProcessManager: Move ProcessTableModel class to its own files. 2019-02-28 10:20:04 +01:00
Andreas Kling
166aadc4e1 ProcessManager: Start working on a graphical process manager.
I need a table view widget for this thing, so I'm also using this to
prototype a model/view thingy.
2019-02-28 01:43:50 +01:00
Andreas Kling
6e70ba7d1d LibGUI: GWindow should only discard the backing store on actual resize. 2019-02-27 18:52:12 +01:00
Andreas Kling
3f29a12d90 More compat work. Rename libraries from LibFoo.a => libfoo.a
This makes it more straightforward to build a cross-compiler toolchain.
Also move math stuff from LibC to LibM.
2019-02-26 13:30:57 +01:00
Andreas Kling
c90962b842 LibGUI: Make toolbars a bit bigger by default. 2019-02-26 11:14:35 +01:00
Andreas Kling
9444ed0117 LibGUI: Remove gradient from the default button style.
Buttons actually look nicer without the gradient. :^)
2019-02-26 11:14:07 +01:00
Andreas Kling
ae90043424 WindowServer+LibGUI: Send the window size along with Paint server messages.
This way GWindow doesn't need to do synchronous IPC to fetch the appropriate
size for the window's backing store. This is mostly only relevant during
live resize.
2019-02-26 10:53:21 +01:00
Andreas Kling
1effe70543 WindowServer+LibGUI: Fix global mouse tracking with recursive widget trees.
Also avoid sending multiple copies of mouse events to global trackers.
2019-02-26 10:34:05 +01:00
Andreas Kling
95cfa49f1b LibGUI: Make event receivers be weak pointers. 2019-02-26 00:51:49 +01:00
Andreas Kling
9624b54703 More moving towards using signed types.
I'm still feeling this out, but I am starting to like the general idea.
2019-02-25 22:06:55 +01:00
Andreas Kling
901b7d5d91 Fix a bunch of compiler warnings. Not all, but a lot. 2019-02-25 19:05:51 +01:00
Andreas Kling
15fb917f28 Convert more RetainPtr use to Retained. 2019-02-25 16:04:08 +01:00
Andreas Kling
2cfcbdc735 AK: Add Retained<T>, like RetainPtr, but never null.
Also use some Clang attribute wizardry to get a warning for use-after-move.
2019-02-25 12:43:52 +01:00
Andreas Kling
d7753c7c8d Move over to building all of userspace with i686-pc-serenity-g++. 2019-02-22 14:45:14 +01:00
Andreas Kling
75b100673f Switch over to building everything with i686-elf-g++. 2019-02-22 10:45:32 +01:00
Andreas Kling
f5f136931a Kernel: Start adding various file system permission checks.
Fail with EACCES in various situations. Fix userland bugs that were exposed.
2019-02-21 15:45:31 +01:00
Andreas Kling
6084cd0c56 Add concept of size increments to windowing system.
Use this to implement incremental resizing for Terminal so that we only
ever resize to fit a perfect number of rows and columns.

This is very nice. :^)
2019-02-21 00:21:23 +01:00
Andreas Kling
fa02d2a39b Rework the rendering model so that clients instantiate backing stores.
This makes interactive resizing work a lot better, althought it's still not
perfect. There are still glitches and unpleasant flashes of zeroed memory.
2019-02-20 22:08:14 +01:00
Andreas Kling
59b8183c4b WindowServer: Support resizing windows.
This is pretty limited and not entirely stable, but it does work! :^)
2019-02-20 15:34:55 +01:00
Andreas Kling
9763eb44f9 LibGUI: Pack toolbar buttons closer together. 2019-02-20 11:56:28 +01:00
Andreas Kling
bf30502560 LibGUI: Implement enter/leave events (with WindowServer support.)
Windows now learn when the mouse cursor leaves or enters them.
Use this to implement GWidget::{enter,leave}_event() and use that
to implement the CoolBar button effect. :^)
2019-02-20 10:12:19 +01:00
Andreas Kling
d353c7c3d6 LibGUI: Support different button styles.
I want to try an MS Office 97 "CoolBar" inspired look for my toolbars.
This is only the painting support, we still need hover events to implement
the actual effect.
2019-02-20 09:22:38 +01:00
Andreas Kling
dc753b58a5 LibGUI: Improve GBoxLayout so it can better support GToolBar.
Added spacing and margin concepts to GLayout. Support layout a sequence
of nothing but fixed-size objects in the desired orientation. :^)
2019-02-20 09:04:28 +01:00
Andreas Kling
b704d3d295 LibGUI: Add a GToolBar class that can be populated with GActions.
The same action can be added to both a menu and a toolbar.
Use this to put a toolbar into FileManager. This is pretty neat. :^)
2019-02-20 02:39:46 +01:00
Andreas Kling
9b71307d49 WindowServer: Support windows with alpha channels. And per-WSWindow opacity.
This patch also adds a Format concept to GraphicsBitmap. For now there are
only two formats: RGB32 and RGBA32. Windows with alpha channel have their
backing stores created in the RGBA32 format.

Use this to make Terminal windows semi-transparent for that comfy rice look.
There is one problem here, in that window compositing overdraw incurs
multiple passes of blending of the same pixels. This leads to a mismatch in
opacity which is obviously not good. I will work on this in a later patch.

The alpha blending is currently straight C++. It should be relatively easy
to optimize this using SSE instructions.

For now I'm just happy with the cute effect. :^)
2019-02-19 01:42:53 +01:00
Andreas Kling
8eedbbc9ca Prune compiler flags a bit. Let's go with -march=i686 for now. 2019-02-17 15:17:21 +01:00
Andreas Kling
8321908abe LibGUI: Tweak the scrollbar and button styles a bit. 2019-02-17 12:08:28 +01:00
Andreas Kling
4b15dd2bca LibGUI: Rename GEventLoop::exit() and GApplication::exit() to quit().
These functions don't exit immediately, but rather on the next iteration
of the event loop.

Since exit() is already used by the standard library, let's call it quit()
instead. That way, saying exit() means the same thing here as anywhere else.
2019-02-17 09:59:56 +01:00
Andreas Kling
18062f4ad6 LibGUI: Remove some debugging noise. 2019-02-17 01:05:24 +01:00
Andreas Kling
10d6f9ce31 SharedGraphics: Removed some unused stuff from Font. 2019-02-17 00:36:55 +01:00
Andreas Kling
640360e958 Move WindowServer to userspace.
This is a monster patch that required changing a whole bunch of things.
There are performance and stability issues all over the place, but it works.
Pretty cool, I have to admit :^)
2019-02-17 00:13:47 +01:00
Andreas Kling
df6aaaeeef Enable -Wimplicit-fallthrough. 2019-02-15 12:39:16 +01:00
Andreas Kling
29c49356e3 WindowServer: Rename GUI_Foo to WSAPI_Foo. 2019-02-15 09:17:18 +01:00
Andreas Kling
a54cd84c59 Move WindowServer API types header into WindowServer/. 2019-02-15 09:14:21 +01:00
Andreas Kling
c7f5213d5b LibGUI: Add some extremely primitive retrying for the server connection. 2019-02-14 17:43:20 +01:00
Andreas Kling
bf58241c11 Port the WindowServer and LibGUI to communicate through local sockets.
This is really cool! :^)

Apps currently refuse to start if the WindowServer isn't listening on the
socket in /wsportal. This makes sense, but I guess it would also be nice
to have some sort of "wait for server on startup" mode.

This has performance issues, and I'll work on those, but this stuff seems
to actually work and I'm very happy with that.
2019-02-14 17:18:35 +01:00
Andreas Kling
427df5f312 LibGUI: Yield (using select()) in GEventLoop::wait_for_specific_event().
This is factored a bit stupidly. It would be nicer to just have the
read() in drain_events_from_server() be blocking, but the fd is opened
with O_NONBLOCK right now.

This makes everything run real snappy once again. :^)
2019-02-14 10:06:41 +01:00
Andreas Kling
222a6f7bbc WindowServer: Post error messages to clients on protocol failure. 2019-02-14 09:32:34 +01:00
Andreas Kling
f529b845ec WindowServer: Convert entire API to be message-based.
One big step towards userspace WindowServer. :^)
2019-02-14 01:21:32 +01:00
Andreas Kling
ef4e9860fd WindowServer: Convert the remaining menu APIs into messages. 2019-02-13 21:47:14 +01:00
Andreas Kling
cf432b4c3d WindowServer: Refactor more of the menu APIs to be message-based.
This is all pretty verbose but I can whittle it down later. :^)
2019-02-13 18:49:23 +01:00
Andreas Kling
fbbf57b61c Rename GUI_Event to GUI_ServerMessage.
Now that communication is becoming bidirectional, "event" is no longer right.
2019-02-13 17:59:38 +01:00
Andreas Kling
4f98a35beb WindowServer: Begin refactoring towards a fully asynchronous protocol.
In order to move the WindowServer to userspace, I have to eliminate its
dependence on system call facilities. The communication channel with each
client needs to be message-based in both directions.
2019-02-13 17:54:30 +01:00
Andreas Kling
96352ab735 LibGUI: Pass the computed max_fd(+1) to select(). 2019-02-13 17:08:13 +01:00
Andreas Kling
d74b131c27 Add a little About app and hook it up to the system menu's "About..." entry.
Added icons and customizable text alignment to GLabel.
2019-02-12 15:23:07 +01:00
Andreas Kling
d6326d6c2e LibGUI: Add a GFontDatabase class that lets you enumerate fonts and more.
"More" in this case being also giving you the ability to load a font by name.
Use this as backend for Terminal's font menu. :^)
2019-02-12 14:36:19 +01:00
Andreas Kling
3085e400bc LibGUI: Add GAction class and make GMenu deal in actions rather than strings. 2019-02-12 14:09:48 +01:00
Andreas Kling
4b8133e925 WindowServer: Clean up any menu objects on process exit.
..and now that this works, implement the Quit menu action in Terminal. :^)
2019-02-12 10:41:09 +01:00
Andreas Kling
db98327bdc Plumb menu item activation events from WindowServer to clients.
GMenu now has an "on_item_activation" callback that fires whenever one
of its items are activated. The menu item identifier is used to distinguish
between items.

Use this to implement font switching in Terminal. :^)
2019-02-12 10:08:35 +01:00
Andreas Kling
133706d697 Add API's and plumbing for WindowServer clients to make menus. 2019-02-12 00:52:19 +01:00
Andreas Kling
757429fb55 LibGUI: More work on client-side menus. 2019-02-11 15:37:12 +01:00
Andreas Kling
3351f1ccc1 Port all apps to GApplication. 2019-02-11 14:56:23 +01:00
Andreas Kling
9483b39227 LibGUI: Add GMenu* and GApplication classes. 2019-02-11 14:43:43 +01:00
Andreas Kling
5f288014d4 WindowServer: More work on menus. 2019-02-11 10:08:54 +01:00
Andreas Kling
7abef6ba9e LibGUI: Put some logspam behind debugging macros. 2019-02-11 08:27:13 +01:00
Andreas Kling
1511afc4e2 LibGUI: Add GWindow::move_to(). 2019-02-11 06:09:54 +01:00
Andreas Kling
08322ab8e1 LibGUI: Coalesce update rects at the GWindow level. 2019-02-10 14:46:43 +01:00
Andreas Kling
53d34a0885 Port Terminal to LibGUI.
To facilitate listening for action on arbitrary file descriptors,
I've added a GNotifier class. It's quite simple but very useful:

GNotifier notifier(fd, GNotifier::Read);
notifier.on_ready_to_read = [this] (GNotifier& fd) {
    // read from fd or whatever else you like :^)
};

The callback will get invoked by GEventLoop when select() says we
have something to read on the fd.
2019-02-10 14:28:39 +01:00
Andreas Kling
d333013a54 LibGUI: Support horizontal GScrollBars as well. 2019-02-10 12:27:21 +01:00
Andreas Kling
8313ce57dc LibGUI: Improve GScrollBar button look a bit.
The arrows look better when they're sharp. :^)
2019-02-10 11:57:19 +01:00
Andreas Kling
2def3d8d3f LibGUI: Start adding an automatic widget layout system.
My needs are really quite simple, so I'm just going to add what I need
as I go along. The first thing I needed was a simple box layout with
widgets being able to say whether they prefer fixed or fill for both
their vertical and horizontal sizes.

I also made a simple GStatusBar so FileManager can show how many bytes
worth of files are in the current directory.
2019-02-10 11:07:13 +01:00
Andreas Kling
29f2a22d34 LibGUI: Minor cleanup in GScrollBar. 2019-02-10 08:23:03 +01:00
Andreas Kling
f7831f8c76 LibGUI: Draw GScrollBar buttons with a disabled look when appropriate. 2019-02-10 07:37:02 +01:00
Andreas Kling
e354c08c98 LibGUI: Share code for widget rendering styles in a GStyle class.
Since GScrollBar wants its internal buttons to look like GButtons,
let's share the painting code between them.
2019-02-10 07:11:01 +01:00
Andreas Kling
9ea2131adf LibGUI: Support dragging the GScrollBar scrubber.
This was pleasantly easy to implement with the global mouse tracking. :^)
2019-02-10 06:51:01 +01:00
Andreas Kling
464873f8b5 LibGUI: Draw some cute arrows on the GScrollBar buttons. 2019-02-10 06:10:27 +01:00
Andreas Kling
5bd363c4bb LibGUI: Widget updates should invalidate their window-relative rect. 2019-02-09 14:30:05 +01:00
Andreas Kling
6a3ff7efc5 GScrollBar: Start looking a bit more like a proper scrollbar.
And hook up FileManager's DirectoryView with its scrollbar so it actually
causes the directory view to shift up and down. Very cool. :^)
2019-02-09 11:29:59 +01:00
Andreas Kling
1f355f2a79 LibGUI: Start working on a GScrollBar.
This widget is far from finished, but it's off to a good start.
Also added a GResizeEvent and GWidget::resize_event() so that widgets
can react to being resized.
2019-02-09 11:19:38 +01:00
Andreas Kling
5158bee08c Don't use -mregparm=3 in userspace.
It's pretty comfy having arguments in registers in the kernel for now though.
2019-02-08 01:24:52 +01:00
Andreas Kling
6d7f000ffc Launcher: Factor the app buttons into a LaunchButton class.
Added some LibGUI helpers while I'm at it.
2019-02-08 00:15:04 +01:00
Andreas Kling
bf766fc12c LibGUI: Implement GWindow::rect(). 2019-02-08 00:13:35 +01:00
Andreas Kling
887b4a7a1a Start working on a simple Launcher app.
Let GButton have an optional icon (GraphicsBitmap) that gets rendered in the
middle of the button if present.

Also add GraphicsBitmap::load_from_file() which allows mmap'ed RGBA32 files.
I wrote a little program to take "raw" files from GIMP and swizzle them into
the correct byte order.
2019-02-07 23:17:06 +01:00
Andreas Kling
27263b6172 Clean up LDFLAGS a bit.
While working on the ELF loader I was trying to keep binaries as simple as
possible so I could understand them easily. Now that the ELF loader is mature
and working fine, we can move closer towards ld defaults.
2019-02-06 14:48:09 +01:00
Andreas Kling
353b191a49 Clean up some uninteresting log spam. 2019-02-06 11:32:23 +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
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
a258d6507a mmap all the font files!
Font now uses the same in-memory format as the font files we have on disk.
This allows us to simply mmap() the font files and not use any additional
memory for them. Very cool! :^)

Hacking on this exposed a bug in file-backed VMObjects where the first client
to instantiate a VMObject for a specific inode also got to decide its size.
Since file-backed VMObjects always have the same size as the underlying file,
this made no sense, so I removed the ability to even set a size in that case.
2019-02-05 06:43:33 +01:00
Andreas Kling
7fe600f250 LibGUI: Use LightGray as the base UI color.
This feels nicely reminiscent of the gap in time between Win3.11 and Win95,
one of my favorite eras in UI look-and-feel.
2019-02-04 11:53:26 +01:00
Andreas Kling
6f787f6877 LibGUI: Use LizaBold as the default button font. 2019-02-04 11:41:01 +01:00
Andreas Kling
bc6ff35428 LibGUI: GTextBox should only run a caret blink timer when focused. 2019-02-04 10:34:56 +01:00
Andreas Kling
663aad4036 FontEditor: Add text box for editing the font name. 2019-02-03 03:06:58 +01:00
Andreas Kling
6fc3c38324 Start working on a simple graphical font editor.
Editing fonts by editing text files is really slow and boring.
A simple font editor seems like a good way to take LibGUI for a spin.
2019-02-02 08:07:06 +01:00
Andreas Kling
5e0b7f1a56 Add basic automatic dependency management to Makefiles. 2019-02-02 04:41:59 +01:00
Andreas Kling
95c3442d59 Implement event loop timers.
GObjects can now register a timer with the GEventLoop. This will eventually
cause GTimerEvents to be dispatched to the GObject.

This needed a few supporting changes in the kernel:

- The PIT now ticks 1000 times/sec.
- select() now supports an arbitrary timeout.
- gettimeofday() now returns something in the tv_usec field.

With these changes, the clock window in guitest2 finally ticks on its own.
2019-02-01 03:50:06 +01:00
Andreas Kling
ffab6897aa Big, possibly complete sweep of naming changes. 2019-01-31 17:31:23 +01:00
Andreas Kling
e04ba0a83c Add a simple clock window to guitest2.
This is driven by mousedown events right now, since there are no timers.
2019-01-31 16:37:43 +01:00
Andreas Kling
37ab7b7a8c LibGUI: Implement destroying individual windows without exiting the process. 2019-01-30 20:03:52 +01:00
Andreas Kling
dbeac6e093 LibGUI: Reduce overdraw in GListBox. 2019-01-28 20:38:13 +01:00
Andreas Kling
83228d03d8 LibGUI: GButton should only react to the left mouse button (for pushing.) 2019-01-27 20:26:45 +01:00
Andreas Kling
35c06f1520 LibGUI: More work on GCheckBox.
- Make it track the mouse cursor just like GButton does so that changes only
  get committed if the mouseup event happens while inside the widget rect.

- Draw a focus rect around the box when appropriate.

- When focused, support toggling the checked state with the space bar.
2019-01-27 20:22:06 +01:00
Andreas Kling
90e898b771 GTextBox: Avoid one instance of overdraw + naming cleanup. 2019-01-27 15:12:33 +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
c7b005c47b Font: Eagerly load all 256 glyphs. It's not that many. 2019-01-27 05:19:00 +01:00
Andreas Kling
2e370fa4d5 LibGUI: Don't consider a GWidget focused if the window is inactive. 2019-01-26 21:58:43 +01:00
Andreas Kling
25d045dee5 LibGUI: Reduce GEventLoop debug spam. 2019-01-26 21:44:13 +01:00
Andreas Kling
de2423de5f LibGUI: Flesh out focus implementation and more GTextBox work. 2019-01-26 11:24:16 +01:00
Andreas Kling
d72575d196 LibGUI: Start bringing up GTextBox in the standalone world. 2019-01-26 06:39:13 +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
dfdca9d2a7 Kernel: Implement lazy FPU state restore. 2019-01-25 07:52:44 +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
05f18febb6 Ext2FS: Delete inodes when their link count goes to zero. 2019-01-22 16:34:24 +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
6d9959e367 LibGUI: Open the GUI event stream with O_CLOEXEC. 2019-01-21 01:33:16 +01:00
Andreas Kling
d66b0f7dd8 LibGUI: Mass coding style fixes. 2019-01-21 00:54:35 +01:00
Andreas Kling
6c4f1bad09 guitest2: Add a simple launcher so I can easily spawn more Terminals.
Also update GButton coding style.
2019-01-21 00:31:48 +01:00
Andreas Kling
d4cce87dbc LibGUI: Minor fixes. 2019-01-20 08:16:02 +01:00
Andreas Kling
a9e60fc800 LibGUI: Only redraw the dirty rect in GWidget.
There is some trouble here with the asynchronous nature of WindowServer
and the single per-window backing store we're drawing into. If we start
repainting a widget with a pending invalidation, that invalidation might
get flushed by the WindowServer mid-paint.
2019-01-20 07:59:19 +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
dbe83f3a83 Make it possible for userspace to alter window title/geometry.
I'm not in love with this syscall API but it allows me to make progress.
2019-01-20 06:04:13 +01:00
Andreas Kling
8eae89a405 Start bringing up LibGUI properly (formerly Widgets.) 2019-01-20 05:48:43 +01:00
Andreas Kling
b91479d9b9 Rename all the LibGUI classes to GClassName. 2019-01-20 04:49:48 +01:00
Andreas Kling
a026da47e7 Move Widget & friends into LibGUI. 2019-01-19 23:49:56 +01:00