Commit graph

88 commits

Author SHA1 Message Date
Andreas Kling
b91ff9ebfd UI/Qt: Keep macOS app alive without windows
Disable Qt quit-on-last-window behavior on macOS and install an
application-level menu so useful commands remain available after the
last browser window closes.

Reuse shared application actions and menus for Settings, Bookmarks,
History, Help, and global appearance controls. Centralize window-aware
commands such as New Tab, New Window, Open File, Open Location, and
Reopen Recently Closed so the browser window and windowless app menu
use the same behavior. Keep the location editor focused for new blank
windows after the native window has been activated.
2026-06-22 01:13:53 +02:00
Andreas Kling
d707d112a2 UI/Qt: Resize frameless macOS windows manually
Disable AppKit's native resize handling for client-side decorated macOS
windows so AppKit does not show a resize cursor for points it will not
deliver to Ladybird. Reapply this after Qt creates the native surface,
since Qt may restore the resizable style mask during Cocoa window setup.

Handle the resize gesture in BrowserWindow instead, with thin side edges
and a slightly larger corner target that avoids the rounded corner
cutouts.
2026-06-22 01:13:53 +02:00
Tim Ledbetter
0db82b3133 LibWebView+UI/Qt: Reuse an existing history tab when viewing history
Previously, the "View History" action always opened a new tab. We now
switch to an existing `about:history` tab when one exists in the active
window and fall back to opening a new tab otherwise.
2026-06-17 12:31:07 +02:00
Andreas Kling
b348f141d2 UI/Qt: Draw a border around frameless windows
When using client-side decorations, the window was a flat rectangle
with no outline, so its edge disappeared against similarly colored
backgrounds. Paint a 1px border in a new chrome window outline color
and reserve a matching 1px contents margin so child widgets do not
cover it.

The outline color matches chrome_border() in dark mode, but is darker
in light mode, since the window edge has to hold up against arbitrary
backdrops behind the window rather than our own chrome surfaces.

The border is skipped when the window is maximized or fullscreen, and
on macOS, where frameless windows already get rounded corners and a
native shadow.
2026-06-11 11:15:35 +02:00
Timothy Flynn
1a99bdad29 LibWebView+UI: Add a small history application menu
This currently just contains a menu item to open about:history. But in
the future, we can add a list of recently closed / recently visited
pages as well.
2026-06-10 20:27:36 +02:00
Timothy Flynn
7fc71e563b LibWebView+UI: Reduce boilerplate to update the bookmarks bar display
We currently use LibWebView's Application as the entry point to learn
about the bookmarks bar being shown/hidden, and propagate that through
virtual methods. At the time this was added, AppKit's Tab window and
Qt's BrowserWindow did not have a settings observer. They do now, so
let's skip a couple of middle-men.

For AppKit, we change the settings observer to just (weakly) store the
Tab instance so that we don't have to add callback functions for each
setting.
2026-06-03 18:14:12 -04:00
Timothy Flynn
83105b8349 LibWebView+UI/Qt: Move the show menu bar setting to LibWebView settings 2026-06-03 18:14:12 -04:00
Timothy Flynn
0e8a4f9747 UI/Qt: Cache the Application as a local in the BrowserWindow constructor 2026-06-03 18:14:12 -04:00
Timothy Flynn
1d36fc2997 UI/Qt: Let fullscreen content occupy the whole window
Hide fullscreen chrome at the TabWidget level instead of hiding the
current tab's toolbar child directly. This lets the toolbar container
and reserved verticaltabs space stop contributing to layout while
fullscreen content is shown.

Also keep the exit fullscreen button above native web content on macOS
and center it using the fullscreen screen geometry rather than a
potentially stale parent widget size.
2026-06-03 13:39:11 -04:00
Timothy Flynn
e18cd253f0 UI/Qt: Add an advanced setting to enable server-side decorations
This adds a setting to disable our custom window decorations and let the
system's window server paint the window instead.
2026-06-03 17:30:26 +01:00
Andreas Kling
a310091402 UI/Qt: Avoid native churn while resizing chrome
Do not clear the Qt window mask from the non-macOS corner update path.
The custom rounded-corner implementation is macOS-only, so the Linux
resize path should not touch native mask state on every resize event.

