summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/cocoa.m10
1 files changed, 9 insertions, 1 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 1554331..d76b942 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -724,7 +724,15 @@ QemuCocoaView *cocoaView;
}
if (mouse_event) {
- if (last_buttons != buttons) {
+ /* Don't send button events to the guest unless we've got a
+ * mouse grab or window focus. If we have neither then this event
+ * is the user clicking on the background window to activate and
+ * bring us to the front, which will be done by the sendEvent
+ * call below. We definitely don't want to pass that click through
+ * to the guest.
+ */
+ if ((isMouseGrabbed || [[self window] isKeyWindow]) &&
+ (last_buttons != buttons)) {
static uint32_t bmap[INPUT_BUTTON_MAX] = {
[INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON,
[INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON,
OpenPOWER on IntegriCloud