Commit graph

1331 commits

Author SHA1 Message Date
thankyouverycool
72ae082ca8 WindowServer: Let Windows handle InputLeft events when blocked
Fixes windows not updating on active input changes after being
blocked
2022-09-08 23:21:54 +01:00
thankyouverycool
463aff827e LibGUI+WindowServer: Notify Windows on input preemption
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-09-08 23:21:54 +01:00
thankyouverycool
6c35aac617 WindowServer: Add unadjusted position members to Menu
Used to determine Menu relationships by proxy
2022-09-08 23:21:54 +01:00
Andreas Kling
5c2e3d1637 LibWeb+WebContent: Add abstraction layer for generic font families
Instead of hard-coding the names of system fonts to use for the CSS
generic fonts (like "sans-serif", "monospace", etc.) we now call out
to a Platform::FontPlugin and ask for the generic names.
2022-09-08 11:57:03 +02:00
thankyouverycool
0b0c4fc1e8 WindowServer: Set rendered cache dirty on maximization event
Fixes restore/maximize icon not updating when the cursor overlaps
window frame on restoration.
2022-09-08 10:17:27 +01:00
thankyouverycool
35e557c657 Browser+LibGUI+WindowServer: Open Button menus uniformly
Instead of letting buttons determine the relative position
of their menus, a workaround only used by Statusbar segments,
open them all uniformly for a nice, consistent UI.

Passing a rect to popup() now routes to open_button_menu(), an
analog to open_menubar_menu(), which adjusts the menu's popup
position in the same way. Fixes button menus obscuring the buttons
which spawn them and jutting out at odd corners depending on screen
position.
2022-09-08 10:17:27 +01:00
thankyouverycool
ab29f8976d Taskbar: Set TaskbarButton checkable 2022-09-08 10:17:27 +01:00
Andreas Kling
9567e211e7 LibWeb+WebContent: Add abstraction layer for event loop and timers
Instead of using Core::EventLoop and Core::Timer directly, LibWeb now
goes through a Web::Platform abstraction layer instead.

This will allow us to plug in Qt's event loop (and QTimer) over in
Ladybird, to avoid having to deal with multiple event loops.
2022-09-07 20:30:31 +02:00
Andreas Kling
43f87c67f2 LibWeb: Remove unused WindowObject.h 2022-09-06 13:54:49 +02:00
Andreas Kling
9176a0de99 LibWeb: Stop using Bindings::wrap() in a bunch of places
wrap() is now basically a no-op so we should stop using it everywhere
and eventually remove it. This patch removes uses of wrap() in
non-generated code.
2022-09-06 00:27:09 +02:00
Andreas Kling
4c887bf6c3 LibWeb: Remove Document::interpreter()
Nobody needs this anymore, so we can finally remove it. :^)
2022-09-06 00:27:09 +02:00
Andreas Kling
2d72abc3d4 LibWeb+WebContent: Store Realm instead of Interpreter in ConsoleClient 2022-09-06 00:27:09 +02:00
Andreas Kling
6f433c8656 LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated
PlatformObjects. Their C++ wrapper classes are removed, and the LibJS
garbage collector is now responsible for their lifetimes.

There's a fair amount of hacks and band-aids in this patch, and we'll
have a lot of cleanup to do after this.
2022-09-06 00:27:09 +02:00
Andreas Kling
5366924f11 LibWeb: Make StyleSheetList GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
5d60212076 LibWeb: Make StyleSheet and CSSStyleSheet GC-allocated 2022-09-06 00:27:09 +02:00
Timothy Flynn
fc8bf7ac3e LibUnicode+Userland: Migrate generated CLDR data to LibLocaleData
Currently, LibUnicodeData contains the generated UCD and CLDR data. Move
the UCD data to the main LibUnicode library, and rename LibUnicodeData
to LibLocaleData. This is another prepatory change to migrate to
LibLocale.
2022-09-05 14:37:16 -04:00
networkException
707b4f83eb WebServer: Make bound socket a clickable hyperlink :^)
This patch adds a hyperlink that can be hovered over and clicked on to
open the WebServer's index page in Browser.
2022-09-05 09:23:20 +01:00
Karol Kosek
f1aa03b779 WindowServer: Place drag and drop overlay at the cursor position
... instead of in the center of the cursor bitmap.

