1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 17:05:06 +00:00
Commit graph

1113 commits

Author SHA1 Message Date
Andreas Kling
479f16bb6c LibGUI: Add KeyEvent::to_string()
This makes it way easier to debug key events.
2020-05-12 17:03:17 +02:00
Andreas Kling
90eec0a3d7 LibGUI: Use KeyCode stringification helper in Shortcut::to_string() 2020-05-12 17:02:33 +02:00
Andreas Kling
39d55d1d76 LibGUI: Add a way to highlight the focused widget for debugging
You can now pass --gui-focus-debug to any GUI::Application and it will
draw a cyan rectangle around the currently focused widget.
2020-05-12 15:48:31 +02:00
Andreas Kling
e064999e0d LibGUI: Allow scrolling through a ComboBox with the mouse wheel 2020-05-12 15:11:06 +02:00
Andreas Kling
575b674081 LibGUI: Add missing window() null check when widget's child is removed
Before notifying our window that a child was removed, we should first
check that we actually have a window! :^)
2020-05-12 14:06:25 +02:00
Andreas Kling
9d6c85e6a6 LibGUI: Remove ancient code for debugging widget underdraw 2020-05-12 13:43:37 +02:00
Andreas Kling
9e74793ce2 LibGUI+LibGfx: Paint scollbar tracks with a dithered pattern
Instead of a solid color, we now paint the track/gutter of scrollbars
using a 2-color dither pattern for a pleasant millennium feel. :^)
2020-05-10 01:02:06 +02:00
FalseHonesty
bb6258229a LibGUI: Add hook when a tab is middle clicked 2020-05-09 23:54:20 +02:00
Andreas Kling
cf3b58fbe8 Services: Renamed from Servers
It didn't feel right to have a "DHCPClient" in a "Servers" directory.
Rename this to Services to better reflect the type of programs we'll
be putting in there.
2020-05-08 21:57:44 +02:00
Andreas Kling
03c91fce74 LibGUI: Highlight interactive area of hovered CheckBox and RadioButton
This is consistent what we do for regular Buttons and gives a pleasant
visual cue when you're over a clickable area.
2020-05-08 21:12:16 +02:00
Andreas Kling
0f0d73d1b5 LibGUI: Make the "enabled" widget state propagate to child widgets
This simplifies building composite widgets by not having to worry about
updating widget subtrees.
2020-05-08 13:49:58 +02:00
Hüseyin ASLITÜRK
f0f98de5d8 LibGUI: Fix for disable state of SpinBox 2020-05-08 09:49:41 +02:00
DexesTTP
b478c5f86c LibGUI: Properly draw the background of the selected TreeView line
In the TreeView, the background of the selected line (or any background,
really) was only drawn until the frame's width. When the text was larger
than the frame's width, this caused the end of the text to be displayed
without background, making it unreadable if it was white (which is the
default text color for selected lines).

To compute the background width, we have a choice between :
- The inner frame width (the current behaviour which causes the issue)
- The total width of all columns (which causes the background to end
  early if the columns don't cover the full width)

The new algorithm uses the biggest of the above values, which gives us
exactly what we want in all cases :^)

Fixes #2134
2020-05-07 22:13:25 +02:00
Linus Groh
7571e9e460 LibGUI: Rename SyntaxLanguage::{Javascript -> JavaScript} 2020-05-07 22:04:56 +02:00
Linus Groh
9dbab2d05e Misc: Replace "String(string_view)" with "string_view.to_string()"
StringView::to_string() was added in 917ccb1 but not actually used
anywhere yet.
2020-05-06 19:28:59 +02:00
Linus Groh
a2e1f1a872 LibJS: Implement exponentiation assignment operator (**=) 2020-05-05 11:12:27 +02:00
Linus Groh
3e754a15d4 LibJS: Implement bitwise assignment operators (&=, |=, ^=) 2020-05-05 11:12:27 +02:00
Andreas Kling
8fae4ee931 LibGUI: Add ScrollableWidget::viewport_rect_in_content_coordinates() 2020-05-04 22:33:20 +02:00
mattco98
adb4accab3 LibJS: Add template literals
Adds fully functioning template literals. Because template literals
contain expressions, most of the work has to be done in the Lexer rather
than the Parser. And because of the complexity of template literals
(expressions, nesting, escapes, etc), the Lexer needs to have some
template-related state.