Also make dynamic property updates idempotent for tab chrome widgets.
Vertical tab resize and hover updates now only repolish when a property
actually changes, and avoid reapplying unchanged New Tab button text,
style, and size.
2026-06-03 02:53:37 +02:00
Andreas Kling
4f314b0aa0 UI/Qt: Unify browser chrome layout
Treat the toolbar, tab strip, and vertical sidebar as one browser
chrome surface. Add an explicit layout policy for platform window
controls and sidebar widths. This lets macOS use left-side traffic
lights while other platforms keep right-side custom controls.

Keep the macOS toolbar stable in vertical-tabs mode. Traffic lights and
navigation controls stay in the top row, and the sidebar sits below it.
Draw chrome/content separators explicitly so the content edge remains
clear without adding seams inside the chrome surface.

Retune tab, toolbar, and omnibox styling for the unified chrome. Tabs
use card-like selected states, quiet inactive states, and matching
horizontal and vertical geometry.

Make hover-expanded vertical tabs draw as a chrome overlay so the web
content does not relayout. Keep the overlay above native web views and
route macOS window drags through AppKit events for reliable dragging
from custom chrome.
2026-06-03 02:53:37 +02:00
Timothy Flynn
748ef48f26 UI/Qt: Draw the tab audio state icons with chrome icon infra
We currently rely on QStyle icons to draw the audio state icons. But
these icons are system dependent. The macOS icons look particularly
out-of-place here. So let's draw chrome icons.
2026-06-02 21:55:14 +02:00
Timothy Flynn
3b46b0bf09 UI/Qt: Add a setting to expand collapsed vertical tabs on hover
This as a pesudo third mode to vertical tabs. Now when the vertical tabs
are collapsed, users can enable a setting that will expand the vertical
tab area on hover. Unlike full expansion, the hovered vertical tab area
will cover the web content area to avoid pushing the web content area
around.
2026-06-02 07:57:05 -04:00
Sam Atkins
a92b9a7e34 UI/Qt: Put DevTools banner in its own widget, not a status bar
Using the status bar for this meant that the "DevTools is enabled on
port X" message would get overwritten whenever the user hovered over a
menu item. We don't otherwise use or need a status bar, so replace it
with an explicit banner widget that's only used for this purpose. Keep
the existing styling so it looks the same as before.
2026-06-01 15:29:51 +01:00
Andreas Kling
7c34917677 UI/Qt: Apply rounded corners after surface creation
The macOS rounded-corner helper needs the native view to be attached to
an NSWindow. The constructor can run too early for that, leaving startup
windows square even though the setting is enabled.

Reapply the corner state after Qt creates the platform surface, deferred
until Cocoa has attached the view to the native window.
2026-06-01 12:13:47 +02:00
Andreas Kling
aec4f8ab96 UI/Qt: Add macOS shortcuts for switching tabs
Support Command+Shift+[ and Command+Shift+] for moving between
Qt tabs on macOS. Also support the physical Control+Tab and
Control+Shift+Tab shortcuts accepted by other browsers.

Treat these as browser-reserved shortcuts so WebContent does not
consume the shortcut override before the browser action can run.
2026-06-01 12:13:47 +02:00
Andreas Kling
01973d1e5c UI/Qt: Add optional rounded window corners on macOS
Add an advanced setting for rounded browser window corners. On macOS,
Qt browser windows now use a layer-backed corner radius, and clear it
when maximized, fullscreen, or the setting is disabled.

Hide the setting from about:settings on other platforms for now since Qt
does not expose a native antialiased window corner API there.
2026-06-01 10:00:19 +02:00
Andreas Kling
24e767a06e UI/Qt: Polish vertical tab sidebar chrome
Refine vertical tab sidebar styling. Let inactive tabs sit on chrome.
Keep close buttons quiet. Align the New Tab row with tab rows.

