1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-01 07:14:31 +00:00

winewayland: Force the DPI context when restoring cursor clipping.

Avoiding any lossy conversion.
This commit is contained in:
Rémi Bernon 2024-06-03 20:20:33 +02:00 committed by Alexandre Julliard
parent dec2e818c0
commit 3d351fddeb
2 changed files with 18 additions and 5 deletions

View File

@ -659,12 +659,19 @@ clear_cursor:
}
}
static void reapply_cursor_clipping(void)
{
RECT rect;
UINT context = NtUserSetThreadDpiAwarenessContext(NTUSER_DPI_PER_MONITOR_AWARE);
if (NtUserGetClipCursor(&rect)) NtUserClipCursor(&rect);
NtUserSetThreadDpiAwarenessContext(context);
}
static void wayland_set_cursor(HWND hwnd, HCURSOR hcursor, BOOL use_hcursor)
{
struct wayland_pointer *pointer = &process_wayland.pointer;
struct wayland_surface *surface;
double scale;
RECT clip;
BOOL reapply_clip = FALSE;
if ((surface = wayland_surface_lock_hwnd(hwnd)))
@ -697,7 +704,7 @@ static void wayland_set_cursor(HWND hwnd, HCURSOR hcursor, BOOL use_hcursor)
/* Reapply cursor clip since cursor visibility affects pointer constraint
* behavior. */
if (reapply_clip && NtUserGetClipCursor(&clip)) NtUserClipCursor(&clip);
if (reapply_clip) reapply_cursor_clipping();
}
/**********************************************************************

View File

@ -199,12 +199,19 @@ static void wayland_win_data_get_config(struct wayland_win_data *data,
conf->managed = data->managed;
}
static void reapply_cursor_clipping(void)
{
RECT rect;
UINT context = NtUserSetThreadDpiAwarenessContext(NTUSER_DPI_PER_MONITOR_AWARE);
if (NtUserGetClipCursor(&rect )) NtUserClipCursor(&rect);
NtUserSetThreadDpiAwarenessContext(context);
}
static void wayland_win_data_update_wayland_surface(struct wayland_win_data *data)
{
struct wayland_surface *surface = data->wayland_surface;
HWND parent = NtUserGetAncestor(data->hwnd, GA_PARENT);
BOOL visible, xdg_visible;
RECT clip;
WCHAR text[1024];
TRACE("hwnd=%p\n", data->hwnd);
@ -255,8 +262,7 @@ static void wayland_win_data_update_wayland_surface(struct wayland_win_data *dat
/* Size/position changes affect the effective pointer constraint, so update
* it as needed. */
if (data->hwnd == NtUserGetForegroundWindow() && NtUserGetClipCursor(&clip))
NtUserClipCursor(&clip);
if (data->hwnd == NtUserGetForegroundWindow()) reapply_cursor_clipping();
out:
TRACE("hwnd=%p surface=%p=>%p\n", data->hwnd, data->wayland_surface, surface);