From c2018ff466120ff2706c166ec66aea66ecea1683 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 20 Jan 2023 16:17:44 -0600 Subject: [PATCH] win32u: Allow separately storing the internal pixel format set by WGL_WINE_pixel_format_passthrough. --- dlls/win32u/ntuser_private.h | 1 + dlls/win32u/window.c | 10 +++++++--- dlls/wineandroid.drv/opengl.c | 2 +- dlls/winemac.drv/opengl.c | 3 ++- dlls/winex11.drv/opengl.c | 4 ++-- include/wine/gdi_driver.h | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 385e7c0ded5..5c337c722a7 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -90,6 +90,7 @@ typedef struct tagWND struct window_surface *surface; /* Window surface if any */ struct tagDIALOGINFO *dlgInfo; /* Dialog additional info (dialogs only) */ int pixel_format; /* Pixel format set by the graphics driver */ + int internal_pixel_format; /* Internal pixel format set via WGL_WINE_pixel_format_passthrough */ int cbWndExtra; /* class cbWndExtra at window creation */ DWORD_PTR userdata; /* User private data */ DWORD wExtra[1]; /* Window extra bytes */ diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index a3c46dfdf31..4db9d99884c 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1441,7 +1441,7 @@ LONG_PTR WINAPI NtUserSetWindowLongPtr( HWND hwnd, INT offset, LONG_PTR newval, return set_window_long( hwnd, offset, sizeof(LONG_PTR), newval, ansi ); } -BOOL win32u_set_window_pixel_format( HWND hwnd, int format ) +BOOL win32u_set_window_pixel_format( HWND hwnd, int format, BOOL internal ) { WND *win = get_win_ptr( hwnd ); @@ -1450,7 +1450,10 @@ BOOL win32u_set_window_pixel_format( HWND hwnd, int format ) WARN( "setting format %d on win %p not supported\n", format, hwnd ); return FALSE; } - win->pixel_format = format; + if (internal) + win->internal_pixel_format = format; + else + win->pixel_format = format; release_win_ptr( win ); update_window_state( hwnd ); @@ -1852,7 +1855,8 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, wine_server_add_data( req, extra_rects, sizeof(extra_rects) ); } if (new_surface) req->paint_flags |= SET_WINPOS_PAINT_SURFACE; - if (win->pixel_format) req->paint_flags |= SET_WINPOS_PIXEL_FORMAT; + if (win->pixel_format || win->internal_pixel_format) + req->paint_flags |= SET_WINPOS_PIXEL_FORMAT; if ((ret = !wine_server_call( req ))) { diff --git a/dlls/wineandroid.drv/opengl.c b/dlls/wineandroid.drv/opengl.c index 37e9c713fb1..c8b7bf85cfb 100644 --- a/dlls/wineandroid.drv/opengl.c +++ b/dlls/wineandroid.drv/opengl.c @@ -242,7 +242,7 @@ static BOOL set_pixel_format( HDC hdc, int format, BOOL allow_change ) release_gl_drawable( gl ); if (prev && prev != format && !allow_change) return FALSE; - if (win32u_set_window_pixel_format( hwnd, format )) return TRUE; + if (win32u_set_window_pixel_format( hwnd, format, FALSE )) return TRUE; destroy_gl_drawable( hwnd ); return FALSE; } diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c index d92276bf253..6f3c3b88155 100644 --- a/dlls/winemac.drv/opengl.c +++ b/dlls/winemac.drv/opengl.c @@ -1587,7 +1587,8 @@ static BOOL set_pixel_format(HDC hdc, int fmt, BOOL allow_reset) done: release_win_data(data); - if (ret && gl_surface_mode == GL_SURFACE_BEHIND) win32u_set_window_pixel_format(hwnd, fmt); + if (ret && gl_surface_mode == GL_SURFACE_BEHIND) + win32u_set_window_pixel_format(hwnd, fmt, FALSE); return ret; } diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 92768267bae..3006d1a2447 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1402,7 +1402,7 @@ static BOOL set_win_format( HWND hwnd, const struct wgl_pixel_format *format, BO XFlush( gdi_display ); release_gl_drawable( gl ); - win32u_set_window_pixel_format( hwnd, pixel_format_index( format )); + win32u_set_window_pixel_format( hwnd, pixel_format_index( format ), FALSE ); return TRUE; } @@ -1512,7 +1512,7 @@ void set_gl_drawable_parent( HWND hwnd, HWND parent ) else { destroy_gl_drawable( hwnd ); - win32u_set_window_pixel_format( hwnd, 0 ); + win32u_set_window_pixel_format( hwnd, 0, FALSE ); } release_gl_drawable( old ); } diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index eefefce695b..c492252d4ab 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -339,7 +339,7 @@ struct user_driver_funcs extern void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version ); -extern BOOL win32u_set_window_pixel_format( HWND hwnd, int format ); +extern BOOL win32u_set_window_pixel_format( HWND hwnd, int format, BOOL internal ); extern int win32u_get_window_pixel_format( HWND hwnd ); #endif /* WINE_UNIX_LIB */