Keep track of the configure events we've received from the X server.
When programmatically resizing a window on Unity 3D, we'll get a move event with the old size before we get a size event with the new size, and we don't want to clobber our internal state with the old size.
This commit is contained in:
parent
670eb787d6
commit
28fc0e9923
2 changed files with 15 additions and 6 deletions
|
@ -365,15 +365,23 @@ X11_DispatchEvent(_THIS)
|
||||||
/* Have we been resized or moved? */
|
/* Have we been resized or moved? */
|
||||||
case ConfigureNotify:{
|
case ConfigureNotify:{
|
||||||
#ifdef DEBUG_XEVENTS
|
#ifdef DEBUG_XEVENTS
|
||||||
printf("window %p: ConfigureNotify! (resize: %dx%d)\n", data,
|
printf("window %p: ConfigureNotify! (position: %d,%d, size: %dx%d)\n", data,
|
||||||
|
xevent.xconfigure.x, xevent.xconfigure.y,
|
||||||
xevent.xconfigure.width, xevent.xconfigure.height);
|
xevent.xconfigure.width, xevent.xconfigure.height);
|
||||||
#endif
|
#endif
|
||||||
|
if (xevent.xconfigure.x != data->last_xconfigure.x ||
|
||||||
|
xevent.xconfigure.y != data->last_xconfigure.y) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
|
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
|
||||||
xevent.xconfigure.x, xevent.xconfigure.y);
|
xevent.xconfigure.x, xevent.xconfigure.y);
|
||||||
|
}
|
||||||
|
if (xevent.xconfigure.width != data->last_xconfigure.width ||
|
||||||
|
xevent.xconfigure.height != data->last_xconfigure.height) {
|
||||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED,
|
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED,
|
||||||
xevent.xconfigure.width,
|
xevent.xconfigure.width,
|
||||||
xevent.xconfigure.height);
|
xevent.xconfigure.height);
|
||||||
}
|
}
|
||||||
|
data->last_xconfigure = xevent.xconfigure;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Have we been requested to quit (or another client message?) */
|
/* Have we been requested to quit (or another client message?) */
|
||||||
|
|
|
@ -55,6 +55,7 @@ typedef struct
|
||||||
SDL_bool created;
|
SDL_bool created;
|
||||||
PendingFocusEnum pending_focus;
|
PendingFocusEnum pending_focus;
|
||||||
Uint32 pending_focus_time;
|
Uint32 pending_focus_time;
|
||||||
|
XConfigureEvent last_xconfigure;
|
||||||
struct SDL_VideoData *videodata;
|
struct SDL_VideoData *videodata;
|
||||||
} SDL_WindowData;
|
} SDL_WindowData;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue