winex11: Directly use win32u in more places.

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-04-15 14:52:20 +02:00 committed by Alexandre Julliard
parent 21c37e8f95
commit 262831bc63
7 changed files with 39 additions and 28 deletions

View file

@ -197,8 +197,8 @@ static void query_desktop_work_area( RECT *rc_work )
RECT rect;
HWND hwnd = FindWindowW( trayW, NULL );
if (!hwnd || !IsWindowVisible( hwnd )) return;
if (!GetWindowRect( hwnd, &rect )) return;
if (!hwnd || !NtUserIsWindowVisible( hwnd )) return;
if (!NtUserGetWindowRect( hwnd, &rect )) return;
if (rect.top) rc_work->bottom = rect.top;
else rc_work->top = rect.bottom;
TRACE( "found tray %p %s work area %s\n", hwnd, wine_dbgstr_rect( &rect ), wine_dbgstr_rect( rc_work ) );
@ -334,8 +334,8 @@ BOOL CDECL X11DRV_create_desktop( UINT width, UINT height )
Display *display = thread_init_display();
WCHAR name[MAX_PATH];
if (!GetUserObjectInformationW( GetThreadDesktop( GetCurrentThreadId() ),
UOI_NAME, name, sizeof(name), NULL ))
if (!NtUserGetObjectInformation( NtUserGetThreadDesktop( GetCurrentThreadId() ),
UOI_NAME, name, sizeof(name), NULL ))
name[0] = 0;
TRACE( "%s %ux%u\n", debugstr_w(name), width, height );
@ -418,7 +418,7 @@ static void update_desktop_fullscreen( unsigned int width, unsigned int height)
void X11DRV_resize_desktop( BOOL send_display_change )
{
RECT primary_rect, virtual_rect;
HWND hwnd = GetDesktopWindow();
HWND hwnd = NtUserGetDesktopWindow();
INT width, height;
virtual_rect = NtUserGetVirtualScreenRect();
@ -426,23 +426,23 @@ void X11DRV_resize_desktop( BOOL send_display_change )
width = primary_rect.right;
height = primary_rect.bottom;
if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId())
if (NtUserGetWindowThread( hwnd, NULL ) != GetCurrentThreadId())
{
SendMessageW( hwnd, WM_X11DRV_RESIZE_DESKTOP, 0, (LPARAM)send_display_change );
send_message( hwnd, WM_X11DRV_RESIZE_DESKTOP, 0, (LPARAM)send_display_change );
}
else
{
TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height );
update_desktop_fullscreen( width, height );
SetWindowPos( hwnd, 0, virtual_rect.left, virtual_rect.top,
virtual_rect.right - virtual_rect.left, virtual_rect.bottom - virtual_rect.top,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE );
NtUserSetWindowPos( hwnd, 0, virtual_rect.left, virtual_rect.top,
virtual_rect.right - virtual_rect.left, virtual_rect.bottom - virtual_rect.top,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE );
ungrab_clipping_window();
if (send_display_change)
{
SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_bpp, MAKELPARAM( width, height ),
SMTO_ABORTIFHUNG, 2000, NULL );
send_message_timeout( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_bpp, MAKELPARAM( width, height ),
SMTO_ABORTIFHUNG, 2000, NULL );
}
}
}

View file

@ -218,10 +218,11 @@ void X11DRV_DisplayDevices_Update(BOOL send_display_change)
EnumWindows(update_windows_on_display_change, (LPARAM)mask);
/* forward clip_fullscreen_window request to the foreground window */
if ((foreground = GetForegroundWindow()) && (tid = GetWindowThreadProcessId( foreground, &pid )) && pid == GetCurrentProcessId())
if ((foreground = NtUserGetForegroundWindow()) &&
(tid = NtUserGetWindowThread( foreground, &pid )) && pid == GetCurrentProcessId())
{
if (tid == GetCurrentThreadId()) clip_fullscreen_window( foreground, TRUE );
else SendNotifyMessageW( foreground, WM_X11DRV_CLIP_CURSOR_REQUEST, TRUE, TRUE );
else send_notify_message( foreground, WM_X11DRV_CLIP_CURSOR_REQUEST, TRUE, TRUE );
}
}

View file

