win32u: Move __wine_set_pixel_format implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-03-16 15:35:35 +01:00 committed by Alexandre Julliard
parent 1b847dff82
commit ea764fbd3e
3 changed files with 20 additions and 38 deletions

View File

@ -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 );
}

View File

@ -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 );

View File

@ -181,6 +181,7 @@ enum
NtUserMonitorFromWindow,
NtUserSetCaptureWindow,
NtUserSetForegroundWindow,
NtUserSetWindowPixelFormat,
/* temporary exports */
NtUserIsWindowDrawable,
NtUserSetWindowStyle,