aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-07-14 09:30:55 +0100
committerPeter Maydell <peter.maydell@linaro.org>2022-07-14 09:30:55 +0100
commit08c9f7eec7002dac2da52c8265eb319aba381c86 (patch)
tree725d472a7aef24ce2b864894cba795fdc8a67d36 /ui
parent455c62d85f72037ea3ca4b709ad73965c65158b2 (diff)
parent50b13d31f4cc6c70330cc3a92561a581fc176ec9 (diff)
downloadqemu-08c9f7eec7002dac2da52c8265eb319aba381c86.zip
qemu-08c9f7eec7002dac2da52c8265eb319aba381c86.tar.gz
qemu-08c9f7eec7002dac2da52c8265eb319aba381c86.tar.bz2
Merge tag 'darwin-20220712' of https://github.com/philmd/qemu into staging
Darwin patches: - Enable RDTSCP support on HVF - ui/cocoa: Take refresh rate into account Few buildsys fixes: - Restrict TCG to emulation - Remove a unused-but-set-variable warning - Allow running Avocado from pseudo-"in source tree" builds # gpg: Signature made Tue 12 Jul 2022 23:14:37 BST # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * tag 'darwin-20220712' of https://github.com/philmd/qemu: avocado: Fix BUILD_DIR if it's equal to SOURCE_DIR ui/cocoa: Take refresh rate into account ui/cocoa: Fix switched_to_fullscreen warning configure: Restrict TCG to emulation hvf: Enable RDTSCP support Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/cocoa.m20
1 files changed, 12 insertions, 8 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 6a4dccff..5a8bd5d 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -561,8 +561,20 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven
CGDirectDisplayID display = [[description objectForKey:@"NSScreenNumber"] unsignedIntValue];
NSSize screenSize = [[[self window] screen] frame].size;
CGSize screenPhysicalSize = CGDisplayScreenSize(display);
+ CVDisplayLinkRef displayLink;
frameSize = isFullscreen ? screenSize : [self frame].size;
+
+ if (!CVDisplayLinkCreateWithCGDisplay(display, &displayLink)) {
+ CVTime period = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(displayLink);
+ CVDisplayLinkRelease(displayLink);
+ if (!(period.flags & kCVTimeIsIndefinite)) {
+ update_displaychangelistener(&dcl,
+ 1000 * period.timeValue / period.timeScale);
+ info.refresh_rate = (int64_t)1000 * period.timeScale / period.timeValue;
+ }
+ }
+
info.width_mm = frameSize.width / screenSize.width * screenPhysicalSize.width;
info.height_mm = frameSize.height / screenSize.height * screenPhysicalSize.height;
} else {
@@ -800,7 +812,6 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven
int buttons = 0;
int keycode = 0;
bool mouse_event = false;
- static bool switched_to_fullscreen = false;
// Location of event in virtual screen coordinates
NSPoint p = [self screenLocationOfEvent:event];
NSUInteger modifiers = [event modifierFlags];
@@ -952,13 +963,6 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven
// forward command key combos to the host UI unless the mouse is grabbed
if (!isMouseGrabbed && ([event modifierFlags] & NSEventModifierFlagCommand)) {
- /*
- * Prevent the command key from being stuck down in the guest
- * when using Command-F to switch to full screen mode.
- */
- if (keycode == Q_KEY_CODE_F) {
- switched_to_fullscreen = true;
- }
return false;
}