Skip to content

Fix mode tab bar sizing on monitors with different DPI scale factors#360

Open
hendorog wants to merge 2 commits into
jankae:masterfrom
hendorog:dpi-tabbar-fixes
Open

Fix mode tab bar sizing on monitors with different DPI scale factors#360
hendorog wants to merge 2 commits into
jankae:masterfrom
hendorog:dpi-tabbar-fixes

Conversation

@hendorog

Copy link
Copy Markdown

Problem

The mode tab bar (embedded in the menu bar as a corner widget) gets its
height from menuBar()->height() once at startup and bakes it into a
stylesheet as a fixed pixel value. Two problems result:

  1. Moving the window to a monitor with a different DPI scale factor
    resizes the menu bar, but the tab bar keeps its startup height,
    breaking the menu bar layout.
  2. On fractional scale factors the captured height could feed back into
    the menu bar's own layout: the corner widget is inside the menu bar,
    so reading its height and writing it back caused unbounded growth of
    the menu/toolbar area.

Fix

  • Watch the menu bar for resize events (triggered by screen/DPI changes)
    and update the tab bar height dynamically.
  • Compute the target height from font metrics and style margins, which
    are DPI-aware but independent of the menu bar's current layout, so no
    feedback loop is possible. Skip the update when the height is
    unchanged.

Tested on Windows with a laptop display + two external monitors at
different scale factors: tab bar now tracks the menu bar height
correctly when dragging the window between monitors, with no growth
loop on fractional scaling.

hendorog and others added 2 commits June 13, 2026 11:30
Dynamically update the mode tab bar height when the menu bar resizes
due to screen DPI changes, instead of using a fixed pixel value
captured at startup. Previously, moving the window to a monitor with
a different scale factor left the tab bar at its original size,
breaking menu bar layout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The corner widget (tab bar) is embedded in the menu bar, so reading
menuBar()->height() and writing it back to the corner widget caused
infinite growth. Compute the target height from font metrics and
style margins instead, which are DPI-aware but independent of the
menu bar's current layout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant