Commit Graph

16 Commits

Author SHA1 Message Date
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
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
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
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
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
5bd363c4bb LibGUI: Widget updates should invalidate their window-relative rect. 2019-02-09 14:30:05 +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
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
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
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
de2423de5f LibGUI: Flesh out focus implementation and more GTextBox work. 2019-01-26 11:24:16 +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
d66b0f7dd8 LibGUI: Mass coding style fixes. 2019-01-21 00:54:35 +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
b91479d9b9 Rename all the LibGUI classes to GClassName. 2019-01-20 04:49:48 +01:00