When entering a new template literal, a TemplateLiteralStart token is
emitted. When inside a literal, all text will be parsed up until a '${'
or '`' (or EOF, but that's a syntax error) is seen, and then a
TemplateLiteralExprStart token is emitted. At this point, the Lexer
proceeds as normal, however it keeps track of the number of opening
and closing curly braces it has seen in order to determine the close
of the expression. Once it finds a matching curly brace for the '${',
a TemplateLiteralExprEnd token is emitted and the state is updated
accordingly.

When the Lexer is inside of a template literal, but not an expression,
and sees a '`', this must be the closing grave: a TemplateLiteralEnd
token is emitted.

The state required to correctly parse template strings consists of a
vector (for nesting) of two pieces of information: whether or not we
are in a template expression (as opposed to a template string); and
the count of the number of unmatched open curly braces we have seen
(only applicable if the Lexer is currently in a template expression).

TODO: Add support for template literal newlines in the JS REPL (this will
cause a syntax error currently):

    > `foo
    > bar`
    'foo
    bar'
2020-05-04 16:46:31 +02:00
Andreas Kling
67b92a7d5f WindowServer+LibGUI: Support the 4th and 5th mouse buttons
We'll call the "Back" and "Forward" since that's what they are normally
mapped to in some other systems.
2020-05-02 22:07:43 +02:00
Emilio Cobos Álvarez
e347d6bdb8 LibGUI: Properly remove auto-destroyed child windows from reified_windows.
I just spotted this while I saw you writing this code :-)
2020-05-02 20:27:07 +02:00
Ben Wiederhake
cfbc49b5fc LibGUI: FilePicker: Set initial sort to name instead of undefined
Well, technically the initial sort order is 'ascending inode'.
However, that is unpredictable for the user.
In the rare case it is desired, it can be re-enabled by revealing the
inode column, and then sorting by it, in the TableView.
2020-05-02 14:12:36 +02:00
Ben Wiederhake
b6bea3d25b LibGUI: Fix off-by-one in ScrollableWidget
This was most notable in the widgets TextBox and TextEditor (and
therefore also ComboBox and ColorInput), because there the cursor
regularly landed just one pixel outside the visible region when
going to the right.
2020-05-02 14:12:36 +02:00
Ben Wiederhake
1b140d1b5b LibGUI: FilePicker: Make icon view button initially checked 2020-05-02 14:12:36 +02:00
Ben Wiederhake
ef433cb367 LibGUI: The UI calls it 'Icon view', fix the name in the code 2020-05-02 14:12:36 +02:00
Ben Wiederhake
8e01356b2f LibGUI: FilePicker: Populate location textbox 2020-05-02 14:12:36 +02:00
Ben Wiederhake
6a453370ad LibGUI: FilePicker: Fix position of location textbox 2020-05-02 14:12:36 +02:00
Ben Wiederhake
ebabce30bd LibGUI: Display hidden columns as hidden
Until now, hidden columns were displayed as visible in the context menu.
An easy way to reproduce this is:
- Open the TextEditor
- Ctrl-O to open the file selector
- Switch to table view
- Right-click the header

Expected behavior:
Hidden columns like 'Owner' and 'Group' should not have a checkmark,
because they are hidden.

Actual behavior: They did have a checkmark. Clicking on it to 'hide'
the already hidden column removed the checkmark, but was a no-op to the
table view.

This commit fixes this behavior, by correctly initializing the context menu,
and properly updating the context menu if external code calls
'set_column_hidden' later.
2020-05-02 14:12:36 +02:00
Ben Wiederhake
55ff392835 LibGUI: Remove unneeded access rights 2020-05-02 14:12:36 +02:00
Andreas Kling
3331098aee WindowServer+LibGUI+Taskbar: Don't include frameless windows in lists
Frameless windows don't need to show up in the taskbar or the switcher.
2020-05-02 12:24:23 +02:00
AnotherTest
7670e5ccf0 LibCore+LibHTTP: Move out the HTTP handler and add HTTPS 2020-05-02 12:24:10 +02:00
Andreas Kling
745b0b27fd WindowServer+LibGUI: Automatically close child windows with parent
If a window has child windows when it's destroyed, WindowServer will
now automatically tear down all of its children as well.