Persist the expanded sidebar width and keep resizing bounded. Put the
resize hit area over the divider. Keep the collapsed rail fixed-width.
Avoid explicit mouse grabs while dragging.

Paint subtle sidebar dividers. Move the expand/collapse control into
the navigation toolbar. Tune the fallback globe and vertical-tabs icons.
2026-06-01 02:05:44 +02:00
Andreas Kling
a7e68ef1ae UI/Qt: Integrate window controls into vertical tab toolbar
Move custom window controls into the navigation toolbar while vertical
tabs are enabled. Remove the separate top row that only held them.

Mark empty toolbar space as draggable so the unified row acts like the
titlebar. Keep horizontal tab mode on the existing tab strip controls.
2026-06-01 02:05:44 +02:00
Timothy Flynn
a7f1ed7a10 UI/Qt: Begin implementing vertical tab support
This implements an initial version of vertical tabs for the Qt UI. Users
may enable vertical tabs in about:settings. When enabled, a button is
added to the toolbar to expand/collapse the vertical tabs.

There is plenty more to do here. We will want to support expanding on
hover, drawing the close tab / audio button indicators on collapsed
vertical tabs, positioning the vetical tab bar, etc.
2026-05-31 21:24:57 +02:00
Aliaksandr Kalenik
6598fb838d LibWebView+Compositor+UI: Send display metadata to Compositor
The browser process forwards the maximum frame rate to WebContent, but
the compositor process had no copy of that display timing metadata or
the display identity needed by compositor-local vsync.

Add one compositor control IPC message carrying the optional display ID
and refresh rate together, and store both values on each compositor
context.
2026-05-28 23:12:35 +01:00
Aliaksandr Kalenik
69f3e9e623 UI/Qt: Track screen changes after native window creation
BrowserWindow only connected QWindow::screenChanged while setting up
the non-Wayland DPI path. On Qt Wayland this path is skipped
because device-pixel-ratio changes are delivered to the window instead
of QScreen. A window could stay associated with the screen reported
during construction until the native QWindow exists, so refresh-rate
updates were missed when the window moved between outputs.

Separate refresh-rate and screen tracking from the DPI-specific signal
handling. Connect QScreen::refreshRateChanged for the current screen on
all platforms, connect QWindow::screenChanged when the native window
becomes available, and use ScreenChangeInternal as an additional update
hook. The DPI signal remains disabled for Qt Wayland, where
DevicePixelRatioChange is still handled through BrowserWindow::event().
2026-05-28 23:12:35 +01:00
Timothy Flynn
2773e45db5 UI/Qt: Consistently place the tab close button across platforms
Before the recent Qt overhaul, we had no control over the position of
the tab close button (without drawing/maintaining it ourselves, which we
now do). Qt automatically placed the tab close button on the left side
of the tab bar on macOS, and as such, we had to go out of our way to
place the audio state button on the right side. See:
dd54780d5e

We now consistently place the audio state button on the left and the tab
close button on the right. Qt still attempts to draw its own tab close
button on the left, so we also explicitly set that to null initially.
2026-05-28 10:33:05 +02:00
Andreas Kling
770829a855 UI/Qt: Put window controls in visible menu bar
Add a menu bar corner widget for the frameless window controls when
the Qt menu bar is visible. Hide the tab strip controls in that mode
so the buttons stay at the top-right edge of the window, and remove
the separator below the menu bar so the chrome reads as one surface.

Use compact menu bar controls and keep the right padding tight so the
buttons align with the edge without changing the hidden-menu layout.
2026-05-27 22:05:54 +02:00
Andreas Kling
d788b67863 UI/Qt: Treat empty menu bar space like a title bar
Start a platform window move when pressing empty space in the Qt menu
bar. Toggle maximized state on double-click, matching the tab strip.

