From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58846 --- dlls/win32u/ntuser_private.h | 1 - dlls/win32u/opengl.c | 10 +++++----- dlls/win32u/win32u_private.h | 4 ++-- dlls/win32u/window.c | 18 ++++++------------ 4 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 1d0131e5886..a9540abb576 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -72,7 +72,6 @@ typedef struct tagWND struct tagDIALOGINFO *dlgInfo; /* Dialog additional info (dialogs only) */ int swap_interval; /* OpenGL surface swap interval */ 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/opengl.c b/dlls/win32u/opengl.c index 714318d26fb..7c733a4ced0 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -1288,7 +1288,7 @@ static int win32u_wglGetPixelFormat( HDC hdc ) int format; HWND hwnd;
- if ((hwnd = NtUserWindowFromDC( hdc ))) format = get_window_pixel_format( hwnd, FALSE ); + if ((hwnd = NtUserWindowFromDC( hdc ))) format = get_window_pixel_format( hwnd ); else if ((format = get_dc_pixel_format( hdc, &is_display )) >= 0) { /* Offscreen formats can't be used with traditional WGL calls. As has been @@ -1490,7 +1490,7 @@ static BOOL win32u_wglSetPixelFormat( HDC hdc, int new_format, const PIXELFORMAT
TRACE( "%p/%p format %d\n", hdc, hwnd, new_format );
- if ((old_format = get_window_pixel_format( hwnd, FALSE ))) return old_format == new_format; + if ((old_format = get_window_pixel_format( hwnd ))) return old_format == new_format;
if ((drawable = get_window_unused_drawable( hwnd, new_format ))) { @@ -1499,7 +1499,7 @@ static BOOL win32u_wglSetPixelFormat( HDC hdc, int new_format, const PIXELFORMAT opengl_drawable_release( drawable ); }
- return set_window_pixel_format( hwnd, new_format, FALSE ); + return set_window_pixel_format( hwnd, new_format ); }
TRACE( "%p/%p format %d\n", hdc, hwnd, new_format ); @@ -1722,7 +1722,7 @@ static BOOL win32u_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct }
if ((format = get_dc_pixel_format( draw_hdc, NULL )) <= 0 && - (format = get_window_pixel_format( NtUserWindowFromDC( draw_hdc ), FALSE )) <= 0) + (format = get_window_pixel_format( NtUserWindowFromDC( draw_hdc ) )) <= 0) { WARN( "Invalid draw_hdc %p format %u\n", draw_hdc, format ); if (!format) RtlSetLastWin32Error( ERROR_INVALID_PIXEL_FORMAT ); @@ -2184,7 +2184,7 @@ static BOOL win32u_wgl_context_reset( struct wgl_context *context, HDC hdc, stru if (!hdc) return TRUE;
if ((format = get_dc_pixel_format( hdc, NULL )) <= 0 && - (format = get_window_pixel_format( NtUserWindowFromDC( hdc ), FALSE )) <= 0) + (format = get_window_pixel_format( NtUserWindowFromDC( hdc ) )) <= 0) { if (!format) RtlSetLastWin32Error( ERROR_INVALID_PIXEL_FORMAT ); else RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index ba0a9834d9f..3cc25d90d5b 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -275,8 +275,8 @@ extern BOOL is_window_enabled( HWND hwnd ); extern BOOL is_window_unicode( HWND hwnd ); extern BOOL is_window_visible( HWND hwnd ); extern BOOL is_zoomed( HWND hwnd ); -extern BOOL set_window_pixel_format( HWND hwnd, int format, BOOL internal ); -extern int get_window_pixel_format( HWND hwnd, BOOL internal ); +extern BOOL set_window_pixel_format( HWND hwnd, int format ); +extern int get_window_pixel_format( HWND hwnd ); extern DWORD get_window_long( HWND hwnd, INT offset ); extern ULONG_PTR get_window_long_ptr( HWND hwnd, INT offset, BOOL ansi ); extern BOOL get_window_rect( HWND hwnd, RECT *rect, UINT dpi ); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 8a026a3c189..c4ca7e8169f 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1538,7 +1538,7 @@ LONG_PTR WINAPI NtUserSetWindowLongPtr( HWND hwnd, INT offset, LONG_PTR newval, return set_window_long( hwnd, offset, sizeof(LONG_PTR), newval, ansi ); }
-BOOL set_window_pixel_format( HWND hwnd, int format, BOOL internal ) +BOOL set_window_pixel_format( HWND hwnd, int format ) { WND *win = get_win_ptr( hwnd );
@@ -1547,20 +1547,14 @@ BOOL set_window_pixel_format( HWND hwnd, int format, BOOL internal ) WARN( "setting format %d on win %p not supported\n", format, hwnd ); return FALSE; } - if (internal) - win->internal_pixel_format = format; - else - { - win->internal_pixel_format = 0; - win->pixel_format = format; - } + win->pixel_format = format; release_win_ptr( win );
update_window_state( hwnd ); return TRUE; }
-int get_window_pixel_format( HWND hwnd, BOOL internal ) +int get_window_pixel_format( HWND hwnd ) { WND *win = get_win_ptr( hwnd ); int ret; @@ -1571,7 +1565,7 @@ int get_window_pixel_format( HWND hwnd, BOOL internal ) return -1; }
- ret = internal && win->internal_pixel_format ? win->internal_pixel_format : win->pixel_format; + ret = win->pixel_format; release_win_ptr( win );
return ret; @@ -1584,7 +1578,7 @@ static int window_has_client_surface( HWND hwnd ) BOOL ret;
if (!win || win == WND_DESKTOP || win == WND_OTHER_PROCESS) return FALSE; - ret = win->pixel_format || win->internal_pixel_format; + ret = win->pixel_format || win->current_drawable; release_win_ptr( win ); if (ret) return TRUE;
@@ -2210,7 +2204,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru } if (new_surface) req->paint_flags |= SET_WINPOS_PAINT_SURFACE; if (is_layered) req->paint_flags |= SET_WINPOS_LAYERED_WINDOW; - if (win->pixel_format || win->internal_pixel_format) + if (win->pixel_format || win->current_drawable) req->paint_flags |= SET_WINPOS_PIXEL_FORMAT;
if ((ret = !wine_server_call( req )))