summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
AgeCommit message (Collapse)Author
2021-06-09LibGUI/WindowServer: Add set_maximized IPC callMarcus Nilsson
Add an IPC call to enable the client to manually maximize it's own window.
2021-06-09Meta: Disable -Wmaybe-uninitializedAli Mohammad Pur
It's prone to finding "technically uninitialized but can never happen" cases, particularly in Optional<T> and Variant<Ts...>. The general case seems to be that it cannot infer the dependency between Variant's index (or Optional's boolean state) and a particular alternative (or Optional's buffer) being untouched. So it can flag cases like this: ```c++ if (index == StaticIndexForF) new (new_buffer) F(move(*bit_cast<F*>(old_buffer))); ``` The code in that branch can _technically_ make a partially initialized `F`, but that path can never be taken since the buffer holding an object of type `F` and the condition being true are correlated, and so will never be taken _unless_ the buffer holds an object of type `F`. This commit also removed the various 'diagnostic ignored' pragmas used to work around this warning, as they no longer do anything.
2021-06-09LibGUI: Set TextEditor to unmodified after saving size=0 filesSam Atkins
This fixes #7946 Previously, TextEditor::write_to_file() would not mark its document as unmodified if the file size was 0. This caused a desync in the Text Editor app between the window's is_modified state and the TextEditor's. It's already noted in the comments of the app's save action code that propagating the modified state automatically would be good, and it would solve issues like this, but I'm not yet familiar enough with the code to try a change like that.
2021-06-08Everywhere: Replace Vector<T*> with nonnull entries with Vector<T&>Ali Mohammad Pur
2021-06-08LibGUI+SoundPlayer: Add Slider option to jump to cursorNick Miller
When the cursor is clicked outside of the slider knob, the current behavior is that it will step up or down by the Slider page step amount. This commit adds an option to jump the slider knob directly to the where the mouse cursor is on mouse down events. This behavior is disabled by default. It must be enabled with `Slider::set_jump_to_cursor()`. Jump to cursor is enabled in SoundPlayer since most music players have this behavior.
2021-06-07LibWeb+LibSyntax: Implement nested syntax highlightersAli Mohammad Pur
And use them to highlight javascript in HTML source. This commit also changes how TextDocumentSpan::data is interpreted, as it used to be an opaque pointer, but everyone stuffed an enum value inside it, which made the values not unique to each highlighter; that field is now a u64 serial id. The syntax highlighters don't need to change their ways of stuffing token types into that field, but a highlighter that calls another nested highlighter needs to register the nested types for use with token pairs.
2021-06-06LibGUI: Don't delete within a line if the line is emptydylanbobb
2021-06-06AK+Everywhere: Disallow constructing Functions from incompatible typesAli Mohammad Pur
Previously, AK::Function would accept _any_ callable type, and try to call it when called, first with the given set of arguments, then with zero arguments, and if all of those failed, it would simply not call the function and **return a value-constructed Out type**. This lead to many, many, many hard to debug situations when someone forgot a `const` in their lambda argument types, and many cases of people taking zero arguments in their lambdas to ignore them. This commit reworks the Function interface to not include any such surprising behaviour, if your function instance is not callable with the declared argument set of the Function, it can simply not be assigned to that Function instance, end of story.
2021-06-05TreeView: Don't try to move cursor with invalid indexMarcus Nilsson
When clicking on the TreeView in profiler without selecting a node and then pressing up or pgup, cursor_index was in an invalid state. Instead select the first node in the index.
2021-06-05LibGUI: Fix off-by-one error in Lexer tokensMax Wipfli
This changes the INI and GML lexers to conform to the now-fixed rendering of syntax highlighting spans in GUI::TextEditor. The other user of GMLToken::m_end, GMLAutocompleteProvider, has been modified to take into account that end position columns have been incremented by one.
2021-06-05LibGUI: Use CharacterTypes.h and constexpr functions in {INI,GML}LexerMax Wipfli
2021-06-05LibGUI: Use east const style in {INI,GML}Lexer.{cpp,h}Max Wipfli
2021-06-05LibGUI: Fix off-by-one error in rendering of highlighted textMax Wipfli
This fixes an off-by-one error in TextEditor's rendering of the syntax highlighting as generated by Syntax::Highlighter and its subclasses. Before, a single character span was e.g. (0-3) to (0-3), but this was considered invalid by GUI::TextRange. Now, a single character span would be e.g. (0-3) to (0-4). This fix requires all Syntax::Highlighter subclasses to be adjusted, as they all relied on the previous implementation. This will then also fix a bug where single-character HTML tags wouldn't be highlighted.
2021-06-03LibGUI/FileIconProvider: Return s_file_icon when stat() failsMarcus Nilsson
Previously when using icon_for_path(), without specifying t_mode, on an anonymous file it would return an empty Icon causing problems down the line. Instead return the s_file_icon when stat fails.
2021-06-03Everywhere: Replace ctype.h to avoid narrowing conversionsMax Wipfli
This replaces ctype.h with CharacterType.h everywhere I could find issues with narrowing conversions. While using it will probably make sense almost everywhere in the future, the most critical places should have been addressed.
2021-06-03LibGUI: Hide TextEditor dbgln spew under TEXTEDITOR_DEBUGBrian Gianforcaro
2021-06-03LibGUI: Properly wrap multiple lines in IconView search highlightingMatthew B. Jones
2021-06-03LibGUI: ComboBox now goes upwards when running out of room to renderMatthew Jones
2021-06-03LibGUI: ComboBox now correctly sizes height in relation to taskbarMatthew Jones
2021-06-03LibGUI: Desktop.h should get actual value from TaskbarWindow.hMatthew Jones
2021-06-03LibGUI: Show pressed state for Space and Return key eventsMatthew Jones
Also allows the user to press Esc while the button is being pressed to cancel the button action.
2021-06-02LibGUI+LibGfx+WindowServer: Sanity check window size dimensionsMatthew Jones
Previous to this commit, if a `Window` wanted to set its width or height greater than `INT16_MAX` (32768), both the application owning the Window and the WindowServer would crash. The root of this issue is that `size_would_overflow` check in `Bitmap` has checks for `INT16_MAX`, and `Window.cpp:786` that is called by `Gfx::Bitmap::create_with_anonymous_buffer` would get null back, then causing a chain of events resulting in crashes. Crashes can still occur but with `VERIFY` and `did_misbehave` the causes of the crash can be more readily identified.
2021-06-02LibGUI: Tooltip no longer exceeds screen width, now truncatesMatthew Jones
2021-06-02LibGUI: Fixes Widget->set_visible(false) still maintains focus bugMatthew Jones
When setting a Widget->set_visible(false), if that Widget->has_focus() it will continue to have focus, even though it's not visible to the user anymore. Now calling Widget->set_visible(false) will remove focus from the Widget if it had focus, and the Window will give focus back to the Widget that had it previously, if there was one.
2021-06-02Terminal/LibGUI::TextEditor: Add shift+return to search forwardsMarcus Nilsson
This adds support for shift+return key combo in single line TextEditor fields. Used in this case for searching backwards/forwards in the Terminal find window.
2021-06-01Everywhere: codepoint => code pointAndreas Kling
2021-06-01LibGUI+Shell+bt+ls: Use proper APIs for creating file URLsMax Wipfli
This patch replaces ad-hoc generation of file URL strings with using URL::create_with_file_scheme().
2021-06-01LibGUI: Add a FIXME about race in AutocompleteBox::apply_suggestion()Itamar
2021-06-01LibGUI: Check that AutocompleteBox's selection row is validItamar
Previously we didn't check that the selection's row index is in a valid range before attempting to access its data via the model. This could cause an out-of-bounds access to the model's Vector of suggestions. I think this should fix #7404, but I can't verify it does because I wasn't able to reproduce it on my machine.
2021-06-01LibGUI/TreeView: Select parent on collapseJelle Raaijmakers
When collapsing a tree that contains the current selection, the parent node becomes selected instead.
2021-05-31LibGUI: Replace fprintf(stderr)/printf() with warnln()/dbgln()Linus Groh
2021-05-30LibGUI: Don't scroll TreeView horizontally to bring index into viewAndreas Kling
This behavior was really irritating and basically never what you wanted so let's stop doing it.
2021-05-30LibGUI: Avoid a bunch of virtual calls during TreeView paintingAndreas Kling
The index of the tree column will not change while painting. Neither will the number of columsn. So avoid a whole bunch of virtual function calls by caching these two values at the start of painting.
2021-05-29LibGUI/TreeView: Implement Home/End/PageUp/PageDn navigationJelle Raaijmakers
This adds an implementation for the Home, End, Page Up and Page Down cursor movements for TreeView. Also, the Up and Down movement implementations are replaced by a more efficient traversal mechanism: whereas the old code would walk over all visible nodes every time, the new code only evaluates relevant sibling and parent indices.
2021-05-29LibGUI: Distribute remaining pixels in BoxLayout to fill the entire areaMart G
Previously, the layout algorithm preferred to give every item an equally sized slice of the remaining space. This meant that not the entire area was used when the remaining size did not divide evenly by the number of items. This caused, for example, the ResizeCorner in HexEditor to be a couple of pixels left of the actual corner for some sizes of the window. Now, the remaining pixels are distributed on a first come, first served basis. However, only one pixel is distributed at a time. This means items towards the left might me a pixel larger than their siblings towards the right.
2021-05-29LibGUI: Make HeaderView act only on the visible sectionsAli Mohammad Pur
i.e. Drawing them, or handling mouse events on them. Fixes #7505.
2021-05-28LibGUI: Add u64 type to LibGUI::VariantJesse Buhagiar
`uint` has also been more appropriately renamed to u32.
2021-05-27LibGUI+TextEditor: Add the calculation of selected wordsry-sev
This moves the calculation of selected words that was originally in the TextEditor application to TextEditor in LibGUI. This allows all applications with text editors to get this number without having to calculating it themselves.
2021-05-26LibGUI: Paint some knurling in the middle of GUI::SplitterAndreas Kling
This makes splitters stand out visually so you can actually spot them. Before this, you had to guess/know where they were, which was weird. The look of the knurling is the same as GUI::ResizeCorner, to build on the established visual language.
2021-05-26LibGUI: Have GUI::Splitter track all grabbable areasAndreas Kling
Instead of computing the grabbable areas on the fly in mouse event handlers, we now figure out which parts of the splitter are grabbable when something moves around, and then remember it. This makes the code a lot easier to follow.
2021-05-26LibGUI/AbstractView: Remove `on_selection`Jelle Raaijmakers
Since the introduction of multi-select, we have had both `on_selection` and `on_selection_change`, the latter of which was only invoked when a change in selection came in through the model. This removes `AbstractView::on_selection` and replaces it usage with the more explicit `on_selection_change` everywhere.
2021-05-24LibGUI/AbstractView: Expose `activates_on_selection`Jelle Raaijmakers
2021-05-24LibGfx: Use anonymous buffer instead of raw anon_fd for Gfx::BitmapJean-Baptiste Boric
Instead of using a low-level, proprietary API inside LibGfx, let's use Core::AnonymousBuffer which already abstracts anon_fd and offers a higher-level API too.
2021-05-23LibCore: Make ProcessStatisticsReader return results in a VectorAndreas Kling
The HashMap API was overkill and made using this less ergonomic than it should be.
2021-05-23Userland: Mark subclasses of IPC::{Client,Server}Connection finalAndreas Kling
2021-05-23LibIPC: Remove unnecessary IPC::ServerConnection::handshake()Andreas Kling
This is no longer used by any of our IPC pairs.
2021-05-23LibGUI: Handle fast_greet stuff in WindowServerConnection constructorAndreas Kling
Move the from handshake() to the constructor (and move the constructor out-of-line while we're at it.) This prepares getting rid of the handshake() mechanism since this is the only remaining user.
2021-05-23NotificationServer: Remove unnecessary greet() messageAndreas Kling
2021-05-22TextEditor: Prevent pasting with empty clipboardCarlos César Neves Enumo
Prevent erasing selected text when pasting with empty clipboard
2021-05-22LibGUI: Make GUI::Variant stringify floats with 2 decimalsAndreas Kling
The extremely high default precision was obnoxious in user interfaces.