Menu actions keep their normal behavior, and resize edges still take
precedence before starting a move.
2026-05-27 22:05:54 +02:00
Andreas Kling
972c19b292 UI/Qt: Remove icons from menus
Let application actions opt out of icon creation when created for
menus. Use that path for browser menus, tab context menus, and
WebView-backed popup menus.

Keep icon creation for toolbar and bookmarks bar actions, where the
same helper still provides visible button icons. Remove the icon setup
that is now only used by menu actions, and shrink popup menu item
padding now that there is no icon column.
2026-05-27 22:05:54 +02:00
Andreas Kling
7e034608ef UI/Qt: Style the menu bar
Add a QMenuBar stylesheet that uses the same chrome palette as the tab
strip and navigation toolbar. Apply it from BrowserWindow and refresh it
when the palette changes so the optional menu bar matches the frameless
window chrome.
2026-05-27 22:05:54 +02:00
Andreas Kling
e0e8460c47 UI: Update page visibility when switching tabs
Send hidden and visible system visibility updates from explicit tab
switch paths instead of relying only on widget show and hide events. Tab
containers can keep inactive web views mapped, which leaves documents
visible from WebContent's perspective and lets animated images keep
running in background tabs.

Use AppKit window occlusion state rather than the app-wide active tab.
That keeps still-visible background windows in the visible document
state. Avoid resending duplicate visibility updates from
ViewImplementation so existing widget visibility notifications remain
harmless.
2026-05-27 18:44:42 +02:00
Timothy Flynn
3b14addb14 UI/Qt: Use QString format helper in various components 2026-05-26 15:17:56 -04:00
Timothy Flynn
8ccdea63f5 UI/Qt: Apply a stylesheet to the devtools status bar 2026-05-26 13:06:54 -04:00
Andreas Kling
fa1896c2c9 UI/Qt: Refine chrome icon rendering
Draw back and forward icons as filled stroked paths so the arrow tips do
not accumulate alpha where segments meet. Increase their apparent size,
shift the menu glyph down slightly, and raise the new tab icon to align
with the tab strip.
2026-05-26 15:20:59 +02:00
Tim Ledbetter
91cd6e85c9 UI/Qt: Use parent maximization state when detaching to a new window 2026-05-26 09:07:57 +02:00
Andreas Kling
3adeed9581 UI/Qt: Polish browser chrome appearance
Refine the material colors, tab integration, toolbar spacing, and
custom glyphs used by the Qt browser chrome. Keep the visual density
compact while making the controls feel clearer and less toolkit-like.
Mark the window opaque and show resize cursors for frameless chrome.
2026-05-26 01:18:51 +02:00
Andreas Kling
6aeec196f0 UI/Qt: Support dragging tabs between windows
Allow custom Qt tabs to be reordered, detached, and reparented to
other browser windows while preserving the existing tab state. Draw a
full-tab drag preview and keep tab drags from being interpreted as
frameless window moves.
2026-05-26 01:18:51 +02:00
Andreas Kling
328d89f3c1 UI/Qt: Draw custom browser window chrome
Add shared chrome styling helpers and use them to paint the Linux
browser tab strip and surrounding toolbar widgets. Make the browser
window frameless on Qt so the tabs, toolbar, and window controls can
share one integrated chrome surface.
2026-05-26 01:18:51 +02:00
Andreas Kling
9f8d4fdb3b UI: Mirror loading state in tab icons
Show visible tab icons as loading while the focused location field
keeps its existing page-level loading state. Cache the favicon under the
spinner so each tab restores its page icon when loading finishes.

Reuse the Qt spinner drawing for the location field and tab strip, and
draw the AppKit spinner into the attributed tab title.
2026-05-20 09:37:33 +02:00
Sam Atkins
f489a8e1d0 UI/Qt: Copy window size and maximized state for new windows
Create new windows with the size of the previously active window, and
maximized if it was maximized. This matches the behaviour of other
browsers, and solves an annoying issue where new windows would always
be tiny.

Application::new_window() now takes a WindowConfiguration struct that
lets you specify the position, size, and maximized-ness of the window.
All previous callers of new_window() now use this instead of modifying
the window state afterwards.

