Only spawn Resized event when window size changes.

This commit is contained in:
Stefan Schindler 2015-05-08 11:27:44 +02:00
parent 80214d1cb9
commit 608b4fb28d

View File

@ -1926,12 +1926,21 @@ bool WindowImplX11::processEvent(xcb_generic_event_t* windowEvent)
if (passEvent(windowEvent, reinterpret_cast<xcb_configure_notify_event_t*>(windowEvent)->window)) if (passEvent(windowEvent, reinterpret_cast<xcb_configure_notify_event_t*>(windowEvent)->window))
return false; return false;
// X notifies about "window configuration events", which also includes moving a window only. Check
// for a different size and only spawn a Resized event when it differs.
xcb_configure_notify_event_t* e = reinterpret_cast<xcb_configure_notify_event_t*>(windowEvent); xcb_configure_notify_event_t* e = reinterpret_cast<xcb_configure_notify_event_t*>(windowEvent);
Event event;
event.type = Event::Resized; if (e->width != m_previousSize.x || e->height != m_previousSize.y)
event.size.width = e->width; {
event.size.height = e->height; m_previousSize.x = e->width;
pushEvent(event); m_previousSize.y = e->height;
Event event;
event.type = Event::Resized;
event.size.width = e->width;
event.size.height = e->height;
pushEvent(event);
}
break; break;
} }