mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
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
This commit is contained in:
parent
bf3da11d26
commit
631bcc8c5f
@ -37,6 +37,19 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
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 sf
|
||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
@ -340,7 +353,16 @@ WindowImplX11::~WindowImplX11()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Check if there's an active context on the current thread
|
/// 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()
|
bool WindowImplX11::IsContextActive()
|
||||||
{
|
{
|
||||||
return glXGetCurrentContext() != NULL;
|
return glXGetCurrentContext() != NULL;
|
||||||
@ -373,7 +395,7 @@ void WindowImplX11::ProcessEvents()
|
|||||||
|
|
||||||
// Process any event in the queue matching our window
|
// Process any event in the queue matching our window
|
||||||
XEvent Event;
|
XEvent Event;
|
||||||
while (XCheckWindowEvent(ourDisplay, myWindow, ourEventMask, &Event))
|
while (XCheckIfEvent(ourDisplay, &Event, &CheckEvent, reinterpret_cast<XPointer>(myWindow)))
|
||||||
{
|
{
|
||||||
// Detect repeated key events
|
// Detect repeated key events
|
||||||
if ((Event.type == KeyPress) || (Event.type == KeyRelease))
|
if ((Event.type == KeyPress) || (Event.type == KeyRelease))
|
||||||
|
Loading…
Reference in New Issue
Block a user