mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-30 08:29:52 +00:00
winewayland.drv: Add initial stub for wl_pointer handling.
Track the availability of a pointer device for a seat. For now we assume only a single seat and pointer.
This commit is contained in:
parent
0992d0978e
commit
a3709b93ca
|
@ -9,6 +9,7 @@ SOURCES = \
|
|||
version.rc \
|
||||
wayland.c \
|
||||
wayland_output.c \
|
||||
wayland_pointer.c \
|
||||
wayland_surface.c \
|
||||
waylanddrv_main.c \
|
||||
window.c \
|
||||
|
|
|
@ -53,6 +53,29 @@ static const struct xdg_wm_base_listener xdg_wm_base_listener =
|
|||
xdg_wm_base_handle_ping
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
* wl_seat handling
|
||||
*/
|
||||
|
||||
static void wl_seat_handle_capabilities(void *data, struct wl_seat *seat,
|
||||
enum wl_seat_capability caps)
|
||||
{
|
||||
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !process_wayland.wl_pointer)
|
||||
wayland_pointer_init(wl_seat_get_pointer(seat));
|
||||
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && process_wayland.wl_pointer)
|
||||
wayland_pointer_deinit();
|
||||
}
|
||||
|
||||
static void wl_seat_handle_name(void *data, struct wl_seat *seat, const char *name)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct wl_seat_listener seat_listener =
|
||||
{
|
||||
wl_seat_handle_capabilities,
|
||||
wl_seat_handle_name
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
* Registry handling
|
||||
*/
|
||||
|
@ -98,6 +121,17 @@ static void registry_handle_global(void *data, struct wl_registry *registry,
|
|||
{
|
||||
process_wayland.wl_shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
|
||||
}
|
||||
else if (strcmp(interface, "wl_seat") == 0)
|
||||
{
|
||||
if (process_wayland.wl_seat)
|
||||
{
|
||||
WARN("Only a single seat is currently supported, ignoring additional seats.\n");
|
||||
return;
|
||||
}
|
||||
process_wayland.wl_seat = wl_registry_bind(registry, id, &wl_seat_interface,
|
||||
version < 5 ? version : 5);
|
||||
wl_seat_add_listener(process_wayland.wl_seat, &seat_listener, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void registry_handle_global_remove(void *data, struct wl_registry *registry,
|
||||
|
@ -116,6 +150,15 @@ static void registry_handle_global_remove(void *data, struct wl_registry *regist
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (process_wayland.wl_seat &&
|
||||
wl_proxy_get_id((struct wl_proxy *)process_wayland.wl_seat) == id)
|
||||
{
|
||||
TRACE("removing seat\n");
|
||||
if (process_wayland.wl_pointer) wayland_pointer_deinit();
|
||||
wl_seat_release(process_wayland.wl_seat);
|
||||
process_wayland.wl_seat = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct wl_registry_listener registry_listener = {
|
||||
|
|
98
dlls/winewayland.drv/wayland_pointer.c
Normal file
98
dlls/winewayland.drv/wayland_pointer.c
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Wayland pointer handling
|
||||
*
|
||||
* Copyright (c) 2020 Alexandros 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 "waylanddrv.h"
|
||||
|
||||
static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
|
||||
uint32_t time, wl_fixed_t sx, wl_fixed_t sy)
|
||||
{
|
||||
}
|
||||
|
||||
static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
|
||||
uint32_t serial, struct wl_surface *wl_surface,
|
||||
wl_fixed_t sx, wl_fixed_t sy)
|
||||
{
|
||||
}
|
||||
|
||||
static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,
|
||||
uint32_t serial, struct wl_surface *wl_surface)
|
||||
{
|
||||
}
|
||||
|
||||
static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
|
||||
uint32_t serial, uint32_t time, uint32_t button,
|
||||
uint32_t state)
|
||||
{
|
||||
}
|
||||
|
||||
static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer,
|
||||
uint32_t time, uint32_t axis, wl_fixed_t value)
|
||||
{
|
||||
}
|
||||
|
||||
static void pointer_handle_frame(void *data, struct wl_pointer *wl_pointer)
|
||||
{
|
||||
}
|
||||
|
||||
static void pointer_handle_axis_source(void *data, struct wl_pointer *wl_pointer,
|
||||
uint32_t axis_source)
|
||||
{
|
||||
}
|
||||
|
||||
static void pointer_handle_axis_stop(void *data, struct wl_pointer *wl_pointer,
|
||||
uint32_t time, uint32_t axis)
|
||||
{
|
||||
}
|
||||
|
||||
static void pointer_handle_axis_discrete(void *data, struct wl_pointer *wl_pointer,
|
||||
uint32_t axis, int32_t discrete)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct wl_pointer_listener pointer_listener =
|
||||
{
|
||||
pointer_handle_enter,
|
||||
pointer_handle_leave,
|
||||
pointer_handle_motion,
|
||||
pointer_handle_button,
|
||||
pointer_handle_axis,
|
||||
pointer_handle_frame,
|
||||
pointer_handle_axis_source,
|
||||
pointer_handle_axis_stop,
|
||||
pointer_handle_axis_discrete
|
||||
};
|
||||
|
||||
void wayland_pointer_init(struct wl_pointer *wl_pointer)
|
||||
{
|
||||
process_wayland.wl_pointer = wl_pointer;
|
||||
wl_pointer_add_listener(process_wayland.wl_pointer, &pointer_listener, NULL);
|
||||
}
|
||||
|
||||
void wayland_pointer_deinit(void)
|
||||
{
|
||||
wl_pointer_release(process_wayland.wl_pointer);
|
||||
process_wayland.wl_pointer = NULL;
|
||||
}
|
|
@ -66,6 +66,8 @@ struct wayland
|
|||
struct wl_compositor *wl_compositor;
|
||||
struct xdg_wm_base *xdg_wm_base;
|
||||
struct wl_shm *wl_shm;
|
||||
struct wl_seat *wl_seat;
|
||||
struct wl_pointer *wl_pointer;
|
||||
struct wl_list output_list;
|
||||
/* Protects the output_list and the wayland_output.current states. */
|
||||
pthread_mutex_t output_mutex;
|
||||
|
@ -167,6 +169,13 @@ void wayland_window_surface_update_wayland_surface(struct window_surface *surfac
|
|||
struct wayland_surface *wayland_surface) DECLSPEC_HIDDEN;
|
||||
void wayland_window_flush(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
|
||||
/**********************************************************************
|
||||
* Wayland pointer
|
||||
*/
|
||||
|
||||
void wayland_pointer_init(struct wl_pointer *wl_pointer) DECLSPEC_HIDDEN;
|
||||
void wayland_pointer_deinit(void) DECLSPEC_HIDDEN;
|
||||
|
||||
/**********************************************************************
|
||||
* Helpers
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue