From 0a49541340914214719dc23897b6c2de0f8cb50d Mon Sep 17 00:00:00 2001 From: Todd White Date: Thu, 6 Aug 2026 11:26:19 -0400 Subject: [PATCH] Fix: place the main menu at the origin of the screen's visible frame -[NSMenu _setGeometry] placed the main menu at x 0, and the vertical branch placed it at visibleFrame.size.height less the menu height. Both drop the frame's origin, which is not zero when a window manager reserves part of the screen and the backend reports the remainder. Measured on a 1920x1080 screen. With a dock 64 columns wide down the left edge the screen frame is 64,0 1856x1080 and the menu was mapped at X column 0, underneath the dock; it is now mapped at column 64. With a panel 40 rows deep at the bottom the frame is 0,40 1920x1040 and the menu top edge was 1040 against a frame top of 1080, leaving usable rows empty above it; it is now flush with the top. The horizontal branch already added screenFrame.origin.y, and NSMaxY keeps that result while correcting x. A work area origin in y needs the backend change in gnustep/libs-back#226; the x case is reached without it. --- Source/NSMenu.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/NSMenu.m b/Source/NSMenu.m index ee6e306fc6..d0a5949341 100644 --- a/Source/NSMenu.m +++ b/Source/NSMenu.m @@ -271,10 +271,9 @@ - (void) _setGeometry { NSRect screenFrame = [[NSScreen mainScreen] frame]; - NSRect proposedFrame = NSMakeRect(0, - screenFrame.size.height - - [_aWindow frame].size.height + - screenFrame.origin.y, + NSRect proposedFrame = NSMakeRect(NSMinX(screenFrame), + NSMaxY(screenFrame) - + [_aWindow frame].size.height, screenFrame.size.width, [_aWindow frame].size.height); proposedFrame = [[GSTheme theme] modifyRect: proposedFrame @@ -312,9 +311,10 @@ - (void) _setGeometry if ((_aWindow != nil) && ([_aWindow screen] != nil)) { - NSPoint origin = NSMakePoint(0, [[_aWindow screen] visibleFrame].size.height - - [_aWindow frame].size.height); - + NSRect visible = [[_aWindow screen] visibleFrame]; + NSPoint origin = NSMakePoint(NSMinX(visible), + NSMaxY(visible) - [_aWindow frame].size.height); + [_aWindow setFrameOrigin: origin]; [_bWindow setFrameOrigin: origin]; }