diff mbox series

[v12,05/10] ui/cocoa: Fix pause label coordinates

Message ID 20240224-cocoa-v12-5-e89f70bdda71@daynix.com
State New
Headers show
Series ui/cocoa: Use NSWindow's ability to resize | expand

Commit Message

Akihiko Odaki Feb. 24, 2024, 12:43 p.m. UTC
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>
---
 ui/cocoa.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Peter Maydell Feb. 26, 2024, 5:01 p.m. UTC | #1
On Sat, 24 Feb 2024 at 12:43, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> 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>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox series

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 644fd32eaa4d..df8072479c82 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1432,8 +1432,8 @@  - (void)displayPause
 {
     /* 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)];