From: Zsolt Vadasz zsolt_vadasz@protonmail.com
--- dlls/winewayland.drv/wayland_pointer.c | 26 ++++++++++++++++++++++++++ dlls/winewayland.drv/waylanddrv.h | 1 + dlls/winewayland.drv/waylanddrv_main.c | 1 + 3 files changed, 28 insertions(+)
diff --git a/dlls/winewayland.drv/wayland_pointer.c b/dlls/winewayland.drv/wayland_pointer.c index 1d8acaeabd2..90d399a5b58 100644 --- a/dlls/winewayland.drv/wayland_pointer.c +++ b/dlls/winewayland.drv/wayland_pointer.c @@ -31,6 +31,7 @@
#include "waylanddrv.h" #include "wine/debug.h" +#include "wine/server.h"
WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv);
@@ -893,6 +894,31 @@ void WAYLAND_SetCursor(HWND hwnd, HCURSOR hcursor) wayland_set_cursor(hwnd, hcursor, TRUE); }
+/*********************************************************************** + * WAYLAND_GetCursorPos + */ +BOOL WAYLAND_GetCursorPos(LPPOINT pos) +{ + RECT *window_rect = NULL; + struct wayland_surface *surface = wayland_surface_lock_hwnd(wayland_pointer_get_focused_hwnd()); + if(!surface) + return false; + window_rect = &surface->window.rect; + pthread_mutex_unlock( &surface->mutex ); + SERVER_START_REQ( get_cursor_history ) + { + cursor_pos_t cpos; + wine_server_set_reply( req, &cpos, sizeof( cpos ) ); + if(wine_server_call( req )) return false; + pos->x = cpos.x - window_rect->left; + pos->y = cpos.y - window_rect->top; + } + SERVER_END_REQ; + TRACE("pointer at %s\n", wine_dbgstr_point( pos )); + + return true; +} + /*********************************************************************** * WAYLAND_ClipCursor */ diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 7943c97a1dc..eea6b555dec 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -329,6 +329,7 @@ BOOL WAYLAND_ClipCursor(const RECT *clip, BOOL reset); LRESULT WAYLAND_DesktopWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); void WAYLAND_DestroyWindow(HWND hwnd); void WAYLAND_SetCursor(HWND hwnd, HCURSOR hcursor); +BOOL WAYLAND_GetCursorPos(LPPOINT pos); void WAYLAND_SetWindowText(HWND hwnd, LPCWSTR text); LRESULT WAYLAND_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam); UINT WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manager, void *param); diff --git a/dlls/winewayland.drv/waylanddrv_main.c b/dlls/winewayland.drv/waylanddrv_main.c index 61e7df16f14..67d4e12a152 100644 --- a/dlls/winewayland.drv/waylanddrv_main.c +++ b/dlls/winewayland.drv/waylanddrv_main.c @@ -41,6 +41,7 @@ static const struct user_driver_funcs waylanddrv_funcs = .pKbdLayerDescriptor = WAYLAND_KbdLayerDescriptor, .pReleaseKbdTables = WAYLAND_ReleaseKbdTables, .pSetCursor = WAYLAND_SetCursor, + .pGetCursorPos = WAYLAND_GetCursorPos, .pSetWindowText = WAYLAND_SetWindowText, .pSysCommand = WAYLAND_SysCommand, .pUpdateDisplayDevices = WAYLAND_UpdateDisplayDevices,
I don't think this is necessary for the wayland driver, it receives input event through a separate thread, and the win32u `get_cursor_pos` implementation that retrieves the cursor position from wineserver should be enough.
On Wed Jun 12 08:25:14 2024 +0000, Rémi Bernon wrote:
I don't think this is necessary for the wayland driver, it receives input event through a separate thread, and the win32u `get_cursor_pos` implementation that retrieves the cursor position from wineserver should be enough.
Right, I just noticed `get_cursor_pos` makes the same request. I'll close this then.
This merge request was closed by Zsolt Vadász.