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

1113 commits

Author SHA1 Message Date
Andreas Kling
75b8f4e4e6 LibGUI: Make focus events more aware of why focus is changing
This patch adds GUI::FocusEvent which has a GUI::FocusSource.
The focus source is one of three things:

- Programmatic
- Mouse
- Keyboard

This allows receivers of focus events to implement different behaviors
depending on how they receive/lose focus.
2020-08-15 00:05:45 +02:00
Andreas Kling
110b3d89d3 LibGUI: Export GUI_FOCUS_DEBUG to visualize the focused widget
Using a command-line argument for this clashed with ArgsParser so let's
use an environment variable instead. I feel like Sergey told me to do
this at some point anyway. :^)
2020-08-15 00:05:45 +02:00
Andreas Kling
b97e42dcaa LibGUI: Make ModelSelection non-copyable and non-movable
These are meant to be attached to an AbstractView at all times.
2020-08-14 12:15:11 +02:00
Linus Groh
e77991e63a LibGUI: Fix Widget::screen_relative_rect() for WindowType::MenuApplet
This was using window()->position(), which is unset for windows with
WindowType::MenuApplet. Now it checks the window type and then uses
rect_in_menubar() for MenuApplet windows and rect() for everything else.

This makes tooltips show up for MenuApplet windows, previously they were
positioned off-screen :^)
2020-08-14 10:28:03 +02:00
Linus Groh
e58d3b8481 LibGUI: Add Window::window_type()
We already have Window::set_window_type(), so a getter for m_window_type
makes sense as well.
2020-08-14 10:28:03 +02:00
Andreas Kling
21bb269919 LibGUI: Add ModelIndex::model()
Let's expose this so we can use it in some assertions later.
2020-08-13 21:09:39 +02:00
Andreas Kling
5099e76ce6 LibGUI: Remove unused bool SortingProxyModel::m_sorting 2020-08-13 20:18:11 +02:00
Andreas Kling
686ee2bf04 LibGUI: Rename ModelClient::on_model_update() => model_did_update()
This follows the typical client callback naming scheme used elsewhere
and doesn't collide with the "on_foo" Function hook convention.
2020-08-13 20:18:11 +02:00
Andreas Kling
4088beb8eb LibGUI: Remove Model::sibling() since it's the same as index()
... I'm not sure what the idea was here, but since these functions do
the same thing, let's only have index().
2020-08-13 20:18:11 +02:00
Andreas Kling
fe19cf0ff2 LibGUI: Move Model::index() out of line 2020-08-13 20:18:11 +02:00
Andreas Kling
82e949aa7c LibGUI: Rename SortingProxyModel "target" to "source" instead 2020-08-13 20:18:11 +02:00
Linus Groh
675d8eec60 LibGUI: Fix ColorPicker custom color offset
Previously the ColorPicker would get the custom color directly from the
window, this was changed in d7d5788469 to
get the color from the underlying bitmap instead - without taking the
bitmap's scaling into effect though, so resulting colors were off by
quite a bit.

Fixes #3113.
2020-08-13 16:58:31 +02:00
Linus Groh
728d4649e4 LibGUI: Fix ComboBox desktop intersection rect
Subtracting 128 from the desktop rect's height was far to much and
and leading to weird rendering issues - now it's calculated exactly from
taskbar and menubar heights as well as a little additional offset to
make it fit perfectly.

Fixes #3115.
2020-08-13 16:06:02 +02:00
Linus Groh
852770687a LibGUI: Add Desktop::{taskbar,menubar}_height() 2020-08-13 16:06:02 +02:00
Andreas Kling
3dd15da7b1 LibGUI: Move file icon lookup into a separate FileIconProvider
Let's get it out of FileSystemModel so you can look up a nice icon for
a path without needing a model.
2020-08-12 20:41:13 +02:00
Ben Wiederhake
1396ce8a9b LibGUI: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Nico Weber
cdf1282419 ScrollBar: Let clicking the gutter scroll by one page
Shift-clicking has the old behavior of jumping to the click position.

This matches scrollbar behavior in macOS and Windows, and in many Linux apps.
2020-08-12 11:02:30 +02:00
Nico Weber
326261094d ScrollBar: Simplify ScrollBar::scroll_to_position() 2020-08-12 11:02:30 +02:00
Nico Weber
8eee5312c5 GUI: Rename ScrollBar::scrubber_size() to ScrollBar::visibile_scrubber_size() 2020-08-12 11:02:30 +02:00
Nico Weber
cb2d56b909 GUI: Give MouseEvent shift() / ctrl() / alt() / logo() functions 2020-08-12 11:02:30 +02:00
Nico Weber
eab7712ab0 GUI: Extract a ScrollBar::scroll_to_position method 2020-08-12 11:02:30 +02:00
Nico Weber
ce95628b7f Unicode: Try s/codepoint/code_point/g again
This time, without trailing 's'. Ran:

    git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05 22:33:42 +02:00
Nico Weber
19ac1f6368 Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
2020-08-05 22:33:42 +02:00
Linus Groh
9ef834384d LibGUI: Use set_cursor() in TextEditor::set_document()
Instead of setting m_cursor directly to reset the cursor position,
TextEditor::set_document() now uses set_cursor() which will call cursor
change callback functions, if any.

