]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
ui/cocoa: Fix pause label coordinates
authorAkihiko Odaki <akihiko.odaki@daynix.com>
Sat, 24 Feb 2024 12:43:36 +0000 (21:43 +0900)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 5 Mar 2024 11:04:41 +0000 (12:04 +0100)
A subview is positioned in the superview so the superview's frame
should be used instead of one of the window to determine the
coordinates.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Tested-by: Rene Engel <ReneEngel80@emailn.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20240224-cocoa-v12-5-e89f70bdda71@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
ui/cocoa.m

index 6e8cd24e88c4c55a930e7ee32bb7825126b70ceb..a2e52ceabcdb0a0934740a84aa34e1840d629212 100644 (file)
@@ -1451,8 +1451,8 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven
 {
     /* Coordinates have to be calculated each time because the window can change its size */
     int xCoord, yCoord, width, height;
-    xCoord = ([normalWindow frame].size.width - [pauseLabel frame].size.width)/2;
-    yCoord = [normalWindow frame].size.height - [pauseLabel frame].size.height - ([pauseLabel frame].size.height * .5);
+    xCoord = ([cocoaView frame].size.width - [pauseLabel frame].size.width)/2;
+    yCoord = [cocoaView frame].size.height - [pauseLabel frame].size.height - ([pauseLabel frame].size.height * .5);
     width = [pauseLabel frame].size.width;
     height = [pauseLabel frame].size.height;
     [pauseLabel setFrame: NSMakeRect(xCoord, yCoord, width, height)];