Skip to content

Commit

Permalink
x11: fixed incorrect SDL_GetWindowPosition() after resize (thanks, Ja…
Browse files Browse the repository at this point in the history
…son!).

Fixes Bugzilla #3272.
  • Loading branch information
icculus committed Sep 30, 2016
1 parent 4f4c4b6 commit b2510d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -842,6 +842,20 @@ X11_DispatchEvent(_THIS)
xevent.xconfigure.x, xevent.xconfigure.y,
xevent.xconfigure.width, xevent.xconfigure.height);
#endif
/* Real configure notify events are relative to the parent, synthetic events are absolute. */
if (!xevent.xconfigure.send_event) {
unsigned int NumChildren;
Window ChildReturn, Root, Parent;
Window * Children;
/* Translate these coodinates back to relative to root */
X11_XQueryTree(data->videodata->display, xevent.xconfigure.window, &Root, &Parent, &Children, &NumChildren);
X11_XTranslateCoordinates(xevent.xconfigure.display,
Parent, DefaultRootWindow(xevent.xconfigure.display),
xevent.xconfigure.x, xevent.xconfigure.y,
&xevent.xconfigure.x, &xevent.xconfigure.y,
&ChildReturn);
}

if (xevent.xconfigure.x != data->last_xconfigure.x ||
xevent.xconfigure.y != data->last_xconfigure.y) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
Expand Down
1 change: 1 addition & 0 deletions src/video/x11/SDL_x11sym.h
Expand Up @@ -161,6 +161,7 @@ SDL_X11_SYM(SDL_X11_XSynchronizeRetType,XSynchronize,(Display* a,Bool b),(a,b),r
SDL_X11_SYM(SDL_X11_XESetWireToEventRetType,XESetWireToEvent,(Display* a,int b,SDL_X11_XESetWireToEventRetType c),(a,b,c),return)
SDL_X11_SYM(SDL_X11_XESetEventToWireRetType,XESetEventToWire,(Display* a,int b,SDL_X11_XESetEventToWireRetType c),(a,b,c),return)
SDL_X11_SYM(void,XRefreshKeyboardMapping,(XMappingEvent *a),(a),)
SDL_X11_SYM(int,XQueryTree,(Display* a,Window b,Window* c,Window* d,Window** e,unsigned int* f),(a,b,c,d,e,f),return)

#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
SDL_X11_SYM(Bool,XGetEventData,(Display* a,XGenericEventCookie* b),(a,b),return)
Expand Down

3 comments on commit b2510d9

@12oclocker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in 8 weeks it will be 2024, this was fixed in 2016. It has been almost 7 years. Can someone that is on the SDL team and/or on the debian team please get debian to include a newer SDL that includes this fix. It would be greatly appreciated.

@slouken
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we have no control over Debian's release schedule and they tend to be conservative in what they pull in. You might try Debian experimental, which usually has the latest bits of everything.

@12oclocker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the tip!

Please sign in to comment.