1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:45:07 +00:00
Commit graph

519 commits

Author SHA1 Message Date
Andreas Kling
49d0cdabac GWidget: Ignore updates if self has !updates_enabled().
We were only checking when propagating updates to parents, duh.
2019-05-02 04:19:59 +02:00
Andreas Kling
6d5507313e GWidget: Add set_updates_enabled() for temporarily suppressing updates. 2019-05-02 03:47:01 +02:00
Andreas Kling
b34f376329 GButton: Update hovered state on mouseover as well.
We can't rely exclusively on enter and leave events to update the hovered
state, since leave will not be delivered while the widget is auto-tracking
the mouse (between mousedown and mouseup.)
2019-05-01 18:53:05 +02:00
Andreas Kling
288e97a206 WindowServer+LibGUI: Wait for the extra_data to arrive.
Since the sockets we use are non-blocking, just slap a select before the
second call to read(). This fixes some flakiness seen under load.

This should eventually work a bit differently, we could use recv() once
it has MSG_WAITALL, and we should not let WindowServer handle all the
client connections on the main thread. But for now, this works.

Fixes #24.
2019-05-01 18:28:33 +02:00
Andreas Kling
cff3685a4c GButton: Handle mousemove correctly while multiple buttons are pressed.
We should still update the pressed state depending on the event position,
even if GMouseButton::Left is not the only button pressed.
2019-05-01 15:59:23 +02:00
Andreas Kling
86aad50818 VisualBuilder: Add GSlider to the widgets toolbox. 2019-04-30 16:18:05 +02:00
Andreas Kling
87c256a7d5 GSlider: Highlight the knob when hovering it. :^) 2019-04-30 00:47:46 +02:00
Andreas Kling
55d7d4e3d8 GSlider: Improve appearance by thinning the track a bit. 2019-04-29 23:42:55 +02:00
Andreas Kling
9c6be9b21e LibGUI: Add a GSlider widget. 2019-04-29 19:20:34 +02:00
Andreas Kling
5dee5c325e GEventLoop: Don't call process_unprocessed_messages() from itself.
This could be tail-call-optimized but it's not, so we end up overflowing the
stack space if we recurse too many times. This was causing crashes when
resizing Minesweeper.
2019-04-28 22:03:18 +02:00
Andreas Kling
8bce4b3f42 GTableView: Ignore double-clicks that hit the header section. 2019-04-26 23:13:05 +02:00
Andreas Kling
8f81a3f9dd LibGUI+WindowServer: Make it possible to have checkable GActions.
They show up as checkable GButtons in GToolBar, and with (or without) check
marks in menus.