This fixes a bug in HackStudio where the cursor information text would
not update immediately after changing the active TextDocument, even
though the cursor is always visibly being reset to 0, 0.
2020-08-05 17:27:14 +02:00
Andreas Kling
ea9ac3155d Unicode: s/codepoint/code_point/g
Unicode calls them "code points" so let's follow their style.
2020-08-03 19:06:41 +02:00
Mathieu PATUREL
7d12e0c7f1 LibGUI: WidgetScrollable scrolls horizontally when shift is pressed 2020-08-03 18:16:49 +02:00
Nico Weber
18e8fd333c CppLexer: Actually give raw strings type RawString
This fixes a regrettable mistake in 9ee1edae2a.
No behavior change.
2020-08-03 15:54:33 +02:00
AnotherTest
d04c833002 LibGUI: Add FilteringProxyModel
This model does not support nested indices well, in that it flattens
them all out.
That's a FIXME for the future as it does its job for now.
2020-08-01 08:39:26 +02:00
AnotherTest
c35493c156 LibGUI: Add focus hooks to TextEditor 2020-08-01 08:39:26 +02:00
Peter Elliott
5ae9eee4a3 LibGUI+WindowServer: Provide default placement to windows
This prevents windows from being opened directly on top of eachother,
and provides default behavior for when window position is not specified.

The new behavior is as follows:
- Windows that have been created without a set position are assigned one
  by WindowServer.
- The assigned position is either offset from the last window that is
  still in an assigned position, or a default position if no such window
  is available.
2020-08-01 08:06:48 +02:00
Ben Wiederhake
70fe126d01 LibGUI: Enable icons for SubMenus
It doesn't make sense for a top-level menu to have an icon, however
we do not have dedicated classes to distinguish these.

Furthermore, the only other place to store an icon is MenuItem.
Storing it there would be highly confusing, as MenuItem-with-Action
then would have two icons: one in Action and one in MenuItem.
And because we need to be able to replace the icon during realization,
this would need to write-through to Action somehow.

That's why I went with Menu, not MenuItem.
2020-07-28 16:29:44 +02:00
Ben Wiederhake
048f149f51 LibGUI: Refactor icon realization in Menu
This factors out icon realization into its own function, making it possible to
use the same code with other classes that have icon() and set_icon() methods.
2020-07-28 16:29:44 +02:00
Ben Wiederhake
082b7d6b0c LibGUI: Set correct default value during menu destruction 2020-07-28 16:29:44 +02:00
thankyouverycool
6448f94372 DevTools+LibGUI: Make ProcessChooser a general Dialog in LibGUI
Moves ProcessChooser and RunningProcessesModel to LibGUI and
generalizes their construction for use by other apps. Updates
Profiler to reflect the change and use its new icons.
2020-07-28 16:29:36 +02:00
Nico Weber
9ee1edae2a CppLexer: Support raw string literals
Handles prefixes and delimiters (`R"(text)", `u8R"f(text)f"`, ...).
2020-07-27 12:11:19 +02:00
Nico Weber
4d783338c1 CppLexer: Support L, u, u8, U prefixes on string and char literals 2020-07-27 12:11:19 +02:00
Nico Weber
34dc163441 CppLexer: Correctly highlight hex escapes in string and char literals
\x consumes all hex digits following it. (If the resulting number
then doesn't fit in the character type, the compiler emits an
error.)

\x would be much more convenient to use if it was always followed
by exactly two hex digits (with \u and \U for higher codepoints),
but that's sadly not the world we live in.
2020-07-27 12:11:04 +02:00
Nico Weber
c1b7fd644c CppLexer: Support \U escapes in addition to \u escapes 2020-07-27 12:10:46 +02:00
Nico Weber
7a1c328417 CppLexer: Add token types for "::", "::*", ".*", "->*" 2020-07-27 01:04:17 +02:00
Nico Weber
1992dbd637 CppLexer: Add token types for ".", "->" 2020-07-27 01:04:17 +02:00
Nico Weber
95113d15fe CppLexer: Add token types for "!", "!=", "~", "?", ":" 2020-07-27 01:04:17 +02:00
Nico Weber
29bc978564 CppLexer: Add token types for "^", "^=" 2020-07-27 01:04:17 +02:00
Nico Weber
c38b8d63f8 CppLexer: Add token types for "++", "--" 2020-07-27 01:04:17 +02:00
Nico Weber
598b5e4595 CppLexer: Add token types for "&", "&&", "&=", "|", "||", "|=" 2020-07-27 01:04:17 +02:00
Nico Weber
345b303262 CppLexer: Add token types for ">", ">=", ">>", ">>=" 2020-07-27 01:04:17 +02:00
Nico Weber
97c4344f33 CppLexer: Add token types for "<", "<=", "<<", "<<=", "<>" 2020-07-27 01:04:17 +02:00
Andreas Kling
3e389f4cdc LibGUI: Remove accidentally committed file :^) 2020-07-26 20:05:15 +02:00
Nico Weber
96d13f75cf CppLexer: Add token types for "+", "+=", "-", "-=", "=", "==", "/", "/="
Mostly so that TextEdit doesn't emit logspam when I write `int a = 4`
in a test program.
2020-07-26 19:52:26 +02:00
Nico Weber
5a36d8acb8 CppLexer: Add token type for "*=" 2020-07-26 19:52:26 +02:00
Andreas Kling
e0b8b4ac67 LibCore+LibGUI: Switch to using AK::is and AK::downcast 2020-07-26 17:51:00 +02:00