It doesn't make much of a difference, as the default cursor hotspot is
center. But since now we switch between a normal Drag cursor and
DragCopy one that has set hotspot, this caused the overlay to shake.
2022-08-31 17:29:44 +01:00
Karol Kosek
d4aff36875 WindowServer: Include window frames when sending drag events
Previously, the cursor would use a default cursor on window frames such
as the title bar and menu bar, which was not quite correct as drop
events were still handled there.
2022-08-31 17:29:44 +01:00
Karol Kosek
2e244fc85b WindowServer+LibGUI: Change cursor icon if DragEnter event was accepted 2022-08-31 17:29:44 +01:00
Karol Kosek
e5674d9666 Base+WindowServer+LibGfx: Add new DragCopy Cursor
The purpose of this cursor is to indicate if a current dragged object
(file, Spreadsheet cell) can be dropped onto a widget.
2022-08-31 17:29:44 +01:00
Linus Groh
cfa5885855 LibJS: Turn initialize_global_object() into a regular initialize()
There's nothing special about global object initialization anymore, this
can just work the same way as for any other object now.
2022-08-28 16:36:56 +01:00
Linus Groh
867ad03995 LibJS: Move Console ownership from GlobalObject to ConsoleObject
GlobalObject is now a regular object with no special properties :^)
2022-08-28 16:36:56 +01:00
thankyouverycool
1dd9086e1a WindowServer: Remove misbehavior conditions for modals
This was too restrictive and there are already UI elements that rely
on this behavior. Now Blocking modals will preempt interaction with
all windows in their modal chain except those descending from them.
Fixes crashing in FilePicker when permission is denied.
2022-08-28 16:04:35 +01:00
thankyouverycool
b2b68a7551 WindowServer: Continue processing ongoing resizes after tiling
Just like tiling behavior during ongoing moves, now resizing
does not finish until a MouseUp event, letting you drag out of
undesired tile states. Resize tiling only works with vertical
and horizontal cursors now to cut down on unintentional tiling
from the corners.
2022-08-28 16:04:35 +01:00
Linus Groh
dfb7588d30 LibJS: Remove GlobalObject::{set_,}associated_realm() 2022-08-27 11:29:10 +01:00
thankyouverycool
7b2becad52 FileSystemAccessServer: Set dummy child to WindowMode::Passive
so Dialogs can join the modal chain of the window parenting them.
Fixes apps that use FileSystemAccess to sandbox FilePicker not
respecting its blocking effect.
2022-08-26 12:48:05 +02:00
thankyouverycool
aa045a9fdf WindowServer: Always restore modal chain when clicking a window
Refactors restore helper into move_to_front_and_make_active().
Fixes not bringing all modal children to the front when any modal
child or its modeless parent is clicked.
2022-08-26 12:48:05 +02:00
thankyouverycool
d815f659cc LibGUI+Taskbar+WindowServer: Prevent minimization when blocked
This was intentionally enabled with WindowModes as a new Taskbar
convenience, but on second thought, it doesn't add up visually.

Taskbar buttons show blockers' context menus when available,
which is a bit confusing when the window isn't visible. The
modeless window's disabled context menu options and inactive title
bar also contradict the button. So, this patch reenables the
restriction for now. Blocking modals you don't want to answer to
immediately can still be tucked away on another workspace.
2022-08-26 12:48:05 +02:00
thankyouverycool
18b111b802 WindowServer: Ignore modal blocking if capturing input
This exception is necessary for ComboBoxes used in some blocking
Dialogs. CaptureInput is now the only mode which can spawn from
a blocking modal and it won't accept any children of its own.
2022-08-26 12:48:05 +02:00
thankyouverycool
35a230f974 LibGUI+Taskbar+WindowServer: Remove mode and parent methods from Taskbar
Taskbar only needs a modeless parent and the activity state of the
modal chain to update buttons.
2022-08-25 13:28:50 +02:00
thankyouverycool
d54dc22362 WindowServer: Default to Desktop when picking a new active window 2022-08-25 13:28:50 +02:00
thankyouverycool
af706d081c WindowServer: Invalidate new and previous active input window frames
Fixes shared active title bar theming not updating for capturing
modals.
2022-08-25 13:28:50 +02:00
thankyouverycool
6f316d59f4 WindowServer: Restore modal chains from the Taskbar and Switcher
And only show modeless windows in WindowSwitcher.
2022-08-25 13:28:50 +02:00
thankyouverycool
5a0472d8d2 WindowServer: Use nearest modeless window for modal Taskbar rects
Modeless windows are guaranteed Taskbar buttons which lets us
simplify getting the proper taskbar rect for modals.
2022-08-25 13:28:50 +02:00
thankyouverycool
df2f479810 WindowServer: Don't move child windows in unison with their parents
This was a cludge for ComboBox ListView windows when they were first
implemented. The behavior is no longer needed and not very ergonomic
when moving Normal windows around.
2022-08-25 13:28:50 +02:00
thankyouverycool
2b2c317c2d WindowServer: Don't let modals minimize themselves
But do allow them to remain minimizable by a parent. This is a nice
ergonomics fix to allow a parent window to quickly minimize and
restore all its modal children.
2022-08-25 13:28:50 +02:00
thankyouverycool
788b16cbf8 WindowServer: Replace modal stacks with modal chains
And apply modal effects on move_to_front_and_make_active()