There are a bunch of places to make use of this. This patch only takes
advantage of it in the FileManager for the view type actions.
2019-04-26 21:09:56 +02:00
Andreas Kling
9ff36afeaa GWindow: Fix crash when calling set_rect() repeatedly.
We throw away the backing store if the window rect changes size. Since the
resizing happens asynchronously at the mercy of the WindowServer, we might
end up in set_rect() again before gaining a new backing store. So there are
no guarantees that the back/front bitmaps exist here.
2019-04-26 20:08:30 +02:00
Andreas Kling
d93c278d29 GWindow: Add resize(width, height) and resize(size). 2019-04-26 17:33:20 +02:00
Andreas Kling
104af4a5dc LibGUI: Allow subclassing of GLabel. 2019-04-26 14:16:17 +02:00
Andreas Kling
ba2e97aa52 LibGUI: Track double-clicking per individual mouse button.
Clicking two separate buttons in quick succession shouldn't be interpreted
as a double click.
2019-04-26 14:15:11 +02:00
Andreas Kling
71770e000b GTextEditor: Add very basic automatic indentation.
This is off by default, but enabled by TextEditor. It simply inserts the
same number of leading spaces as the previous line when hitting Enter. :^)
2019-04-25 22:56:09 +02:00
Andreas Kling
8a3d00ac02 GTableView: Double-click should only activate/edit valid indices. 2019-04-25 22:55:44 +02:00
Andreas Kling
e2e2c78332 GTextEditor: Double-clicking on a word should select that word. 2019-04-25 22:29:25 +02:00
Andreas Kling
737315c228 GTextEditor: Improve cursor positioning accuracy when using a mouse.
Put the cursor on the left or right side of a glyph when clicking it based
on distance to middle of glyphs. This is such an obvious change that makes
a small but noticeable difference in feel. :^)
2019-04-25 02:15:45 +02:00
Andreas Kling
7a5525edf4 GTextEditor: Go a little past the cursor for Home/End scroll-into-view.
When jumping to the start of a line, or to the end of a line, scrolling two
pixels past the end yields a pleasant effect.
2019-04-25 01:33:59 +02:00
Andreas Kling
2c51bc92af GTextEditor: Always call did_change() before set_cursor().
This is not very obvious and I need to come up with a better design, but for
now just make sure to call did_change() before calling set_cursor().
This is needed because set_cursor() will try to scroll the cursor into view,
and for right-aligned text, did_change() may change the content rect which
needs to be reflected by the time we call scroll_cursor_into_view().
2019-04-25 01:28:17 +02:00
Andreas Kling
4e715dbc71 GTextEditor: Account for the GFrame border in the painting code.
We were forgetting to translate the painter by the frame_thickness().
With this fixed, we can also do proper vertical centering of lines for
single-line editors, and things suddenly look nicer than ever! :^)
2019-04-25 01:11:35 +02:00
Andreas Kling
3543236e8f GScrollableWidget: The visible_content_rect() should be max content_size().
When computing the visible content rect, constrain the result to the content
size. The content shouldn't feel responsible for painting anything outside.
2019-04-25 00:05:48 +02:00
Andreas Kling
0c88ce9ee3 GTextEditor: Expand the content "to-fill" for right aligned text.
When using a right-side text alignment, hook the resize event to make sure
that the content width is at least frame_inner_rect().width() wide.

This allows us to use content_width() as the anchor point for right aligned
text, rather than using the frame inner rect, which was clearly wrong in
the overflow case.
2019-04-24 23:42:49 +02:00
Andreas Kling
f1eba2295d GTextEditor: Make the line_widget_rect() span the widget horizontally. 2019-04-24 23:15:15 +02:00
Andreas Kling
4bea3a4aa6 GTextEditor: Turn off the ruler by default.
You're usually not gonna want the ruler. TextEditor can enable it manually.
2019-04-24 23:06:44 +02:00
Andreas Kling
5c240af3f7 GTextEditor: Fix line_content_rect() behavior with custom alignments. 2019-04-24 22:46:27 +02:00
Andreas Kling
62f0aae4ca GTextEditor: Add support for different text alignments.
Currently only CenterLeft and CenterRight are supported, but it would be
very straightforward to add other alignments as well.
2019-04-24 22:24:16 +02:00
Andreas Kling
956bd23aae WindowServer+TaskBar: Add a taskbar window button popup menu.
This patch only hooks up the minimize and unminimize actions.
2019-04-23 23:14:14 +02:00
Andreas Kling
02e5d55832 LibGUI: Don't bother setting a title on tooltip windows. 2019-04-23 20:45:42 +02:00
Andreas Kling
8495abd140 GWindow: Don't send InvalidateRect message with 0 rects to WindowServer.
This could happen if GWindow::hide() was called while a window had pending
repaint rects. The deferred_invoke() lambda in GWindow::update() would
eventually run, but by then, hide() had cleared all pending rects.
2019-04-23 20:43:51 +02:00
Andreas Kling
58240fdb33 Do a pass of compiler warning fixes.
This is really making me question not using 64-bit integers more.
2019-04-23 13:00:53 +02:00
Andreas Kling
9f122bff5a WindowServer+LibGUI: Allow arbitrary number of rects in messages.
To get truly atomic updates, add a mechanism for passing arbitrary amounts
of extra data along with WindowServer messages. This allows us to pass all
the rects in a single message.
2019-04-22 01:15:47 +02:00
Andreas Kling
57da00b731 Include Makefile.common in all other Makefiles. 2019-04-21 04:09:39 +02:00
Andreas Kling
5c5ce4f885 LibGUI: Allow GActions to be scoped either globally or widget-locally.
This makes it possible for e.g GTextEditor to create a bunch of actions
with popular shortcuts like Ctrl+C, etc, without polluting the global
shortcut namespace. Widget-local actions will only activate while their
corresponding widget has focus. :^)
2019-04-20 21:56:56 +02:00
Andreas Kling
0dcb7a234e LibGUI+Minesweeper: Add GWindow::set_resizable(). 2019-04-20 21:24:02 +02:00
Andreas Kling
de913529d7 GTableView: Tweak appearance of key column with alternating rows. 2019-04-20 19:41:37 +02:00
Andreas Kling
7234900f61 WindowServer+LibGUI: Coalesce multiple client paints into GMultiPaintEvents.
This allows GWindow to paint up to 32 separate rects before telling the
WindowServer to flip the buffers. Quite a bit smoother. :^)
2019-04-20 17:38:51 +02:00
Andreas Kling
7efd61fcf5 WindowSerer+LibGUI: Send multiple rects in invalidation/flush messages.
This patch moves to sending up to 32 rects at a time when coordinating the
painting between WindowServer and its clients. Rects are also merged into
a minimal DisjointRectSet on the server side before painting.