@ -1885,10 +1885,10 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event )
XRefreshKeyboardMapping(&event->xmapping);
X11DRV_InitKeyboard( event->xmapping.display );
hwnd = GetFocus();
if (!hwnd) hwnd = GetActiveWindow();
PostMessageW(hwnd, WM_INPUTLANGCHANGEREQUEST,
0 /*FIXME*/, (LPARAM)GetKeyboardLayout(0));
hwnd = get_focus();
if (!hwnd) hwnd = get_active_window();
NtUserPostMessage( hwnd, WM_INPUTLANGCHANGEREQUEST,
0 /*FIXME*/, (LPARAM)NtUserGetKeyboardLayout(0) );
return TRUE;
}
@ -2136,7 +2136,7 @@ INT X11DRV_GetKeyNameText( LONG lParam, LPWSTR lpBuffer, INT nSize )
scanCode = lParam >> 16;
scanCode &= 0x1ff; /* keep "extended-key" flag with code */
vkey = X11DRV_MapVirtualKeyEx(scanCode, MAPVK_VSC_TO_VK_EX, GetKeyboardLayout(0));
vkey = X11DRV_MapVirtualKeyEx( scanCode, MAPVK_VSC_TO_VK_EX, NtUserGetKeyboardLayout(0) );
/* handle "don't care" bit (0x02000000) */
if (!(lParam & 0x02000000)) {
@ -2159,7 +2159,7 @@ INT X11DRV_GetKeyNameText( LONG lParam, LPWSTR lpBuffer, INT nSize )
}
}
ansi = X11DRV_MapVirtualKeyEx(vkey, MAPVK_VK_TO_CHAR, GetKeyboardLayout(0));
ansi = X11DRV_MapVirtualKeyEx( vkey, MAPVK_VK_TO_CHAR, NtUserGetKeyboardLayout(0) );
TRACE("scan 0x%04x, vkey 0x%04X, ANSI 0x%04x\n", scanCode, vkey, ansi);
/* first get the name of the "regular" keys which is the Upper case
@ -2374,9 +2374,9 @@ INT X11DRV_ToUnicodeEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
focus = x11drv_thread_data()->last_xic_hwnd;
if (!focus)
{
focus = GetFocus();
if (focus) focus = GetAncestor( focus, GA_ROOT );
if (!focus) focus = GetActiveWindow();
focus = get_focus();
if (focus) focus = NtUserGetAncestor( focus, GA_ROOT );
if (!focus) focus = get_active_window();
}
e.window = X11DRV_get_whole_window( focus );
xic = X11DRV_get_ic( focus );

View file

@ -318,7 +318,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
FIXME("Support for allocation callbacks not implemented yet\n");
/* TODO: support child window rendering. */
if (create_info->hwnd && GetAncestor(create_info->hwnd, GA_PARENT) != GetDesktopWindow())
if (create_info->hwnd && NtUserGetAncestor(create_info->hwnd, GA_PARENT) != NtUserGetDesktopWindow())
{
FIXME("Application requires child window rendering, which is not implemented yet!\n");
return VK_ERROR_INCOMPATIBLE_DRIVER;
@ -333,7 +333,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
if (x11_surface->hwnd)
{
x11_surface->window = create_client_window(create_info->hwnd, &default_visual);
x11_surface->hwnd_thread_id = GetWindowThreadProcessId(x11_surface->hwnd, NULL);
x11_surface->hwnd_thread_id = NtUserGetWindowThread(x11_surface->hwnd, NULL);
}
else
{

View file

@ -1420,7 +1420,7 @@ static void move_window_bits( HWND hwnd, Window window, const RECT *old_rect, co
* still want to avoid copying invalid window bits when possible.
*/
if (!(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_CLIPCHILDREN ))
ExcludeUpdateRgn( hdc_dst, hwnd );
NtUserExcludeUpdateRgn( hdc_dst, hwnd );
code = X11DRV_START_EXPOSURES;
NtGdiExtEscape( hdc_dst, NULL, 0, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, 0, NULL );
@ -2188,7 +2188,7 @@ void X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
if (escape.drawable)
{
POINT pt = { 0, 0 };
MapWindowPoints( 0, parent, &pt, 1 );
NtUserMapWindowPoints( 0, parent, &pt, 1 );
escape.dc_rect = *win_rect;
OffsetRect( &escape.dc_rect, pt.x, pt.y );
if (flags & DCX_CLIPCHILDREN) escape.mode = ClipByChildren;

View file

@ -857,6 +857,16 @@ static inline LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
return NtUserMessageCall( hwnd, msg, wparam, lparam, NULL, NtUserSendMessage, FALSE );
}
static inline LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
UINT flags, UINT timeout, PDWORD_PTR res_ptr )
{
struct send_message_timeout_params params = { .flags = flags, .timeout = timeout };
LRESULT res = NtUserMessageCall( hwnd, msg, wparam, lparam, &params,
NtUserSendMessageTimeout, FALSE );
if (res_ptr) *res_ptr = params.result;
return res;
}
static inline BOOL send_notify_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
return NtUserMessageCall( hwnd, msg, wparam, lparam, 0, NtUserSendNotifyMessage, FALSE );

View file

@ -1182,7 +1182,7 @@ static void xrandr14_free_monitors( struct gdi_monitor *monitors, int count )
static BOOL xrandr14_device_change_handler( HWND hwnd, XEvent *event )
{
xrandr14_invalidate_current_mode_cache();
if (hwnd == GetDesktopWindow() && GetWindowThreadProcessId( hwnd, NULL ) == GetCurrentThreadId())
if (hwnd == NtUserGetDesktopWindow() && NtUserGetWindowThread( hwnd, NULL ) == GetCurrentThreadId())
{
/* Don't send a WM_DISPLAYCHANGE message here because this event may be a result from
* ChangeDisplaySettings(). Otherwise, ChangeDisplaySettings() would send multiple