From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/event.c | 1 + dlls/winex11.drv/window.c | 36 ++++++++++++++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 4 +++- 3 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index de9d9e21abf..21bc5fc2813 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1081,6 +1081,7 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
pos = root_to_virtual_screen( pos.x, pos.y ); SetRect( &rect, pos.x, pos.y, pos.x + event->width, pos.y + event->height ); + window_configure_notify( data, event->serial, &rect );
if (!data->mapped || data->iconic) goto done; if (!data->whole_window || !data->managed) goto done; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 11304531f69..fbb40a61ee4 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1299,6 +1299,7 @@ static void window_set_config( struct x11drv_win_data *data, const RECT *new_rec mask |= CWStackMode; }
+ data->pending_state.rect = *new_rect; data->configure_serial = NextRequest( data->display ); TRACE( "window %p/%lx, requesting config %s above %u, serial %lu\n", data->hwnd, data->whole_window, wine_dbgstr_rect(new_rect), above, data->configure_serial ); @@ -1554,6 +1555,38 @@ void window_net_wm_state_notify( struct x11drv_win_data *data, unsigned long ser *expect_serial = 0; }
+void window_configure_notify( struct x11drv_win_data *data, unsigned long serial, const RECT *value ) +{ + RECT *pending = &data->pending_state.rect, *current = &data->current_state.rect; + unsigned long *expect_serial = &data->configure_serial; + const char *reason = NULL, *expected, *received; + + received = wine_dbg_sprintf( "config %s/%lu", wine_dbgstr_rect(value), serial ); + expected = *expect_serial ? wine_dbg_sprintf( ", expected %s/%lu", wine_dbgstr_rect(pending), *expect_serial ) : ""; + + if (serial < *expect_serial) reason = "old "; + else if (!*expect_serial && EqualRect( current, value )) reason = "no-op "; + + if (reason) + { + WARN( "Ignoring window %p/%lx %s%s%s\n", data->hwnd, data->whole_window, reason, received, expected ); + return; + } + + if (!*expect_serial) reason = "unexpected "; + else if (EqualRect( pending, value )) reason = "mismatch "; + + if (!reason) TRACE( "window %p/%lx, %s%s\n", data->hwnd, data->whole_window, received, expected ); + else + { + WARN( "window %p/%lx, %s%s%s\n", data->hwnd, data->whole_window, reason, received, expected ); + *pending = *value; /* avoid requesting the same state again */ + } + + *current = *value; + *expect_serial = 0; +} + /*********************************************************************** * make_window_embedded */ @@ -1916,6 +1949,8 @@ static void create_whole_window( struct x11drv_win_data *data ) cx, cy, 0, data->vis.depth, InputOutput, data->vis.visual, mask, &attr ); if (!data->whole_window) goto done; + SetRect( &data->current_state.rect, pos.x, pos.y, pos.x + cx, pos.y + cy ); + data->pending_state.rect = data->current_state.rect;
x11drv_xinput2_enable( data->display, data->whole_window ); set_initial_wm_hints( data->display, data->whole_window ); @@ -1978,6 +2013,7 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des memset( &data->current_state, 0, sizeof(data->current_state) ); data->wm_state_serial = 0; data->net_wm_state_serial = 0; + data->configure_serial = 0;
if (data->xic) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 05c8115d2e3..86749b1211f 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -606,6 +606,7 @@ struct window_state { UINT wm_state; UINT net_wm_state; + RECT rect; };
/* x11drv private window data */ @@ -635,7 +636,6 @@ struct x11drv_win_data int wm_state; /* current value of the WM_STATE property */ DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */ Window embedder; /* window id of embedder */ - unsigned long configure_serial; /* serial number of last configure request */ Pixmap icon_pixmap; Pixmap icon_mask; unsigned long *icon_bits; @@ -645,6 +645,7 @@ struct x11drv_win_data struct window_state current_state; /* window state tracking the current X11 state */ unsigned long wm_state_serial; /* serial of last pending WM_STATE request */ unsigned long net_wm_state_serial; /* serial of last pending _NET_WM_STATE request */ + unsigned long configure_serial; /* serial of last pending configure request */ };
extern struct x11drv_win_data *get_win_data( HWND hwnd ); @@ -660,6 +661,7 @@ extern void destroy_vk_surface( HWND hwnd );
extern void window_wm_state_notify( struct x11drv_win_data *data, unsigned long serial, UINT value ); extern void window_net_wm_state_notify( struct x11drv_win_data *data, unsigned long serial, UINT value ); +extern void window_configure_notify( struct x11drv_win_data *data, unsigned long serial, const RECT *rect ); extern void wait_for_withdrawn_state( HWND hwnd, BOOL set ); extern Window init_clip_window(void); extern void update_user_time( Time time );