G_DEFINE_TYPE (GdkWaylandSeat, gdk_wayland_seat, GDK_TYPE_SEAT)
-struct _GdkWaylandDevice
+typedef struct
{
- GdkDevice parent_instance;
GdkWaylandTouchData *emulating_touch; /* Only used on wd->logical_touch */
GdkWaylandPointerData *pointer;
-};
-
-struct _GdkWaylandDeviceClass
-{
- GdkDeviceClass parent_class;
-};
+} GdkWaylandDevicePrivate;
-G_DEFINE_TYPE (GdkWaylandDevice, gdk_wayland_device, GDK_TYPE_DEVICE)
+G_DEFINE_TYPE_WITH_PRIVATE (GdkWaylandDevice, gdk_wayland_device, GDK_TYPE_DEVICE)
struct _GdkWaylandDevicePad
{
return NULL;
}
+static GdkWaylandPointerData *
+gdk_wayland_device_get_pointer (GdkWaylandDevice *wayland_device)
+{
+ GdkWaylandDevicePrivate *priv =
+ gdk_wayland_device_get_instance_private (wayland_device);
+
+ return priv->pointer;
+}
+
+static void
+gdk_wayland_device_set_pointer (GdkWaylandDevice *wayland_device,
+ GdkWaylandPointerData *pointer)
+{
+ GdkWaylandDevicePrivate *priv =
+ gdk_wayland_device_get_instance_private (wayland_device);
+
+ priv->pointer = pointer;
+}
+
+static GdkWaylandTouchData *
+gdk_wayland_device_get_emulating_touch (GdkWaylandDevice *wayland_device)
+{
+ GdkWaylandDevicePrivate *priv =
+ gdk_wayland_device_get_instance_private (wayland_device);
+
+ return priv->emulating_touch;
+}
+
+static void
+gdk_wayland_device_set_emulating_touch (GdkWaylandDevice *wayland_device,
+ GdkWaylandTouchData *touch)
+{
+ GdkWaylandDevicePrivate *priv =
+ gdk_wayland_device_get_instance_private (wayland_device);
+
+ priv->emulating_touch = touch;
+}
static gboolean
gdk_wayland_device_update_surface_cursor (GdkDevice *device)
{
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
- GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer;
+ GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
+ GdkWaylandPointerData *pointer =
+ gdk_wayland_device_get_pointer (wayland_device);
struct wl_buffer *buffer;
int x, y, w, h, scale;
guint next_image_index, next_image_delay;
GdkCursor *cursor)
{
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
- GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer;
+ GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
+ GdkWaylandPointerData *pointer =
+ gdk_wayland_device_get_pointer (wayland_device);
if (device == seat->logical_touch)
return;
device_get_modifiers (GdkDevice *device)
{
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
- GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer;
+ GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
+ GdkWaylandPointerData *pointer =
+ gdk_wayland_device_get_pointer (wayland_device);
GdkModifierType mask;
mask = seat->key_modifiers;
double *win_y,
GdkModifierType *mask)
{
+ GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
GdkWaylandPointerData *pointer;
double x, y;
if (mask)
*mask = device_get_modifiers (device);
- pointer = GDK_WAYLAND_DEVICE (device)->pointer;
+ pointer = gdk_wayland_device_get_pointer (wayland_device);
if (pointer->focus == surface)
{
gdk_wayland_device_get_focus (GdkDevice *device)
{
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
+ GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
GdkWaylandPointerData *pointer;
if (device == wayland_seat->logical_keyboard)
return wayland_seat->keyboard_focus;
else
{
- pointer = GDK_WAYLAND_DEVICE (device)->pointer;
+ pointer = gdk_wayland_device_get_pointer (wayland_device);
if (pointer)
return pointer->focus;
guint32 time_)
{
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
- GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer;
+ GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
+ GdkWaylandPointerData *pointer =
+ gdk_wayland_device_get_pointer (wayland_device);
if (GDK_IS_DRAG_SURFACE (surface) &&
gdk_surface_get_mapped (surface))
gdk_wayland_device_ungrab (GdkDevice *device,
guint32 time_)
{
- GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer;
+ GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
+ GdkWaylandPointerData *pointer =
+ gdk_wayland_device_get_pointer (wayland_device);
GdkSurface *prev_focus;
prev_focus = device_maybe_emit_ungrab_crossing (device, time_);
double *win_y,
GdkModifierType *mask)
{
+ GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
GdkWaylandPointerData *pointer;
- pointer = GDK_WAYLAND_DEVICE(device)->pointer;
+ pointer = gdk_wayland_device_get_pointer (wayland_device);
if (!pointer)
return NULL;
mimic_pointer_emulating_touch_info (GdkDevice *device,
GdkWaylandTouchData *touch)
{
+ GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
GdkWaylandPointerData *pointer;
- pointer = GDK_WAYLAND_DEVICE (device)->pointer;
+ pointer = gdk_wayland_device_get_pointer (wayland_device);
g_set_object (&pointer->focus, touch->surface);
pointer->press_serial = pointer->enter_serial = touch->touch_down_serial;
pointer->surface_x = touch->x;
{
GdkWaylandPointerData *pointer;
- pointer = GDK_WAYLAND_DEVICE (seat->logical_touch)->pointer;
+ pointer = gdk_wayland_device_get_pointer (GDK_WAYLAND_DEVICE (seat->logical_touch));
if (pointer->focus == touch->surface)
return;
if (touch->initial_touch)
{
touch_handle_logical_pointer_crossing (seat, touch, time);
- GDK_WAYLAND_DEVICE(seat->logical_touch)->emulating_touch = touch;
+ gdk_wayland_device_set_emulating_touch (GDK_WAYLAND_DEVICE (seat->logical_touch),
+ touch);
mimic_pointer_emulating_touch_info (seat->logical_touch, touch);
}
_gdk_wayland_display_deliver_event (seat->display, event);
if (touch->initial_touch)
- GDK_WAYLAND_DEVICE(seat->logical_touch)->emulating_touch = NULL;
+ gdk_wayland_device_set_emulating_touch (GDK_WAYLAND_DEVICE (seat->logical_touch),
+ NULL);
gdk_wayland_seat_remove_touch (seat, id);
}
GHashTableIter iter;
GdkEvent *event;
- if (GDK_WAYLAND_DEVICE (seat->logical_touch)->emulating_touch)
- {
- touch = GDK_WAYLAND_DEVICE (seat->logical_touch)->emulating_touch;
- GDK_WAYLAND_DEVICE (seat->logical_touch)->emulating_touch = NULL;
- }
+ gdk_wayland_device_set_emulating_touch (GDK_WAYLAND_DEVICE (seat->logical_touch),
+ NULL);
g_hash_table_iter_init (&iter, seat->touches);
"display", display,
"seat", seat,
NULL);
- GDK_WAYLAND_DEVICE (logical_device)->pointer = &tablet->pointer_info;
+
+ gdk_wayland_device_set_pointer (GDK_WAYLAND_DEVICE (logical_device),
+ &tablet->pointer_info);
stylus_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", tablet->name,
"display", seat->display,
"seat", seat,
NULL);
- GDK_WAYLAND_DEVICE (seat->logical_touch)->pointer = &seat->touch_info;
+
+ gdk_wayland_device_set_pointer (GDK_WAYLAND_DEVICE (seat->logical_touch),
+ &seat->touch_info);
_gdk_device_set_associated_device (seat->logical_touch, seat->logical_keyboard);
gdk_seat_device_added (GDK_SEAT (seat), seat->logical_touch);
"seat", seat,
NULL);
- GDK_WAYLAND_DEVICE (seat->logical_pointer)->pointer = &seat->pointer_info;
+ gdk_wayland_device_set_pointer (GDK_WAYLAND_DEVICE (seat->logical_pointer),
+ &seat->pointer_info);
/* keyboard */
seat->logical_keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
pointer_surface_update_scale (GdkDevice *device)
{
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
- GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer;
+ GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
+ GdkWaylandPointerData *pointer =
+ gdk_wayland_device_get_pointer (wayland_device);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
guint32 scale;
GSList *l;
touch = gdk_wayland_seat_get_touch (seat,
GDK_EVENT_SEQUENCE_TO_SLOT (sequence));
- if (GDK_WAYLAND_DEVICE (seat->logical_touch)->emulating_touch == touch)
+ if (touch ==
+ gdk_wayland_device_get_emulating_touch (GDK_WAYLAND_DEVICE (seat->logical_touch)))
{
- GDK_WAYLAND_DEVICE (seat->logical_touch)->emulating_touch = NULL;
+ gdk_wayland_device_set_emulating_touch (GDK_WAYLAND_DEVICE (seat->logical_touch),
+ NULL);
emulate_touch_crossing (touch->surface, NULL,
seat->logical_touch, seat->touch,
touch, GDK_LEAVE_NOTIFY, GDK_CROSSING_NORMAL,