summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Window.h
AgeCommit message (Collapse)Author
2022-12-07Meta+Userland: Pass Gfx::IntSize by valueMacDue
Just two ints like Gfx::IntPoint.
2022-12-07Meta+Userland: Pass Gfx::IntPoint by valueMacDue
This is just two ints or 8 bytes or the size of the reference on x86_64 or AArch64.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-11-19LibGUI+WindowServer+Applets+Taskbar: Remove active input conceptsthankyouverycool
and the CaptureInput mode. They are a source of unneeded complexity in WindowServer and have proven prone to regressions, so this patch replaces them with a simple input preemption scheme using Popups. Popup windows now have ergonomics similar to menus: When open, a popup preempts all mouse and key events for the entire window stack; however, they are fragile and will close after WindowServer swallows the first event outside them. This is similar to how combo box windows and popups work in the classic Windows DE and has the added benefit of letting the user click anywhere to dismiss a popup without having to worry about unwanted interactions with other widgets.
2022-11-19LibGUI+WindowServer: Remove InputPreemptor conceptthankyouverycool
This functionality will be superceded by WindowType:Popups
2022-11-19LibGUI+WindowServer: Replace WindowInput{Enter,Leave} Eventsthankyouverycool
with WindowInput{Preempted,Restored} Events and allow Widgets to save the state of their focus preemption. As of now, only Popups will preempt input and trigger these events.
2022-11-19LibGUI+WindowServer: Add WindowType:Autocomplete and helpersthankyouverycool
2022-11-19LibGUI: Allow adding previously constructed menus to Menubarthankyouverycool
2022-11-14LibGUI: Handle Action keyboard shortcuts in Widget keydownZaggy1024
Widgets can now prevent shortcut Actions from being called, which allows text input keydown handlers to override single key shortcuts.
2022-11-02LibGUI+WindowServer: Allow programatically minimizing windowsTimothy Flynn
The backend methods in WindowServer already exist. This just adds the IPC plumbing to connect those methods to GUI::Window.
2022-10-25LibGUI: Remove Window::set_blocks_command_palette()demostanis
Since the logic to open the command palette is now in the form of an action, its keybinding is only bound when the window active. Thus, when a combo box or the emoji input dialog is active, the window isn't, and the command palette doesn't show up, without requiring special checks.
2022-10-13LibGUI+WindowServer: Add Window::set_always_on_top()demostanis
2022-10-11WindowServer+LibGUI: Shrink window edge resize hot-spotsMart G
The hot-spots for resizing a window by dragging its corner are now limited to a small area around the actual corner instead of an area with 1/3rd the length or width of the window. The hot-spots to resize a window while holding a modifier key and the right mouse button are unchanged.
2022-09-09LibGUI: Allow blocking CommandPalette/EmojiInput on a per Window basisthankyouverycool
Instead of having to negate every focusable widget or textbox, let windows override all their widgets. These two Dialogs now block themselves and each other.
2022-09-09LibGUI: CommandPalette: Fix key event capture for actionsfaxe1008
This patch fixes an issue for applications that contain actions without a modifier (e.g. PixelPaint). Previously when pressing any key bound to an action while the CommandPalette was visible the action was forwarded to the parent instead of the CommandPalette.
2022-09-08LibGUI+WindowServer: Notify Windows on input preemptionthankyouverycool
Previously Menus set themselves as active input solely to make sure CaptureInput modals would close, but this is a functional half-truth. Menus don't actually use the active input role; they preempt normal Windows during event handling instead. Now the active input window is notified on preemption and Menus can remain outside the active input concept. This lets us make more granular choices about modal behavior. For now, the only thing clients care about is menu preemption on popup. Fixes windows which close on changes to active input closing on their own context menus.
2022-08-25LibGUI+WindowServer+Apps: Replace Accessory Windowsthankyouverycool
with the CaptureInput WindowMode. This mode will serve the same function as accessories: redirecting input while allowing parent windows to remain active.
2022-08-25LibGUI+WindowServer: Introduce WindowModesthankyouverycool
Previously, Windows only understood blocking modality: Windows were either modal, i.e., in a blocking state, or not. Windows could also be set as Accessories or ToolWindows, attributes which technically applied modes to their parents but were implemented ad hoc. This patch redefines these modal effects as WindowModes and sets up some helpers. This will let us simplify a lot of modal logic in the upcoming patches and make it easier to build new modal effects in the future. Windows can now set 1 of 5 modes before reification: -Modeless: No modal effect; begins a new modal chain -Passive: Window joins its modal chain but has no effect -RenderAbove: Window renders above its parent -CaptureInput: Window captures the active input role from its parent -Blocking: Window blocks all interaction with its modal chain States like fullscreen and tiling are dynamic and don't alter behavior in modal chains, so they aren't included.
2022-08-25LibGUI+WindowServer: Initialize minimum window size to zerothankyouverycool
And remove unnecessary workarounds to the old limit of {50, 50} and the cautious but arbitrary limit of {1, 1} for other WindowTypes. Null rects are already the default when calculating minimum window size and are the least restrictive but valid value. Also returns early during minimum size calculations for frameless windows, and verifies against negative minimum sizes and failure to disable widget min size before setting a minimum window size. Layout automatically overrides this setting each relayout otherwise.
2022-07-04LibGUI: Calculate Window min_size on showFrHun
2022-06-29LibGUI: Add ability to calculate min_size of Window from content widgetFrHun
2022-05-30LibGUI: Search for actions with a Shortcut instead of for KeyEventGeordie Hall
Instead of having widget/window/application create a shortcut from a KeyEvent within their find methods, we'll just pass them a Shortcut so that the "where to search" logic doesn't need to be duplicated for different Shortcut types. It also lets us handle invalid Shortcut rejection at a higher level, with most things letting the caller be responsible for not searching for actions with an invalid shortcut.
2022-04-05WindowServer+LibGUI: Notify windows when their maximized state changesAndreas Kling
Previously, GUI::Window::is_maximized() had to make a synchronous IPC request to WindowServer in order to find out if the window was indeed maximized. This patch removes the need for synchronous IPC by instead pushing the maximization state to clients when it changes. The motivation for this change was that GUI::Statusbar was checking if the containing window was maximized in its resize_event(), causing all windows with a statusbar to block on sync IPC *during* resize. Browser would typically block for ~15 milliseconds here every time on my machine, continuously during live resize.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-02-25Userland: Rename WindowServerConnection=>ConnectionToWindowServerItamar
This was done with CLion's automatic rename feature.
2022-01-31LibGUI: Remove `Window` background colorJelle Raaijmakers
The `m_background_color` field was not used anywhere. Both `Terminal` and the `ColorPicker` widget invoked `set_background_color()` to no avail.
2022-01-30LibGUI: Collect menu and submenu actions for CommandPalettenetworkException
We now not only collect actions that are children of windows but also all actions that are part of a window's menus and submenus :^)
2022-01-26LibGUI: Allow Windows to set a default return key widgetthankyouverycool
The default return key widget takes precendence when dispatching return key events with the exception of focused buttons.
2022-01-09LibGUI+WindowServer: Flash menubar menu when using a keyboard shortcutbugreport0
Briefly flash the menubar menu containing the keyboard shortcut action to give the user immediate visual feedback on their interaction with the system.
2021-11-24LibGUI: Add GUI::Window::try_set_main_widget<T>(...)Andreas Kling
This is a fallible variant of set_main_widget<T>() that returns ErrorOr.
2021-11-24LibGUI: Add GUI::Window::try_add_menu()Andreas Kling
This is a fallible variant of add_menu() that returns ErrorOr.
2021-10-31LibGUI: Support using a bitmap as override cursorMarco Cutecchia
2021-10-23LibGUI: Add Widget::repaint() to force an immediate repaintAndreas Kling
In most situations, Widget::update() is preferable, since that allows us to coalesce repaints and avoid redundant work, reducing system load. However, there are some cases where you really want a paint to happen right away, to make sure that the user has a chance to see a short-lived visual state.
2021-10-21LibGUI+WindowServer: Add option to hide a widow's close buttonTimothy Flynn
This allows windows to be closed only programatically, and not from e.g. the user clicking the X button on the window frame.
2021-10-17LibGUI: Remember the maximized value if a window hasn't been created yetKarol Kosek
d0fb511d75762e9d97fa80a01585381843b90a0a set the maximized window value in the File Manager before a window was created, which resulted in crash everytime you tried to open the program that was closed while it was maximized. ugh Here we do more-or-less what GUI::Window::set_rect() does, except we don't add it to the WindowServer::create_window() IPC call. That's because the Window Server knows nothing about menus at this point and just assumes they don't need to be visible. So if we try to maximize the window then, it could be slightly taller and a titlebar could be hidden. So even though it looks how it looks like, it does work and it doesn't show in the startup size, as described in the mentioned commit (the call is put a few lines before the initial update()). :^)
2021-09-08LibGUI+WindowServer: Remove now-obsolete cursor tracking featureBen Wiederhake
This feature was problematic for several reasons: - Tracking *all* the user activity seems like a privacy nightmare. - LibGUI actually only supports one globally tracking widget per window, even if no window is necessary, or if multiple callbacks are desired. - Widgets can easily get confused whether an event is actually directed at it, or is actually just the result of global tracking. The third item caused an issue where right-clicking CatDog opened two context menus instead of one.
2021-08-31WindowServer: Add message to notify clients of applet area resizeJoe Bentley
Applets and windows would like to be able to know when the applet area has been resized. For example, this happens asynchronously after an applet has been resized, so we cannot then rely on the applet area position synchronously after resizing. This adds a new message applet_area_rect_changed and associated Event AppletAreaRectChange, and the appropriate virtual functions.
2021-08-05LibGUI: Add on_active_window_change function object to the Window classKarol Kosek
2021-08-02LibGUI, WindowServer: Greatly simplify menubar logicsin-ack
Currently, any number of menubars can be plugged in and out of a window. This is unnecessary complexity, since we only need one menubar on a window. This commit removes most of the logic for dynamically attaching and detaching menubars and makes one menubar always available. The menubar is only considered existent if it has at least a single menu in it (in other words, an empty menubar will not be shown). This commit additionally fixes a bug wherein menus added after a menubar has been attached would not have their rects properly setup, and would therefore appear glitched out on the top left corner of the menubar.
2021-07-26LibGUI: Add virtual handlers for WindowEntered and WindowLeft eventssin-ack
These can be useful if an application wants to react to the cursor entering the window at any point, rather than just on a widget.
2021-07-21Userland: Add GUI::Window::add_menu() and use it everywhereAndreas Kling
Applications previously had to create a GUI::Menubar object, add menus to it, and then call GUI::Window::set_menubar(). This patch introduces GUI::Window::add_menu() which creates the menubar automatically and adds items to it. Application code becomes slightly simpler as a result. :^)
2021-07-12LibGUI: Add FontsChanged event and deliver it to windows and widgetsLuK1337
2021-07-04WindowServer+LibGUI: Add a way to force a window to have a drop shadowAndreas Kling
2021-06-20WindowServer: Add initial support for rendering on multiple screensTom
This allows WindowServer to use multiple framebuffer devices and compose the desktop with any arbitrary layout. Currently, it is assumed that it is configured contiguous and non-overlapping, but this should eventually be enforced. To make rendering efficient, each window now also tracks on which screens it needs to be rendered. This way we don't have to iterate all the windows for each screen but instead use the same rendering loop and then only render to the screen (or screens) that the window actually uses.
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-08Everywhere: Replace Vector<T*> with nonnull entries with Vector<T&>Ali Mohammad Pur
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-05-19Everywhere: Add missing includes for <AK/OwnPtr.h>Gunnar Beutner
Previously <AK/Function.h> also included <AK/OwnPtr.h>. That's about to change though. This patch fixes a few build problems that will occur when that change happens.
2021-05-02WindowServer+LibGUI+Taskbar: Store window progress as Optional<int>Andreas Kling
We were previously using the magical constant -1 to signify that a window had no progress state. Be more explicit an use an Optional. :^)
2021-05-01LibGUI: Add getter/setter for GUI::Window modified stateAndreas Kling
This state lives in WindowServer and has no local copy in the client process for now. This may turn out to be a performance issue, and if it does we can easily cache it.