mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
wayland: Move device seat association to MetaWaylandInputDevice
Make the device <-> seat association permanent, and move it into MetaWaylandInputDevice. A device will never be disassociated with a seat, so there is no point in unsetting it. https://bugzilla.gnome.org/show_bug.cgi?id=771305
This commit is contained in:
parent
a6646b32d0
commit
87f82d9fc0
@ -26,9 +26,72 @@
|
|||||||
|
|
||||||
#include "wayland/meta-wayland-input-device.h"
|
#include "wayland/meta-wayland-input-device.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaWaylandInputDevice,
|
enum
|
||||||
meta_wayland_input_device,
|
{
|
||||||
G_TYPE_OBJECT)
|
PROP_0,
|
||||||
|
|
||||||
|
PROP_SEAT
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _MetaWaylandInputDevicePrivate
|
||||||
|
{
|
||||||
|
MetaWaylandSeat *seat;
|
||||||
|
} MetaWaylandInputDevicePrivate;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_PRIVATE (MetaWaylandInputDevice,
|
||||||
|
meta_wayland_input_device,
|
||||||
|
G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
MetaWaylandSeat *
|
||||||
|
meta_wayland_input_device_get_seat (MetaWaylandInputDevice *input_device)
|
||||||
|
{
|
||||||
|
MetaWaylandInputDevicePrivate *priv =
|
||||||
|
meta_wayland_input_device_get_instance_private (input_device);
|
||||||
|
|
||||||
|
return priv->seat;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_input_device_set_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (object);
|
||||||
|
MetaWaylandInputDevicePrivate *priv =
|
||||||
|
meta_wayland_input_device_get_instance_private (input_device);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_SEAT:
|
||||||
|
priv->seat = g_value_get_pointer (value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_input_device_get_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (object);
|
||||||
|
MetaWaylandInputDevicePrivate *priv =
|
||||||
|
meta_wayland_input_device_get_instance_private (input_device);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_SEAT:
|
||||||
|
g_value_set_pointer (value, priv->seat);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_wayland_input_device_init (MetaWaylandInputDevice *input_device)
|
meta_wayland_input_device_init (MetaWaylandInputDevice *input_device)
|
||||||
@ -38,4 +101,17 @@ meta_wayland_input_device_init (MetaWaylandInputDevice *input_device)
|
|||||||
static void
|
static void
|
||||||
meta_wayland_input_device_class_init (MetaWaylandInputDeviceClass *klass)
|
meta_wayland_input_device_class_init (MetaWaylandInputDeviceClass *klass)
|
||||||
{
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
GParamSpec *pspec;
|
||||||
|
|
||||||
|
object_class->set_property = meta_wayland_input_device_set_property;
|
||||||
|
object_class->get_property = meta_wayland_input_device_get_property;
|
||||||
|
|
||||||
|
pspec = g_param_spec_pointer ("seat",
|
||||||
|
"MetaWaylandSeat",
|
||||||
|
"The seat",
|
||||||
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_STATIC_STRINGS |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
g_object_class_install_property (object_class, PROP_SEAT, pspec);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include "wayland/meta-wayland-types.h"
|
||||||
|
|
||||||
#define META_TYPE_WAYLAND_INPUT_DEVICE (meta_wayland_input_device_get_type ())
|
#define META_TYPE_WAYLAND_INPUT_DEVICE (meta_wayland_input_device_get_type ())
|
||||||
G_DECLARE_DERIVABLE_TYPE (MetaWaylandInputDevice,
|
G_DECLARE_DERIVABLE_TYPE (MetaWaylandInputDevice,
|
||||||
meta_wayland_input_device,
|
meta_wayland_input_device,
|
||||||
@ -38,4 +40,6 @@ struct _MetaWaylandInputDeviceClass
|
|||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MetaWaylandSeat * meta_wayland_input_device_get_seat (MetaWaylandInputDevice *input_device);
|
||||||
|
|
||||||
#endif /* META_WAYLAND_INPUT_DEVICE_H */
|
#endif /* META_WAYLAND_INPUT_DEVICE_H */
|
||||||
|
@ -351,11 +351,15 @@ meta_wayland_keyboard_broadcast_modifiers (MetaWaylandKeyboard *keyboard)
|
|||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
struct wl_list *l;
|
struct wl_list *l;
|
||||||
|
|
||||||
|
|
||||||
l = &keyboard->focus_resource_list;
|
l = &keyboard->focus_resource_list;
|
||||||
if (!wl_list_empty (l))
|
if (!wl_list_empty (l))
|
||||||
{
|
{
|
||||||
uint32_t serial = wl_display_next_serial (keyboard->seat->wl_display);
|
MetaWaylandInputDevice *input_device =
|
||||||
|
META_WAYLAND_INPUT_DEVICE (keyboard);
|
||||||
|
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
|
||||||
|
uint32_t serial;
|
||||||
|
|
||||||
|
serial = wl_display_next_serial (seat->wl_display);
|
||||||
|
|
||||||
wl_resource_for_each (resource, l)
|
wl_resource_for_each (resource, l)
|
||||||
keyboard_send_modifiers (keyboard, resource, serial);
|
keyboard_send_modifiers (keyboard, resource, serial);
|
||||||
@ -602,14 +606,11 @@ static const MetaWaylandKeyboardGrabInterface default_keyboard_grab_interface =
|
|||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard,
|
meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
|
||||||
MetaWaylandSeat *seat)
|
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
MetaBackend *backend = meta_get_backend ();
|
||||||
GSettingsSchema *schema;
|
GSettingsSchema *schema;
|
||||||
|
|
||||||
keyboard->seat = seat;
|
|
||||||
|
|
||||||
wl_list_init (&keyboard->resource_list);
|
wl_list_init (&keyboard->resource_list);
|
||||||
wl_list_init (&keyboard->focus_resource_list);
|
wl_list_init (&keyboard->focus_resource_list);
|
||||||
|
|
||||||
@ -677,8 +678,6 @@ meta_wayland_keyboard_disable (MetaWaylandKeyboard *keyboard)
|
|||||||
g_clear_object (&keyboard->settings);
|
g_clear_object (&keyboard->settings);
|
||||||
if (keyboard->gsd_settings)
|
if (keyboard->gsd_settings)
|
||||||
g_object_unref (keyboard->gsd_settings);
|
g_object_unref (keyboard->gsd_settings);
|
||||||
|
|
||||||
keyboard->seat = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
@ -826,7 +825,10 @@ void
|
|||||||
meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
|
meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
|
||||||
MetaWaylandSurface *surface)
|
MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
if (keyboard->seat == NULL)
|
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (keyboard);
|
||||||
|
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
|
||||||
|
|
||||||
|
if (!meta_wayland_seat_has_keyboard (seat))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (keyboard->focus_surface == surface)
|
if (keyboard->focus_surface == surface)
|
||||||
|
@ -83,8 +83,6 @@ struct _MetaWaylandKeyboard
|
|||||||
{
|
{
|
||||||
MetaWaylandInputDevice parent;
|
MetaWaylandInputDevice parent;
|
||||||
|
|
||||||
MetaWaylandSeat *seat;
|
|
||||||
|
|
||||||
struct wl_list resource_list;
|
struct wl_list resource_list;
|
||||||
struct wl_list focus_resource_list;
|
struct wl_list focus_resource_list;
|
||||||
|
|
||||||
@ -103,8 +101,7 @@ struct _MetaWaylandKeyboard
|
|||||||
GSettings *gsd_settings;
|
GSettings *gsd_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
void meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard,
|
void meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard);
|
||||||
MetaWaylandSeat *seat);
|
|
||||||
|
|
||||||
void meta_wayland_keyboard_disable (MetaWaylandKeyboard *keyboard);
|
void meta_wayland_keyboard_disable (MetaWaylandKeyboard *keyboard);
|
||||||
|
|
||||||
|
@ -36,11 +36,13 @@ handle_pinch_begin (MetaWaylandPointer *pointer,
|
|||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
MetaWaylandPointerClient *pointer_client;
|
MetaWaylandPointerClient *pointer_client;
|
||||||
|
MetaWaylandSeat *seat;
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
pointer_client = pointer->focus_client;
|
pointer_client = pointer->focus_client;
|
||||||
serial = wl_display_next_serial (pointer->seat->wl_display);
|
seat = meta_wayland_pointer_get_seat (pointer);
|
||||||
|
serial = wl_display_next_serial (seat->wl_display);
|
||||||
|
|
||||||
wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources)
|
wl_resource_for_each (resource, &pointer_client->pinch_gesture_resources)
|
||||||
{
|
{
|
||||||
@ -80,12 +82,14 @@ handle_pinch_end (MetaWaylandPointer *pointer,
|
|||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
MetaWaylandPointerClient *pointer_client;
|
MetaWaylandPointerClient *pointer_client;
|
||||||
|
MetaWaylandSeat *seat;
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
gboolean cancelled = FALSE;
|
gboolean cancelled = FALSE;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
pointer_client = pointer->focus_client;
|
pointer_client = pointer->focus_client;
|
||||||
serial = wl_display_next_serial (pointer->seat->wl_display);
|
seat = meta_wayland_pointer_get_seat (pointer);
|
||||||
|
serial = wl_display_next_serial (seat->wl_display);
|
||||||
|
|
||||||
if (event->touchpad_pinch.phase == CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL)
|
if (event->touchpad_pinch.phase == CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL)
|
||||||
cancelled = TRUE;
|
cancelled = TRUE;
|
||||||
|
@ -36,11 +36,13 @@ handle_swipe_begin (MetaWaylandPointer *pointer,
|
|||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
MetaWaylandPointerClient *pointer_client;
|
MetaWaylandPointerClient *pointer_client;
|
||||||
|
MetaWaylandSeat *seat;
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
uint32_t serial, fingers;
|
uint32_t serial, fingers;
|
||||||
|
|
||||||
pointer_client = pointer->focus_client;
|
pointer_client = pointer->focus_client;
|
||||||
serial = wl_display_next_serial (pointer->seat->wl_display);
|
seat = meta_wayland_pointer_get_seat (pointer);
|
||||||
|
serial = wl_display_next_serial (seat->wl_display);
|
||||||
fingers = clutter_event_get_gesture_swipe_finger_count (event);
|
fingers = clutter_event_get_gesture_swipe_finger_count (event);
|
||||||
|
|
||||||
wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources)
|
wl_resource_for_each (resource, &pointer_client->swipe_gesture_resources)
|
||||||
@ -77,12 +79,14 @@ handle_swipe_end (MetaWaylandPointer *pointer,
|
|||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
MetaWaylandPointerClient *pointer_client;
|
MetaWaylandPointerClient *pointer_client;
|
||||||
|
MetaWaylandSeat *seat;
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
gboolean cancelled = FALSE;
|
gboolean cancelled = FALSE;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
pointer_client = pointer->focus_client;
|
pointer_client = pointer->focus_client;
|
||||||
serial = wl_display_next_serial (pointer->seat->wl_display);
|
seat = meta_wayland_pointer_get_seat (pointer);
|
||||||
|
serial = wl_display_next_serial (seat->wl_display);
|
||||||
|
|
||||||
if (event->touchpad_swipe.phase == CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL)
|
if (event->touchpad_swipe.phase == CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL)
|
||||||
cancelled = TRUE;
|
cancelled = TRUE;
|
||||||
|
@ -456,14 +456,11 @@ meta_wayland_pointer_on_cursor_changed (MetaCursorTracker *cursor_tracker,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_pointer_enable (MetaWaylandPointer *pointer,
|
meta_wayland_pointer_enable (MetaWaylandPointer *pointer)
|
||||||
MetaWaylandSeat *seat)
|
|
||||||
{
|
{
|
||||||
MetaCursorTracker *cursor_tracker = meta_cursor_tracker_get_for_screen (NULL);
|
MetaCursorTracker *cursor_tracker = meta_cursor_tracker_get_for_screen (NULL);
|
||||||
ClutterDeviceManager *manager;
|
ClutterDeviceManager *manager;
|
||||||
|
|
||||||
pointer->seat = seat;
|
|
||||||
|
|
||||||
pointer->pointer_clients =
|
pointer->pointer_clients =
|
||||||
g_hash_table_new_full (NULL, NULL, NULL,
|
g_hash_table_new_full (NULL, NULL, NULL,
|
||||||
(GDestroyNotify) meta_wayland_pointer_client_free);
|
(GDestroyNotify) meta_wayland_pointer_client_free);
|
||||||
@ -503,7 +500,6 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer)
|
|||||||
meta_wayland_pointer_set_focus (pointer, NULL);
|
meta_wayland_pointer_set_focus (pointer, NULL);
|
||||||
|
|
||||||
g_clear_pointer (&pointer->pointer_clients, g_hash_table_unref);
|
g_clear_pointer (&pointer->pointer_clients, g_hash_table_unref);
|
||||||
pointer->seat = NULL;
|
|
||||||
pointer->cursor_surface = NULL;
|
pointer->cursor_surface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,7 +585,11 @@ handle_button_event (MetaWaylandPointer *pointer,
|
|||||||
pointer->grab->interface->button (pointer->grab, event);
|
pointer->grab->interface->button (pointer->grab, event);
|
||||||
|
|
||||||
if (implicit_grab)
|
if (implicit_grab)
|
||||||
pointer->grab_serial = wl_display_get_serial (pointer->seat->wl_display);
|
{
|
||||||
|
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (pointer);
|
||||||
|
|
||||||
|
pointer->grab_serial = wl_display_get_serial (seat->wl_display);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -796,7 +796,9 @@ void
|
|||||||
meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
|
meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
|
||||||
MetaWaylandSurface *surface)
|
MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
if (pointer->seat == NULL)
|
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (pointer);
|
||||||
|
|
||||||
|
if (!meta_wayland_seat_has_pointer (seat))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pointer->focus_surface == surface)
|
if (pointer->focus_surface == surface)
|
||||||
@ -1206,7 +1208,9 @@ meta_wayland_relative_pointer_init (MetaWaylandCompositor *compositor)
|
|||||||
MetaWaylandSeat *
|
MetaWaylandSeat *
|
||||||
meta_wayland_pointer_get_seat (MetaWaylandPointer *pointer)
|
meta_wayland_pointer_get_seat (MetaWaylandPointer *pointer)
|
||||||
{
|
{
|
||||||
return pointer->seat;
|
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (pointer);
|
||||||
|
|
||||||
|
return meta_wayland_input_device_get_seat (input_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "meta-wayland-types.h"
|
#include "meta-wayland-types.h"
|
||||||
|
#include "meta-wayland-seat.h"
|
||||||
#include "meta-wayland-pointer-gesture-swipe.h"
|
#include "meta-wayland-pointer-gesture-swipe.h"
|
||||||
#include "meta-wayland-pointer-gesture-pinch.h"
|
#include "meta-wayland-pointer-gesture-pinch.h"
|
||||||
#include "meta-wayland-surface.h"
|
#include "meta-wayland-surface.h"
|
||||||
@ -65,8 +66,6 @@ struct _MetaWaylandPointer
|
|||||||
{
|
{
|
||||||
MetaWaylandInputDevice parent;
|
MetaWaylandInputDevice parent;
|
||||||
|
|
||||||
MetaWaylandSeat *seat;
|
|
||||||
|
|
||||||
MetaWaylandPointerClient *focus_client;
|
MetaWaylandPointerClient *focus_client;
|
||||||
GHashTable *pointer_clients;
|
GHashTable *pointer_clients;
|
||||||
|
|
||||||
@ -91,8 +90,7 @@ struct _MetaWaylandPointer
|
|||||||
guint32 button_count;
|
guint32 button_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
void meta_wayland_pointer_enable (MetaWaylandPointer *pointer,
|
void meta_wayland_pointer_enable (MetaWaylandPointer *pointer);
|
||||||
MetaWaylandSeat *seat);
|
|
||||||
|
|
||||||
void meta_wayland_pointer_disable (MetaWaylandPointer *pointer);
|
void meta_wayland_pointer_disable (MetaWaylandPointer *pointer);
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ meta_wayland_seat_set_capabilities (MetaWaylandSeat *seat,
|
|||||||
seat->capabilities = flags;
|
seat->capabilities = flags;
|
||||||
|
|
||||||
if (CAPABILITY_ENABLED (prev_flags, flags, WL_SEAT_CAPABILITY_POINTER))
|
if (CAPABILITY_ENABLED (prev_flags, flags, WL_SEAT_CAPABILITY_POINTER))
|
||||||
meta_wayland_pointer_enable (seat->pointer, seat);
|
meta_wayland_pointer_enable (seat->pointer);
|
||||||
else if (CAPABILITY_DISABLED (prev_flags, flags, WL_SEAT_CAPABILITY_POINTER))
|
else if (CAPABILITY_DISABLED (prev_flags, flags, WL_SEAT_CAPABILITY_POINTER))
|
||||||
meta_wayland_pointer_disable (seat->pointer);
|
meta_wayland_pointer_disable (seat->pointer);
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ meta_wayland_seat_set_capabilities (MetaWaylandSeat *seat,
|
|||||||
{
|
{
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
|
|
||||||
meta_wayland_keyboard_enable (seat->keyboard, seat);
|
meta_wayland_keyboard_enable (seat->keyboard);
|
||||||
display = meta_get_display ();
|
display = meta_get_display ();
|
||||||
|
|
||||||
/* Post-initialization, ensure the input focus is in sync */
|
/* Post-initialization, ensure the input focus is in sync */
|
||||||
@ -176,7 +176,7 @@ meta_wayland_seat_set_capabilities (MetaWaylandSeat *seat,
|
|||||||
meta_wayland_keyboard_disable (seat->keyboard);
|
meta_wayland_keyboard_disable (seat->keyboard);
|
||||||
|
|
||||||
if (CAPABILITY_ENABLED (prev_flags, flags, WL_SEAT_CAPABILITY_TOUCH))
|
if (CAPABILITY_ENABLED (prev_flags, flags, WL_SEAT_CAPABILITY_TOUCH))
|
||||||
meta_wayland_touch_enable (seat->touch, seat);
|
meta_wayland_touch_enable (seat->touch);
|
||||||
else if (CAPABILITY_DISABLED (prev_flags, flags, WL_SEAT_CAPABILITY_TOUCH))
|
else if (CAPABILITY_DISABLED (prev_flags, flags, WL_SEAT_CAPABILITY_TOUCH))
|
||||||
meta_wayland_touch_disable (seat->touch);
|
meta_wayland_touch_disable (seat->touch);
|
||||||
|
|
||||||
@ -215,9 +215,15 @@ meta_wayland_seat_new (MetaWaylandCompositor *compositor,
|
|||||||
wl_list_init (&seat->base_resource_list);
|
wl_list_init (&seat->base_resource_list);
|
||||||
seat->wl_display = display;
|
seat->wl_display = display;
|
||||||
|
|
||||||
seat->pointer = g_object_new (META_TYPE_WAYLAND_POINTER, NULL);
|
seat->pointer = g_object_new (META_TYPE_WAYLAND_POINTER,
|
||||||
seat->keyboard = g_object_new (META_TYPE_WAYLAND_KEYBOARD, NULL);
|
"seat", seat,
|
||||||
seat->touch = g_object_new (META_TYPE_WAYLAND_TOUCH, NULL);
|
NULL);
|
||||||
|
seat->keyboard = g_object_new (META_TYPE_WAYLAND_KEYBOARD,
|
||||||
|
"seat", seat,
|
||||||
|
NULL);
|
||||||
|
seat->touch = g_object_new (META_TYPE_WAYLAND_TOUCH,
|
||||||
|
"seat", seat,
|
||||||
|
NULL);
|
||||||
|
|
||||||
meta_wayland_data_device_init (&seat->data_device);
|
meta_wayland_data_device_init (&seat->data_device);
|
||||||
|
|
||||||
|
@ -455,9 +455,11 @@ touch_info_free (MetaWaylandTouchInfo *touch_info)
|
|||||||
void
|
void
|
||||||
meta_wayland_touch_cancel (MetaWaylandTouch *touch)
|
meta_wayland_touch_cancel (MetaWaylandTouch *touch)
|
||||||
{
|
{
|
||||||
|
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (touch);
|
||||||
|
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
|
||||||
GList *surfaces, *s;
|
GList *surfaces, *s;
|
||||||
|
|
||||||
if (touch->seat == NULL)
|
if (!meta_wayland_seat_has_touch (seat))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
surfaces = s = touch_get_surfaces (touch, FALSE);
|
surfaces = s = touch_get_surfaces (touch, FALSE);
|
||||||
@ -517,12 +519,10 @@ evdev_filter_func (struct libinput_event *event,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_touch_enable (MetaWaylandTouch *touch,
|
meta_wayland_touch_enable (MetaWaylandTouch *touch)
|
||||||
MetaWaylandSeat *seat)
|
|
||||||
{
|
{
|
||||||
ClutterDeviceManager *manager;
|
ClutterDeviceManager *manager;
|
||||||
|
|
||||||
touch->seat = seat;
|
|
||||||
touch->touch_surfaces = g_hash_table_new_full (NULL, NULL, NULL,
|
touch->touch_surfaces = g_hash_table_new_full (NULL, NULL, NULL,
|
||||||
(GDestroyNotify) touch_surface_free);
|
(GDestroyNotify) touch_surface_free);
|
||||||
touch->touches = g_hash_table_new_full (NULL, NULL, NULL,
|
touch->touches = g_hash_table_new_full (NULL, NULL, NULL,
|
||||||
@ -551,7 +551,6 @@ meta_wayland_touch_disable (MetaWaylandTouch *touch)
|
|||||||
|
|
||||||
g_clear_pointer (&touch->touch_surfaces, (GDestroyNotify) g_hash_table_unref);
|
g_clear_pointer (&touch->touch_surfaces, (GDestroyNotify) g_hash_table_unref);
|
||||||
g_clear_pointer (&touch->touches, (GDestroyNotify) g_hash_table_unref);
|
g_clear_pointer (&touch->touches, (GDestroyNotify) g_hash_table_unref);
|
||||||
touch->seat = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -560,9 +559,10 @@ meta_wayland_touch_create_new_resource (MetaWaylandTouch *touch,
|
|||||||
struct wl_resource *seat_resource,
|
struct wl_resource *seat_resource,
|
||||||
uint32_t id)
|
uint32_t id)
|
||||||
{
|
{
|
||||||
|
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||||
struct wl_resource *cr;
|
struct wl_resource *cr;
|
||||||
|
|
||||||
if (touch->seat == NULL)
|
if (!meta_wayland_seat_has_touch (seat))
|
||||||
{
|
{
|
||||||
wl_resource_post_error (seat_resource, WL_DISPLAY_ERROR_INVALID_METHOD,
|
wl_resource_post_error (seat_resource, WL_DISPLAY_ERROR_INVALID_METHOD,
|
||||||
"Cannot retrieve touch interface without touch capability");
|
"Cannot retrieve touch interface without touch capability");
|
||||||
|
@ -40,8 +40,6 @@ struct _MetaWaylandTouch
|
|||||||
{
|
{
|
||||||
MetaWaylandInputDevice parent;
|
MetaWaylandInputDevice parent;
|
||||||
|
|
||||||
MetaWaylandSeat *seat;
|
|
||||||
|
|
||||||
struct wl_list resource_list;
|
struct wl_list resource_list;
|
||||||
|
|
||||||
GHashTable *touch_surfaces; /* HT of MetaWaylandSurface->MetaWaylandTouchSurface */
|
GHashTable *touch_surfaces; /* HT of MetaWaylandSurface->MetaWaylandTouchSurface */
|
||||||
@ -51,8 +49,7 @@ struct _MetaWaylandTouch
|
|||||||
guint64 frame_slots;
|
guint64 frame_slots;
|
||||||
};
|
};
|
||||||
|
|
||||||
void meta_wayland_touch_enable (MetaWaylandTouch *touch,
|
void meta_wayland_touch_enable (MetaWaylandTouch *touch);
|
||||||
MetaWaylandSeat *seat);
|
|
||||||
|
|
||||||
void meta_wayland_touch_disable (MetaWaylandTouch *touch);
|
void meta_wayland_touch_disable (MetaWaylandTouch *touch);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user