wine/dlls/winewayland.drv/waylanddrv_main.c
Alexandros Frantzis bf1cabd18f winewayland.drv: Implement ClipCursor.
Use the zwp_pointer_constraints_v1 protocol to implement cursor
clipping. Note that Wayland only allows us to constrain the cursor
within the extents of a particular target surface.
2023-12-07 20:46:05 +01:00

91 lines
2.8 KiB
C

/*
* WAYLANDDRV initialization code
*
* Copyright 2020 Alexandre Frantzis for Collabora Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep unix
#endif
#include "config.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "waylanddrv.h"
static const struct user_driver_funcs waylanddrv_funcs =
{
.pClipCursor = WAYLAND_ClipCursor,
.pDesktopWindowProc = WAYLAND_DesktopWindowProc,
.pDestroyWindow = WAYLAND_DestroyWindow,
.pKbdLayerDescriptor = WAYLAND_KbdLayerDescriptor,
.pReleaseKbdTables = WAYLAND_ReleaseKbdTables,
.pSetCursor = WAYLAND_SetCursor,
.pSysCommand = WAYLAND_SysCommand,
.pUpdateDisplayDevices = WAYLAND_UpdateDisplayDevices,
.pWindowMessage = WAYLAND_WindowMessage,
.pWindowPosChanged = WAYLAND_WindowPosChanged,
.pWindowPosChanging = WAYLAND_WindowPosChanging,
.pwine_get_vulkan_driver = WAYLAND_wine_get_vulkan_driver,
};
static NTSTATUS waylanddrv_unix_init(void *arg)
{
/* Set the user driver functions now so that they are available during
* our initialization. We clear them on error. */
__wine_set_user_driver(&waylanddrv_funcs, WINE_GDI_DRIVER_VERSION);
if (!wayland_process_init()) goto err;
return 0;
err:
__wine_set_user_driver(NULL, WINE_GDI_DRIVER_VERSION);
return STATUS_UNSUCCESSFUL;
}
static NTSTATUS waylanddrv_unix_read_events(void *arg)
{
while (wl_display_dispatch_queue(process_wayland.wl_display,
process_wayland.wl_event_queue) != -1)
continue;
/* This function only returns on a fatal error, e.g., if our connection
* to the Wayland server is lost. */
return STATUS_UNSUCCESSFUL;
}
const unixlib_entry_t __wine_unix_call_funcs[] =
{
waylanddrv_unix_init,
waylanddrv_unix_read_events,
};
C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == waylanddrv_unix_func_count);
#ifdef _WIN64
const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
{
waylanddrv_unix_init,
waylanddrv_unix_read_events,
};
C_ASSERT(ARRAYSIZE(__wine_unix_call_wow64_funcs) == waylanddrv_unix_func_count);
#endif /* _WIN64 */