[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] ui/cocoa: Fix mouse grabbing in fullscreen mode for
From: |
Chen Zhang |
Subject: |
[Qemu-devel] [PATCH] ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device |
Date: |
Thu, 21 Mar 2019 15:10:05 +0800 |
In fullscreen mode, the window property of cocoaView may not be the key
window, and the current implementation would not grab mouse in
fullscreen mode after left clicks on relative input devices.
This patch used isFullscreen value as a short-cirtuit condition for
relative input device grabbing.
Note that this patch should be tested after applying a previous patch
which fixed event location conversion for relative input devices.
Signed-off-by: Chen Zhang <address@hidden>
---
ui/cocoa.m | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 420b2411c1..51463bb931 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -862,7 +862,12 @@ QemuCocoaView *cocoaView;
case NSEventTypeLeftMouseUp:
mouse_event = true;
if (!isMouseGrabbed && [self screenContainsPoint:p]) {
- if([[self window] isKeyWindow]) {
+ /*
+ * In fullscreen mode, the window of cocoaView may not be the
+ * key window, therefore the position relative to the virtual
+ * screen alone will be sufficient.
+ */
+ if(isFullscreen || [[self window] isKeyWindow]) {
[self grabMouse];
}
}
--
2.19.2
- [Qemu-devel] [PATCH] ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device,
Chen Zhang <=