[gtk+/wip/wayland-tablet-v2: 14/19] wayland: Create/expose pad devices



commit d1606536dc107869f9cfba82813aaacad5f40abe
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 4 19:42:23 2016 +0200

    wayland: Create/expose pad devices

 gdk/wayland/gdkdevice-wayland.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index d7fbfae..c5cf1ed 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -2764,6 +2764,14 @@ _gdk_wayland_seat_remove_tablet_pad (GdkWaylandSeat          *seat,
     GDK_WAYLAND_DEVICE_MANAGER (seat->device_manager);
 
   seat->tablet_pads = g_list_remove (seat->tablet_pads, pad);
+
+  device_manager->devices =
+    g_list_remove (device_manager->devices, pad->device);
+  g_signal_emit_by_name (device_manager, "device-removed", pad->device);
+
+  _gdk_device_set_associated_device (pad->device, NULL);
+
+  g_object_unref (pad->device);
   g_free (pad);
 }
 
@@ -4087,7 +4095,26 @@ static void
 tablet_pad_handle_done (void                     *data,
                         struct zwp_tablet_pad_v2 *wp_tablet_pad)
 {
+  GdkWaylandTabletPadData *pad = data;
+  GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (pad->seat);
+  GdkWaylandDeviceManager *device_manager =
+    GDK_WAYLAND_DEVICE_MANAGER (seat->device_manager);
+
   g_debug (G_STRLOC ": %s pad = %p", G_STRFUNC, wp_tablet_pad);
+
+  pad->device =
+    g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD,
+                  "name", "Pad device",
+                  "type", GDK_DEVICE_TYPE_SLAVE,
+                  "input-source", GDK_SOURCE_TABLET_PAD,
+                  "input-mode", GDK_MODE_SCREEN,
+                  "display", gdk_seat_get_display (pad->seat),
+                  "device-manager", device_manager,
+                  "seat", seat,
+                  NULL);
+
+  _gdk_device_set_associated_device (pad->device, seat->master_keyboard);
+  g_signal_emit_by_name (device_manager, "device-added", pad->device);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]