Commit Graph

63 Commits

Author SHA1 Message Date
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