winex11: Always generate ConfigureNotify events for embedded windows.

We won't receive a ConfigureNotify event if the embedded window has been
reparented without moving or resizing it. Top-level windows always
receive synthetic ConfigureNotify from the window manager.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57370
This commit is contained in:
Rémi Bernon 2024-11-13 15:52:41 +01:00 committed by Alexandre Julliard
parent 0bd49a68dc
commit ab40b7fd86
Notes: Alexandre Julliard 2024-11-14 23:13:45 +01:00
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6815

View file

@ -197,7 +197,8 @@ static void host_window_send_configure_events( struct host_window *win, Display
if (!XFindContext( configure.display, configure.window, winContext, (char **)&hwnd ) && if (!XFindContext( configure.display, configure.window, winContext, (char **)&hwnd ) &&
(data = get_win_data( hwnd ))) (data = get_win_data( hwnd )))
{ {
BOOL has_serial = data->wm_state_serial || data->configure_serial; /* embedded windows won't receive synthetic ConfigureNotify and are positioned by the WM */
BOOL has_serial = !data->embedded && (data->wm_state_serial || data->configure_serial);
release_win_data( data ); release_win_data( data );
if (has_serial) continue; if (has_serial) continue;
} }
@ -211,10 +212,8 @@ static void host_window_send_configure_events( struct host_window *win, Display
static BOOL host_window_filter_event( XEvent *event, XEvent *previous ) static BOOL host_window_filter_event( XEvent *event, XEvent *previous )
{ {
struct host_window *win; struct host_window *win;
RECT old_rect;
if (!(win = get_host_window( event->xany.window, FALSE ))) return FALSE; if (!(win = get_host_window( event->xany.window, FALSE ))) return FALSE;
old_rect = win->rect;
switch (event->type) switch (event->type)
{ {
@ -227,6 +226,7 @@ static BOOL host_window_filter_event( XEvent *event, XEvent *previous )
XReparentEvent *reparent = (XReparentEvent *)event; XReparentEvent *reparent = (XReparentEvent *)event;
TRACE( "host window %p/%lx ReparentNotify, parent %lx\n", win, win->window, reparent->parent ); TRACE( "host window %p/%lx ReparentNotify, parent %lx\n", win, win->window, reparent->parent );
host_window_set_parent( win, reparent->parent ); host_window_set_parent( win, reparent->parent );
host_window_send_configure_events( win, event->xany.display, event->xany.serial, previous );
break; break;
} }
case GravityNotify: case GravityNotify:
@ -235,6 +235,7 @@ static BOOL host_window_filter_event( XEvent *event, XEvent *previous )
OffsetRect( &win->rect, gravity->x - win->rect.left, gravity->y - win->rect.top ); OffsetRect( &win->rect, gravity->x - win->rect.left, gravity->y - win->rect.top );
if (win->parent) win->rect = host_window_configure_child( win->parent, win->window, win->rect, FALSE ); if (win->parent) win->rect = host_window_configure_child( win->parent, win->window, win->rect, FALSE );
TRACE( "host window %p/%lx GravityNotify, rect %s\n", win, win->window, wine_dbgstr_rect(&win->rect) ); TRACE( "host window %p/%lx GravityNotify, rect %s\n", win, win->window, wine_dbgstr_rect(&win->rect) );
host_window_send_configure_events( win, event->xany.display, event->xany.serial, previous );
break; break;
} }
case ConfigureNotify: case ConfigureNotify:
@ -243,13 +244,11 @@ static BOOL host_window_filter_event( XEvent *event, XEvent *previous )
SetRect( &win->rect, configure->x, configure->y, configure->x + configure->width, configure->y + configure->height ); SetRect( &win->rect, configure->x, configure->y, configure->x + configure->width, configure->y + configure->height );
if (win->parent) win->rect = host_window_configure_child( win->parent, win->window, win->rect, configure->send_event ); if (win->parent) win->rect = host_window_configure_child( win->parent, win->window, win->rect, configure->send_event );
TRACE( "host window %p/%lx ConfigureNotify, rect %s\n", win, win->window, wine_dbgstr_rect(&win->rect) ); TRACE( "host window %p/%lx ConfigureNotify, rect %s\n", win, win->window, wine_dbgstr_rect(&win->rect) );
host_window_send_configure_events( win, event->xany.display, event->xany.serial, previous );
break; break;
} }
} }
if (old_rect.left != win->rect.left || old_rect.top != win->rect.top)
host_window_send_configure_events( win, event->xany.display, event->xany.serial, previous );
return TRUE; return TRUE;
} }