Instead of building a vector of windows every time we want to
loop over a group of related modals, simply recurse through
their ancestory. This lineage is now called a modal chain. Modal
chains begin at the first modeless parent, and a new chain
starts at every modeless child. This lets apps spawn child windows
independent of the main window's modal effects, restore state,
and workspace, yet still remain descendants.

Looping through a modal chain is recursive and includes the
modeless window which begins it.
2022-08-25 13:28:50 +02:00
thankyouverycool
4c7f95e2f8 LibGUI+WindowServer+Apps: Replace Accessory Windows
with the CaptureInput WindowMode. This mode will serve the same
function as accessories: redirecting input while allowing parent
windows to remain active.
2022-08-25 13:28:50 +02:00
thankyouverycool
0d4fd4e2a6 LibGfx+LibGUI+WindowServer+Apps+Demos: Replace ToolWindows
with the RenderAbove WindowMode. This mode will ensure child
windows always draw above their parents, even when focus is lost.
RenderAbove modals are automatically themed the same as the old
ToolWindows. Fixes ToolWindows rendering above ALL normal windows,
regardless of parent. We can't rely on WindowType to create these
sort of effects because of WindowManager's strict display hierarchy.
2022-08-25 13:28:50 +02:00
thankyouverycool
589572cfa4 LibGUI+WindowServer: Introduce WindowModes
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-25 13:28:50 +02:00
thankyouverycool
609391b46e WindowServer: Add modeless_ancestor() helper 2022-08-25 13:28:50 +02:00
thankyouverycool
ab517aa21d WindowServer: Remove m_unmaximized_rect from Window
Superceded by m_floating_rect
2022-08-25 13:28:50 +02:00
thankyouverycool
68570e897d LibGfx+WindowServer: Remove set_size_around() from Rect and Window
Superceded by to_floating_cursor_position() as a more accurate way
to reposition windows on untile. Effectively made set_size_around()
dead code, so the remnants can be removed.
2022-08-25 13:28:50 +02:00
thankyouverycool
a1dceb5b97 WindowServer: Remove nudge_into_desktop() from Window
Positioning windows outside visible coordinates is valid if sometimes
curious behavior, but it shouldn't be considered misbehavior by default.
There are multiple ways to recover windows with obscured title bars,
and this function papers over actual resize bugs and is no longer
needed to normalize window size, so let's remove it for now.
2022-08-25 13:28:50 +02:00
thankyouverycool
b180132c87 WindowServer: Fix typo 'reminder' -> 'remainder' in WindowManager 2022-08-25 13:28:50 +02:00
thankyouverycool
24b8301a0e WindowServer: Get taskbar height from TaskbarWindow directly
Fixes incorrect hardcoded heights and a failure to get taskbar
height when tiling on new workspaces.
2022-08-25 13:28:50 +02:00
thankyouverycool
46d6347035 LibGUI+WindowServer: Initialize minimum window size to zero
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-08-25 13:28:50 +02:00
James Bellamy
352d6545a9 WindowServer+DisplaySettings: Capitalize display mode dropdown
Every other dropdown in settings is capitalized apart from this one.
This commit fixes that.
2022-08-24 12:17:30 +02:00
Tim Schumacher
39a3775f48 Userland: Rely on a single authoritative source for the default PATH 2022-08-23 19:00:04 +01:00