x11: fixed incorrect SDL_GetWindowPosition() after resize (thanks, Jason!).

Fixes Bugzilla #3272.
This commit is contained in:
Ryan C. Gordon 2016-09-29 23:01:43 -04:00
parent 4f4c4b629f
commit b2510d9cbc
2 changed files with 15 additions and 0 deletions

View File

@ -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,

View File

@ -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)