Interactive resize looks a lot better after this change, since we can
usually do all the repainting needed in one go.
2019-04-20 17:23:35 +02:00
Andreas Kling
45a30b4dfa LibGUI: Bundle up update() invalidations and send them on next event loop. 2019-04-20 15:19:02 +02:00
Andreas Kling
49e7ffc06a WindowServer: Introduce a WM event mask so Taskbar can ignore window rects.
Taskbar was waking up to do nothing every time a window rect changed.
2019-04-20 14:40:59 +02:00
Andreas Kling
5eedb22834 Sprinkle use of AK::Vector in various places.
Some of these are less helpful than others. Avoiding a bunch of mallocs
in the event loop wakeup code is definitely nice.
2019-04-20 14:02:19 +02:00
Andreas Kling
301a269ca0 Get rid of SERENITY macro since the compiler already defines __serenity__
This makes it a bit easier to use AK templates out-of-tree.
2019-04-20 12:58:49 +02:00
Andreas Kling
77418c1942 LibGUI: Remove GListBox since it was not kept up-to-date.
I'll come back and add a GListView eventually, but this is not good enough.
2019-04-19 21:13:40 +02:00
Andreas Kling
b3f657a1c6 VisualBuilder: Expose GGroupBox name property. 2019-04-19 01:40:25 +02:00
Andreas Kling
3a33b8ea08 VisualBuilder: Hook up everything needed for widget property editing.
It's now possible to edit widget properties inline in the properties window.
We're currently relying on the basic GVariant conversion functions to do
all the "parsing" but that's not gonna be good enough.
2019-04-19 01:05:59 +02:00
Andreas Kling
18785ba5c3 LibGUI: Move editing logic from GTableView up to GAbstractView.
GAbstractView should be able to manage the high-level editing logic, as long
as subclasses implement content_rect(GModelIndex) so we know where to put
the editing widgets. :^)
2019-04-19 00:07:33 +02:00
Andreas Kling
9cab7a0707 LibGUI: Move the editing widget along with the content when scrolling. 2019-04-18 23:57:07 +02:00
Andreas Kling
568f3125f3 GWidget: Always update self after a child is removed.
We could probably tighten the amount of invalidation we do here, but this is
definitely more correct than not invalidating at all.
2019-04-18 23:25:30 +02:00