ui/cocoa: Fix pause label coordinates

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>
This commit is contained in:
Akihiko Odaki 2024-02-24 21:43:36 +09:00 committed by Philippe Mathieu-Daudé
parent fcb03de7e1
commit 1a4b64a5f5

View 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)];