Fake resize events are no longer sent when the window is moved, on Linux

This commit is contained in:
Laurent Gomila 2013-05-18 20:48:55 +02:00
parent 83ffe11709
commit 68b51734a9
2 changed files with 17 additions and 7 deletions

View File

@ -72,7 +72,8 @@ m_isExternal (true),
m_atomClose (0),
m_oldVideoMode(-1),
m_hiddenCursor(0),
m_keyRepeat (true)
m_keyRepeat (true),
m_previousSize(-1, -1)
{
// Open a connection with the X server
m_display = OpenDisplay();
@ -101,7 +102,8 @@ m_isExternal (false),
m_atomClose (0),
m_oldVideoMode(-1),
m_hiddenCursor(0),
m_keyRepeat (true)
m_keyRepeat (true),
m_previousSize(-1, -1)
{
// Open a connection with the X server
m_display = OpenDisplay();
@ -647,11 +649,18 @@ bool WindowImplX11::processEvent(XEvent windowEvent)
// Resize event
case ConfigureNotify :
{
Event event;
event.type = Event::Resized;
event.size.width = windowEvent.xconfigure.width;
event.size.height = windowEvent.xconfigure.height;
pushEvent(event);
// ConfigureNotify can be triggered for other reasons, check if the size has acutally changed
if ((windowEvent.xconfigure.width != m_previousSize.x) || (windowEvent.xconfigure.height != m_previousSize.y))
{
Event event;
event.type = Event::Resized;
event.size.width = windowEvent.xconfigure.width;
event.size.height = windowEvent.xconfigure.height;
pushEvent(event);
m_previousSize.x = windowEvent.xconfigure.width;
m_previousSize.y = windowEvent.xconfigure.height;
}
break;
}

View File

@ -223,6 +223,7 @@ private :
Cursor m_hiddenCursor; ///< As X11 doesn't provide cursor hidding, we must create a transparent one
bool m_keyRepeat; ///< Is the KeyRepeat feature enabled ?
XEvent m_lastKeyReleaseEvent; ///< Last key release event we received (needed for discarding repeated key events)
Vector2i m_previousSize; ///< Previous size of the window, to find if a ConfigureNotify event is a resize event (could be a move event only)
};
} // namespace priv