This is communicated to the client program through a vector of window
ID's included with the response to WindowServer::DestroyWindow.

This does feel a little bit awkward, but managing it on the client side
also seems a bit awkward.
2020-05-02 01:29:55 +02:00
Andreas Kling
828aee9932 LibGUI: Make ComboBox list pop-up windows frameless
This is much better than the hack we had of making them Tooltip windows
since frameless windows end up at the right layer in the window stack
automatically, and always get yanked above the parent window simply by
being child windows.
2020-05-02 01:29:55 +02:00
Andreas Kling
d847304cb9 WindowServer+LibGUI: Add "frameless" window flag
This allows you to create windows with no title bar or window frame.
2020-05-02 01:29:55 +02:00
Andreas Kling
bb7eb3e104 WindowServer+LibGUI: Remove unused Window::show_titlebar() flag
Nobody was using this flag, so let's stop maintaining it. It's easy to
add it back if we ever want the behavior.
2020-05-02 01:29:55 +02:00
Andreas Kling
6228f72b87 LibGUI+WindowServer: Inform WindowServer about parent/child windows
If a window has another window in its Core::Object ancestor chain,
we now communicate that relationship to WindowServer so that it can
act with awareness of parent/child windows.
2020-05-02 01:29:55 +02:00
Linus Groh
43c1fa9965 LibJS: Implement (no-op) debugger statement 2020-05-01 22:07:13 +02:00
Hüseyin ASLITÜRK
5c022ac939 LibGUI: INI file syntax highlighter 2020-05-01 16:58:18 +02:00
Hüseyin ASLITÜRK
5267ccbc22 LibGUI: Icon for INI file type 2020-05-01 16:58:18 +02:00
Andreas Kling
770dedcc23 LibGUI: Remove some ancient unused debug logging 2020-04-30 22:42:02 +02:00
Andreas Kling
8fc6ff94fe LibGUI: Scale TabWidget tabs according to available space
In TabWidgets with the "uniform tabs" mode on, we will now scale tabs
between a minimum and maximum size, distributing the available space.

Partially addresses #1971.
2020-04-30 09:28:36 +02:00
Andreas Kling
f2cdef5c47 LibGUI: Cycle through TabWidget tabs with Ctrl+Tab / Ctrl+Shift+Tab
Fixes #2022.
2020-04-30 09:04:39 +02:00
Andreas Kling
9f32d71782 LibGUI: Use "OK, Cancel" button order in InputBox 2020-04-29 19:31:15 +02:00
Andreas Kling
77916f030f LibGUI: Use "OK, Cancel" button order in ColorPicker 2020-04-29 19:29:09 +02:00
Andreas Kling
51ab0e967e LibGUI: Use a sunken GUI::Frame for the ColorPicker color spectrum
This looks a lot nicer than just a plain widget. :^)
2020-04-29 19:28:19 +02:00
Andreas Kling
d7d5788469 LibGUI: ColorPicker should pick custom color from bitmap, not window
It's not always safe to access pixel data of a window's backing store
since the kernel may decide to purge it at his leisure. Fix this by
instead picking colors from the color spectrum bitmap directly instead.

Also fix up mouse event logic while we're here so it only cares about
the left mouse button

Fixes #1657.
2020-04-29 19:17:40 +02:00
Andreas Kling
6a01827046 LibGUI: Exit ColorPicker (successfully) when double-clicking a color
It feels natural that if I double click a color button, the dialog
closes successfully and "returns" that color.
2020-04-29 19:17:40 +02:00
Andreas Kling
57fe4d19ac LibGUI: Remove unnecessary is_enabled() checks in mouse event handlers
We never deliver mouse events to disabled widgets, so there's no need
to check is_enabled() in these event handlers.
2020-04-29 19:17:40 +02:00
Andreas Kling
cdbc252190 LibGUI: Require a full click on ColorInput's color rect to open picker
Let's not open the ColorPicker on mousedown, that was too jarring.
2020-04-29 19:17:40 +02:00
Andreas Kling
f8069418e1 LibGUI: Transfer "color has alpha channel" state 2020-04-29 16:22:09 +02:00