WindowConfiguration is slightly awkwardly broken up into individual x/y
and width/height fields instead of a position and a size, for the sake
of compatibility with HTML::WebViewHints.
2026-05-13 11:04:20 +01:00
Sam Atkins
f0cb7d9a6f UI/Qt: Add functionality for reopening recently-closed tabs
Record when we close a tab, and map Ctrl+Shift+T to an action that opens
the most recently closed one.
2026-05-13 11:03:41 +01:00
Shehab Ahmed
f6a009e757 UI/Qt: Add a tooltip for the close tab button 2026-05-10 10:45:11 -04:00
Timothy Flynn
b221d7fe8b LibWeb+LibWebView+WebContent+UI: Add an action to cut text 2026-05-07 09:13:06 -04:00
Andreas Kling
1572429541 UI/Qt: Restore focus when activating a tab
Restore the active tab's remembered focus widget when switching tabs.
If the tab has no remembered focused child, fall back to the web
view so keyboard scrolling works immediately in tabs opened from
links.

This keeps the existing new-tab location bar behavior while making
background-opened pages respond to keyboard inputs as soon as they
are activated.
2026-04-17 08:06:24 +02:00
CalebC48
c35c29993a UI/Qt: Pass new tab page URL when creating a new window 2026-04-15 15:12:01 -04:00
Jonathan
bbb6653c4f UI/Qt: Add Ctrl+Tab and Ctrl+Shift+Tab for tab navigation
In addition to Ctrl+PageDown and Ctrl+PageUp, also support Ctrl+Tab and
Ctrl+Shift+Tab to switch between browser tabs. This is the common
behavior in other browsers.
2026-04-01 11:53:15 +01:00
Timothy Flynn
2b9cce8f62 UI/Qt: Create a bookmarks application menu and toolbar 2026-03-24 12:04:50 -04:00
Timothy Flynn
7e3bb9d984 UI/Qt: Replace QTabWidget with a custom TabWidget composition
QTabWidget's built-in tab bar management made it difficult to properly
position the new tab button, and caused visual artifacts with the
separator line across themes.

Replace QTabWidget with a custom TabWidget that places a QTabBar
alongside an explicit new tab button. This us gives full control over
the tab bar row layout.
2026-03-18 18:39:53 -04:00
Zaggy1024
ac69815740 Everywhere: Add an is_fullscreen parameter to set_viewport
This will be used by the UIs to notify WebContent when fullscreen for
content is entered or exited.
2026-03-17 18:58:37 -05:00
Zaggy1024
d22bd7334a UI/Qt: Don't trigger fully_exit_fullscreen() when WebContent initiated
If WebContent requested a fullscreen exit, then this is a no-op anyway.
2026-03-17 18:58:37 -05:00
Timothy Flynn
ebaad09b1b UI/Qt: Correctly adjust hamburger menu positioning on first open
The HamburgerMenu subclass overrode showEvent() to reposition the menu
using move() after QMenu::popup() had already shown it. On the first
open, rect().width() could return a stale value, causing the menu to
appear detached from the button and truncated to a single item. The
move() call also bypassed Qt's screen boundary adjustments.

Instead, we can replace the HamburgerMenu with a normal QMenu, and use a
custom HamburgerButton class for the menu's tool button. In this class,
we override mousePressEvent() to call popup() with the correct right-
aligned position before the menu is shown. This lets Qt manage sizing
and screen boundaries correctly.
2026-03-17 07:12:05 -04:00
Simon Farre
25eef2e6e6 UI/Qt: Add interface for exiting fullscreen
This adds the following features to the Qt UI:
- An "exit fullscreen" button that displays when entering fullscreen
  This will disappear after a certain amount of time. Moving the
  cursor to the top of the screen will make it reappear.
- Switching tabs exits fullscreen

The look and feel of this is preliminary and should be expanded upon
in the future.
2026-02-23 18:44:26 +00:00