From ea764fbd3e21b53efd969ca1bc1745d2e3166d49 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 16 Mar 2022 15:35:35 +0100 Subject: [PATCH] win32u: Move __wine_set_pixel_format implementation from user32. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/user32/win.c | 39 +-------------------------------------- dlls/win32u/window.c | 18 ++++++++++++++++++ include/ntuser.h | 1 + 3 files changed, 20 insertions(+), 38 deletions(-) diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 2c241aad7d2..a21bdc62ed5 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -258,32 +258,6 @@ static void send_parent_notify( HWND hwnd, UINT msg ) } -/******************************************************************* - * update_window_state - * - * Trigger an update of the window's driver state and surface. - */ -static void update_window_state( HWND hwnd ) -{ - DPI_AWARENESS_CONTEXT context; - RECT window_rect, client_rect, valid_rects[2]; - - if (!WIN_IsCurrentThread( hwnd )) - { - PostMessageW( hwnd, WM_WINE_UPDATEWINDOWSTATE, 0, 0 ); - return; - } - - context = SetThreadDpiAwarenessContext( GetWindowDpiAwarenessContext( hwnd )); - WIN_GetRectangles( hwnd, COORDS_PARENT, &window_rect, &client_rect ); - valid_rects[0] = valid_rects[1] = client_rect; - set_window_pos( hwnd, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | - SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW, - &window_rect, &client_rect, valid_rects ); - SetThreadDpiAwarenessContext( context ); -} - - /******************************************************************* * get_hwnd_message_parent * @@ -2726,18 +2700,7 @@ BOOL WINAPI SwitchDesktop( HDESK hDesktop) */ BOOL CDECL __wine_set_pixel_format( HWND hwnd, int format ) { - WND *win = WIN_GetPtr( hwnd ); - - if (!win || win == WND_DESKTOP || win == WND_OTHER_PROCESS) - { - WARN( "setting format %d on win %p not supported\n", format, hwnd ); - return FALSE; - } - win->pixel_format = format; - WIN_ReleasePtr( win ); - - update_window_state( hwnd ); - return TRUE; + return NtUserCallHwndParam( hwnd, format, NtUserSetWindowPixelFormat ); } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index e4311b49608..2700df862ca 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1421,6 +1421,22 @@ LONG_PTR WINAPI NtUserSetWindowLongPtr( HWND hwnd, INT offset, LONG_PTR newval, return set_window_long( hwnd, offset, sizeof(LONG_PTR), newval, ansi ); } +static BOOL set_window_pixel_format( HWND hwnd, int format ) +{ + WND *win = get_win_ptr( hwnd ); + + if (!win || win == WND_DESKTOP || win == WND_OTHER_PROCESS) + { + WARN( "setting format %d on win %p not supported\n", format, hwnd ); + return FALSE; + } + win->pixel_format = format; + release_win_ptr( win ); + + update_window_state( hwnd ); + return TRUE; +} + /*********************************************************************** * NtUserGetProp (win32u.@) * @@ -3322,6 +3338,8 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) return set_capture_window( hwnd, param, NULL ); case NtUserSetForegroundWindow: return set_foreground_window( hwnd, param ); + case NtUserSetWindowPixelFormat: + return set_window_pixel_format( hwnd, param ); /* temporary exports */ case NtUserIsWindowDrawable: return is_window_drawable( hwnd, param ); diff --git a/include/ntuser.h b/include/ntuser.h index 0e48aea0f9c..4ca4c063ef8 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -181,6 +181,7 @@ enum NtUserMonitorFromWindow, NtUserSetCaptureWindow, NtUserSetForegroundWindow, + NtUserSetWindowPixelFormat, /* temporary exports */ NtUserIsWindowDrawable, NtUserSetWindowStyle,