From 8b3ad7348e41db4f63a9471bb32eff39376e6346 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 10 Jul 2017 19:53:53 +0200 Subject: [PATCH] cocoa: fix broken mouse events in fullscreen on macOS (LP 1500026) --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 6de003d2aa..ebc9255d63 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -277,7 +277,21 @@ process_events() { break; } - [NSApp sendEvent: event]; + // If we're in fullscreen mode, send mouse events directly to the window. + NSEventType type = [event type]; + if (_properties.get_fullscreen() && ( + type == NSLeftMouseDown || type == NSLeftMouseUp || + type == NSRightMouseDown || type == NSRightMouseUp || + type == NSOtherMouseDown || type == NSOtherMouseUp || + type == NSLeftMouseDragged || + type == NSRightMouseDragged || + type == NSOtherMouseDragged || + type == NSMouseMoved || + type == NSScrollWheel)) { + [_window sendEvent: event]; + } else { + [NSApp sendEvent: event]; + } } if (_window != nil) {