From 5fc2f24c97c59d3290dcb508cdbe37ccd88ffadf Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 1 Oct 2015 11:36:19 +0100 Subject: [PATCH] Fix for linux windows that don't respond to mouse events --- .../native/juce_linux_Windowing.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp index c010776ed9..4002f4cd66 100644 --- a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp @@ -2964,9 +2964,13 @@ private: CWBorderPixel | CWColormap | CWBackPixmap | CWEventMask | CWOverrideRedirect, &swa); + unsigned int buttonMask = EnterWindowMask | LeaveWindowMask | PointerMotionMask; + + if ((styleFlags & windowIgnoresMouseClicks) == 0) + buttonMask |= ButtonPressMask | ButtonReleaseMask; + XGrabButton (display, AnyButton, AnyModifier, windowH, False, - ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, - GrabModeAsync, GrabModeAsync, None, None); + buttonMask, GrabModeAsync, GrabModeAsync, None, None); // Set the window context to identify the window handle object if (XSaveContext (display, (XID) windowH, windowHandleXContext, (XPointer) this)) @@ -3036,11 +3040,12 @@ private: {} } - static int getAllEventsMask() noexcept + int getAllEventsMask() const noexcept { - return NoEventMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask + return NoEventMask | KeyPressMask | KeyReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | KeymapStateMask - | ExposureMask | StructureNotifyMask | FocusChangeMask; + | ExposureMask | StructureNotifyMask | FocusChangeMask + | ((styleFlags & windowIgnoresMouseClicks) != 0 ? (ButtonPressMask | ButtonReleaseMask) : 0); } template