Skip to content

Commit

Permalink
Only spawn Resized event when window size changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
TankOs committed May 8, 2015
1 parent 80214d1 commit 608b4fb
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/SFML/Window/Unix/WindowImplX11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1926,12 +1926,21 @@ bool WindowImplX11::processEvent(xcb_generic_event_t* windowEvent)
if (passEvent(windowEvent, reinterpret_cast<xcb_configure_notify_event_t*>(windowEvent)->window))
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);
Event event;
event.type = Event::Resized;
event.size.width = e->width;
event.size.height = e->height;
pushEvent(event);

if (e->width != m_previousSize.x || e->height != m_previousSize.y)
{
m_previousSize.x = e->width;
m_previousSize.y = e->height;

Event event;
event.type = Event::Resized;
event.size.width = e->width;
event.size.height = e->height;
pushEvent(event);
}
break;
}

Expand Down

0 comments on commit 608b4fb

Please sign in to comment.