From 631bcc8c5f9e8d65d9b6e205c25fc8bb2251bd8c Mon Sep 17 00:00:00 2001 From: laurentgom Date: Sat, 21 Mar 2009 17:38:53 +0000 Subject: [PATCH] Fixed Event::Closed event (was broken after the fix to EnableKeyRepeat) git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1058 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/Window/Linux/WindowImplX11.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/SFML/Window/Linux/WindowImplX11.cpp b/src/SFML/Window/Linux/WindowImplX11.cpp index e63763d2..266be0a3 100644 --- a/src/SFML/Window/Linux/WindowImplX11.cpp +++ b/src/SFML/Window/Linux/WindowImplX11.cpp @@ -37,6 +37,19 @@ #include +namespace +{ + //////////////////////////////////////////////////////////// + /// Filter the events received by windows + /// (only allow those matching a specific window) + //////////////////////////////////////////////////////////// + Bool CheckEvent(::Display*, XEvent* Event, XPointer UserData) + { + // Just check if the event matches the window + return Event->xany.window == reinterpret_cast< ::Window >(UserData); + } +} + namespace sf { namespace priv @@ -340,7 +353,16 @@ WindowImplX11::~WindowImplX11() //////////////////////////////////////////////////////////// /// Check if there's an active context on the current thread +//////////////////// //////////////////////////////////////////////////////////// +/// Filter the received events +/// (only allow those matching a specific window) +//////////////////////////////////////////////////////////// +Bool CheckEvent(::Display*, XEvent* Event, XPointer UserData) +{ + // Just check if the event matches our window + return Event->xany.window == reinterpret_cast< ::Window >(UserData); +}//////////////////////////////////////// bool WindowImplX11::IsContextActive() { return glXGetCurrentContext() != NULL; @@ -373,7 +395,7 @@ void WindowImplX11::ProcessEvents() // Process any event in the queue matching our window XEvent Event; - while (XCheckWindowEvent(ourDisplay, myWindow, ourEventMask, &Event)) + while (XCheckIfEvent(ourDisplay, &Event, &CheckEvent, reinterpret_cast(myWindow))) { // Detect repeated key events if ((Event.type == KeyPress) || (Event.type == KeyRelease))