[gtk+/wip/garnacho/gdkseat: 73/74] quartz: Use GdkSeatDefault to implement GdkSeat



commit 345daf069fcbc35de0e5b9a7556268ae761f4d75
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Dec 14 15:44:15 2015 +0100

    quartz: Use GdkSeatDefault to implement GdkSeat

 gdk/quartz/GdkQuartzNSWindow.c            |   10 ++++++++--
 gdk/quartz/gdkdevicemanager-core-quartz.c |    8 ++++++++
 gdk/quartz/gdkevents-quartz.c             |    8 ++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/gdk/quartz/GdkQuartzNSWindow.c b/gdk/quartz/GdkQuartzNSWindow.c
index f757d29..d485531 100644
--- a/gdk/quartz/GdkQuartzNSWindow.c
+++ b/gdk/quartz/GdkQuartzNSWindow.c
@@ -590,6 +590,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
   event->dnd.time = GDK_CURRENT_TIME;
 
   gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
+  gdk_event_set_seat (event, gdk_device_get_seat (gdk_drag_context_get_device (current_context)));
 
   _gdk_event_emit (event);
 
@@ -620,6 +621,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
   event->dnd.time = GDK_CURRENT_TIME;
 
   gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
+  gdk_event_set_seat (event, gdk_device_get_seat (gdk_drag_context_get_device (current_context)));
 
   _gdk_event_emit (event);
 
@@ -648,6 +650,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
   event->dnd.y_root = gy;
 
   gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
+  gdk_event_set_seat (event, gdk_device_get_seat (gdk_drag_context_get_device (current_context)));
 
   _gdk_event_emit (event);
 
@@ -675,6 +678,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
   event->dnd.y_root = gy;
 
   gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
+  gdk_event_set_seat (event, gdk_device_get_seat (gdk_drag_context_get_device (current_context)));
 
   _gdk_event_emit (event);
 
@@ -695,6 +699,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
 {
   GdkEvent *event;
   GdkScreen *screen;
+  GdkDevice *device;
 
   g_assert (_gdk_quartz_drag_source_context != NULL);
 
@@ -730,8 +735,9 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
         }
     }
 
-  gdk_event_set_device (event,
-                        gdk_drag_context_get_device (_gdk_quartz_drag_source_context));
+  device = gdk_drag_context_get_device (_gdk_quartz_drag_source_context);
+  gdk_event_set_device (event, device);
+  gdk_event_set_seat (event, gdk_device_get_seat (device));
 
   _gdk_event_emit (event);
 
diff --git a/gdk/quartz/gdkdevicemanager-core-quartz.c b/gdk/quartz/gdkdevicemanager-core-quartz.c
index 95d9f4f..932528a 100644
--- a/gdk/quartz/gdkdevicemanager-core-quartz.c
+++ b/gdk/quartz/gdkdevicemanager-core-quartz.c
@@ -20,10 +20,12 @@
 #include <gdk/gdktypes.h>
 #include <gdk/gdkdevicemanager.h>
 #include <gdk/gdkdeviceprivate.h>
+#include <gdk/gdkseatdefaultprivate.h>
 #include <gdk/gdkdevicemanagerprivate.h>
 #include "gdkdevicemanager-core-quartz.h"
 #include "gdkquartzdevice-core.h"
 #include "gdkkeysyms.h"
+#include "gdkprivate-quartz.h"
 
 
 #define HAS_FOCUS(toplevel)                           \
@@ -104,6 +106,7 @@ gdk_quartz_device_manager_core_constructed (GObject *object)
 {
   GdkQuartzDeviceManagerCore *device_manager;
   GdkDisplay *display;
+  GdkSeat *seat;
 
   device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (object);
   display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
@@ -112,6 +115,11 @@ gdk_quartz_device_manager_core_constructed (GObject *object)
 
   _gdk_device_set_associated_device (device_manager->core_pointer, device_manager->core_keyboard);
   _gdk_device_set_associated_device (device_manager->core_keyboard, device_manager->core_pointer);
+
+  seat = gdk_seat_default_new_for_master_pair (device_manager->core_pointer,
+                                               device_manager->core_keyboard);
+  gdk_display_add_seat (display, seat);
+  g_object_unref (seat);
 }
 
 static GList *
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index 2dc6319..0678c78 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -507,6 +507,7 @@ create_focus_event (GdkWindow *window,
 
   device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
   gdk_event_set_device (event, device_manager->core_keyboard);
+  gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_keyboard));
 
   return event;
 }
@@ -540,6 +541,7 @@ generate_motion_event (GdkWindow *window)
                         _gdk_quartz_events_get_current_mouse_modifiers ();
   event->motion.is_hint = FALSE;
   event->motion.device = _gdk_display->core_pointer;
+  gdk_event_set_seat (event, gdk_device_get_seat (_gdk_display->core_pointer));
 
   append_event (event, TRUE);
 }
@@ -876,6 +878,7 @@ fill_crossing_event (GdkWindow       *toplevel,
                          _gdk_quartz_events_get_current_mouse_modifiers ();
 
   gdk_event_set_device (event, _gdk_display->core_pointer);
+  gdk_event_set_seat (event, gdk_device_get_seat (_gdk_display->core_pointer));
 
   /* FIXME: Focus and button state? */
 }
@@ -926,6 +929,7 @@ fill_button_event (GdkWindow *window,
   event->button.state = state;
   event->button.button = get_mouse_button_from_ns_event (nsevent);
   event->button.device = _gdk_display->core_pointer;
+  gdk_event_set_seat (event, gdk_device_get_seat (_gdk_display->core_pointer));
 }
 
 static void
@@ -949,6 +953,7 @@ fill_motion_event (GdkWindow *window,
                         _gdk_quartz_events_get_current_mouse_modifiers ();
   event->motion.is_hint = FALSE;
   event->motion.device = _gdk_display->core_pointer;
+  gdk_event_set_seat (event, gdk_device_get_seat (_gdk_display->core_pointer));
 }
 
 static void
@@ -979,6 +984,7 @@ fill_scroll_event (GdkWindow          *window,
   event->scroll.device = _gdk_display->core_pointer;
   event->scroll.delta_x = delta_x;
   event->scroll.delta_y = delta_y;
+  gdk_event_set_seat (event, gdk_device_get_seat (_gdk_display->core_pointer));
 }
 
 static void
@@ -1005,6 +1011,7 @@ fill_key_event (GdkWindow    *window,
 
   device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
   gdk_event_set_device (event, device_manager->core_keyboard);
+  gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_keyboard));
   
   gdk_keymap_translate_keyboard_state (gdk_keymap_get_for_display (_gdk_display),
                                       event->key.hardware_keycode,
@@ -1171,6 +1178,7 @@ _gdk_quartz_synthesize_null_key_event (GdkWindow *window)
   event->key.keyval = GDK_KEY_VoidSymbol;
   device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
   gdk_event_set_device (event, device_manager->core_keyboard);
+  gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_keyboard));
   append_event(event, FALSE);
 }
 


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