In apply_window_pos, to notify any parent or children and let them make the necessary changes for offscreen rendering.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/init.c | 2 +- dlls/winex11.drv/window.c | 8 ++------ dlls/winex11.drv/x11drv.h | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 1ea51e9a387..f468898cacb 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -448,8 +448,8 @@ Window x11drv_client_surface_create( HWND hwnd, int format, struct client_surfac if (!(surface = client_surface_create( sizeof(*surface), &x11drv_client_surface_funcs, hwnd ))) goto failed; surface->colormap = colormap;
- if (!(surface->window = create_client_window( hwnd, &visual, colormap ))) goto failed; if (!NtUserGetClientRect( hwnd, &surface->rect, NtUserGetDpiForWindow( hwnd ) )) goto failed; + if (!(surface->window = create_client_window( hwnd, surface->rect, &visual, colormap ))) goto failed;
TRACE( "Created %s for client window %lx\n", debugstr_client_surface( &surface->client ), surface->window ); *client = &surface->client; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 21a6a58ba4b..650dcf12cfa 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2362,13 +2362,12 @@ void destroy_client_window( HWND hwnd, Window client_window ) /********************************************************************** * create_client_window */ -Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap ) +Window create_client_window( HWND hwnd, RECT client_rect, const XVisualInfo *visual, Colormap colormap ) { struct x11drv_win_data *data = get_win_data( hwnd ); XSetWindowAttributes attr; Window ret; int x, y, cx, cy; - RECT client_rect;
if (!data) { @@ -2376,8 +2375,7 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colo HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); if (parent == NtUserGetDesktopWindow() || NtUserGetAncestor( parent, GA_PARENT )) return 0; if (!(data = alloc_win_data( thread_init_display(), hwnd ))) return 0; - NtUserGetClientRect( hwnd, &data->rects.client, NtUserGetWinMonitorDpi( hwnd, MDT_RAW_DPI ) ); - data->rects.window = data->rects.visible = data->rects.client; + data->rects.window = data->rects.visible = data->rects.client = client_rect; }
detach_client_window( data, data->client_window ); @@ -2390,8 +2388,6 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colo
x = data->rects.client.left - data->rects.visible.left; y = data->rects.client.top - data->rects.visible.top; - - NtUserGetClientRect( hwnd, &client_rect, NtUserGetDpiForWindow( hwnd ) ); cx = min( max( 1, client_rect.right - client_rect.left ), 65535 ); cy = min( max( 1, client_rect.bottom - client_rect.top ), 65535 );
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index e08a7a85652..9232988c9c7 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -723,7 +723,7 @@ extern Window init_clip_window(void); extern void window_set_user_time( struct x11drv_win_data *data, Time time, BOOL init ); extern UINT get_window_net_wm_state( Display *display, Window window ); extern void make_window_embedded( struct x11drv_win_data *data ); -extern Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap ); +extern Window create_client_window( HWND hwnd, RECT client_rect, const XVisualInfo *visual, Colormap colormap ); extern void detach_client_window( struct x11drv_win_data *data, Window client_window ); extern void attach_client_window( struct x11drv_win_data *data, Window client_window ); extern void destroy_client_window( HWND hwnd, Window client_window );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/opengl.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 93eef753b78..e945b14b3b1 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -529,11 +529,8 @@ static BOOL x11drv_egl_surface_create( HWND hwnd, int format, struct opengl_draw struct client_surface *client; struct gl_drawable *gl; Window window; - RECT rect;
if ((previous = *drawable) && previous->format == format) return TRUE; - NtUserGetClientRect( hwnd, &rect, NtUserGetDpiForWindow( hwnd ) ); - if (!(window = x11drv_client_surface_create( hwnd, format, &client ))) return FALSE; gl = opengl_drawable_create( sizeof(*gl), &x11drv_egl_surface_funcs, format, client ); client_surface_release( client ); @@ -969,11 +966,8 @@ static BOOL x11drv_surface_create( HWND hwnd, int format, struct opengl_drawable struct client_surface *client; struct gl_drawable *gl; Window window; - RECT rect;
if ((previous = *drawable) && previous->format == format) return TRUE; - NtUserGetClientRect( hwnd, &rect, NtUserGetDpiForWindow( hwnd ) ); - if (!(window = x11drv_client_surface_create( hwnd, format, &client ))) return FALSE; gl = opengl_drawable_create( sizeof(*gl), &x11drv_surface_funcs, format, client ); client_surface_release( client );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/init.c | 31 ++++++++++++++++++++++++------- dlls/winex11.drv/window.c | 28 ---------------------------- 2 files changed, 24 insertions(+), 35 deletions(-)
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index f468898cacb..49c4bb7b3fa 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -261,6 +261,7 @@ static const struct client_surface_funcs x11drv_client_surface_funcs; struct x11drv_client_surface { struct client_surface client; + XWindowChanges changes; Colormap colormap; Window window; RECT rect; @@ -303,17 +304,33 @@ static void x11drv_client_surface_detach( struct client_surface *client ) } }
-static void client_surface_update_size( HWND hwnd, struct x11drv_client_surface *surface ) +static void client_surface_update_geometry( HWND hwnd, struct x11drv_client_surface *surface ) { - XWindowChanges changes; + XWindowChanges changes = surface->changes; + struct x11drv_win_data *data; + int mask = 0; RECT rect;
if (!NtUserGetClientRect( hwnd, &rect, NtUserGetDpiForWindow( hwnd ) )) return; - if (EqualRect( &surface->rect, &rect )) return; - + if (!ReadNoFence( &surface->client.offscreen ) && (data = get_win_data( hwnd ))) + { + changes.x = data->rects.client.left - data->rects.visible.left; + changes.y = data->rects.client.top - data->rects.visible.top; + release_win_data( data ); + } changes.width = min( max( 1, rect.right ), 65535 ); changes.height = min( max( 1, rect.bottom ), 65535 ); - XConfigureWindow( gdi_display, surface->window, CWWidth | CWHeight, &changes ); + + if (changes.x != surface->changes.x) mask |= CWX; + if (changes.y != surface->changes.y) mask |= CWY; + if (changes.width != surface->changes.width) mask |= CWWidth; + if (changes.height != surface->changes.height) mask |= CWHeight; + if (!mask) return; + + surface->changes = changes; + TRACE( "client window %p/%lx, requesting position %d,%d size %d,%d mask %#x\n", hwnd, + surface->window, changes.x, changes.y, changes.width, changes.height, mask ); + XConfigureWindow( gdi_display, surface->window, mask, &changes ); surface->rect = rect; }
@@ -377,7 +394,7 @@ static void x11drv_client_surface_update( struct client_surface *client )
TRACE( "%s\n", debugstr_client_surface( client ) );
- client_surface_update_size( hwnd, surface ); + client_surface_update_geometry( hwnd, surface ); client_surface_update_offscreen( hwnd, surface ); }
@@ -392,7 +409,7 @@ static void X11DRV_client_surface_present( struct client_surface *client, HDC hd
TRACE( "%s\n", debugstr_client_surface( client ) );
- client_surface_update_size( hwnd, surface ); + client_surface_update_geometry( hwnd, surface ); client_surface_update_offscreen( hwnd, surface );
if (!hdc) return; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 650dcf12cfa..92a96fd70cc 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2146,32 +2146,6 @@ static void sync_window_position( struct x11drv_win_data *data, UINT swp_flags, }
-/*********************************************************************** - * sync_client_position - * - * Synchronize the X client window position with the Windows one - */ -static void sync_client_position( struct x11drv_win_data *data, const struct window_rects *old_rects ) -{ - int mask = 0; - XWindowChanges changes; - - if (!data->client_window) return; - - changes.x = data->rects.client.left - data->rects.visible.left; - changes.y = data->rects.client.top - data->rects.visible.top; - if (changes.x != old_rects->client.left - old_rects->visible.left) mask |= CWX; - if (changes.y != old_rects->client.top - old_rects->visible.top) mask |= CWY; - - if (mask) - { - TRACE( "setting client win %lx pos %d,%d changes=%x\n", - data->client_window, changes.x, changes.y, mask ); - XConfigureWindow( gdi_display, data->client_window, mask, &changes ); - } -} - - /*********************************************************************** * move_window_bits * @@ -3296,8 +3270,6 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UIN
XFlush( gdi_display ); /* make sure painting is done before we move the window */
- sync_client_position( data, &old_rects ); - if (!data->whole_window) { release_win_data( data );
From: Rémi Bernon rbernon@codeweavers.com
In apply_window_pos, to notify any parent or children and let them make the necessary changes for offscreen rendering. --- dlls/win32u/window.c | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 340ab31e857..fa717c00d09 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1592,24 +1592,6 @@ int get_window_pixel_format( HWND hwnd ) return ret; }
-static int window_has_client_surface( HWND hwnd ) -{ - struct client_surface *surface; - WND *win = get_win_ptr( hwnd ); - BOOL ret; - - if (!win || win == WND_DESKTOP || win == WND_OTHER_PROCESS) return FALSE; - ret = win->pixel_format || win->current_drawable; - release_win_ptr( win ); - if (ret) return TRUE; - - pthread_mutex_lock( &surfaces_lock ); - LIST_FOR_EACH_ENTRY( surface, &client_surfaces, struct client_surface, entry ) - if ((ret = surface->hwnd == hwnd)) break; - pthread_mutex_unlock( &surfaces_lock ); - return ret; -} - /*********************************************************************** * NtUserGetProp (win32u.@) * @@ -2126,20 +2108,16 @@ static struct window_surface *get_window_surface( HWND hwnd, UINT swp_flags, BOO return new_surface; }
-static void update_children_window_state( HWND hwnd ) +static void update_window_client_surfaces( HWND hwnd ) { HWND *children; int i;
if (!(children = list_window_children( hwnd ))) return; - - for (i = 0; children[i]; i++) - { - if (!window_has_client_surface( children[i] )) continue; - update_window_state( children[i] ); - } - + for (i = 0; children[i]; i++) update_window_client_surfaces( children[i] ); free( children ); + + update_client_surfaces( hwnd ); }
static HICON get_icon_info( HICON icon, ICONINFO *ii ) @@ -2345,9 +2323,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru
user_driver->pWindowPosChanged( hwnd, insert_after, owner_hint, swp_flags, &monitor_rects, get_driver_window_surface( new_surface, raw_dpi ) ); - update_client_surfaces( hwnd ); - - update_children_window_state( hwnd ); + update_window_client_surfaces( surface_win ); }
return ret;