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



commit 291878830a2c24e2f920cb204ecf1700bd608e04
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Dec 14 15:44:29 2015 +0100

    win32: Use GdkSeatDefault to implement GdkSeat

 gdk/win32/gdkdevicemanager-win32.c |   11 +++++++++++
 gdk/win32/gdkdnd-win32.c           |    9 +++++++++
 gdk/win32/gdkevents-win32.c        |    9 +++++++++
 3 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/gdk/win32/gdkdevicemanager-win32.c b/gdk/win32/gdkdevicemanager-win32.c
index 6d59aac..e6a239c 100644
--- a/gdk/win32/gdkdevicemanager-win32.c
+++ b/gdk/win32/gdkdevicemanager-win32.c
@@ -30,6 +30,7 @@
 #include "gdkdevice-virtual.h"
 #include "gdkdevice-wintab.h"
 #include "gdkdisplayprivate.h"
+#include "gdkseatdefaultprivate.h"
 
 #define WINTAB32_DLL "Wintab32.dll"
 
@@ -705,6 +706,7 @@ static void
 gdk_device_manager_win32_constructed (GObject *object)
 {
   GdkDeviceManagerWin32 *device_manager;
+  GdkSeat *seat;
 
   device_manager = GDK_DEVICE_MANAGER_WIN32 (object);
   device_manager->core_pointer =
@@ -739,6 +741,13 @@ gdk_device_manager_win32_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 (gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object)), seat);
+  gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), device_manager->system_pointer);
+  gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), device_manager->system_keyboard);
+  g_object_unref (seat);
 }
 
 static GList *
@@ -1055,6 +1064,7 @@ _gdk_input_other_event (GdkEvent  *event,
          if (source_device->sends_core)
            gdk_event_set_device (event, device_manager->core_pointer);
           gdk_event_set_source_device (event, GDK_DEVICE (source_device));
+          gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
 
           event->button.axes = g_new (gdouble, num_axes);
          gdk_window_get_origin (window, &root_x, &root_y);
@@ -1087,6 +1097,7 @@ _gdk_input_other_event (GdkEvent  *event,
           event->motion.is_hint = FALSE;
           gdk_event_set_device (event, device_manager->core_pointer);
           gdk_event_set_source_device (event, GDK_DEVICE (source_device));
+          gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
 
           event->motion.axes = g_new (gdouble, num_axes);
          gdk_window_get_origin (window, &root_x, &root_y);
diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c
index f0a1f97..e1d5d10 100644
--- a/gdk/win32/gdkdnd-win32.c
+++ b/gdk/win32/gdkdnd-win32.c
@@ -426,6 +426,7 @@ dnd_event_put (GdkEventType    type,
     g_object_ref (e->dnd.window);
 
   gdk_event_set_device (e, gdk_drag_context_get_device (context));
+  gdk_event_set_seat (e, gdk_device_get_seat (gdk_drag_context_get_device (context)));
 
   GDK_NOTE (EVENTS, _gdk_win32_print_event (e));
   gdk_event_put (e);
@@ -1460,6 +1461,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
       event->dnd.type = GDK_DROP_START;
       event->dnd.context = current_dest_drag;
       gdk_event_set_device (event, gdk_drag_context_get_device (current_dest_drag));
+      gdk_event_set_seat (event, gdk_device_get_seat (gdk_drag_context_get_device (current_dest_drag)));
 
       hdrop = (HANDLE) msg->wParam;
       DragQueryPoint (hdrop, &pt);
@@ -1641,6 +1643,7 @@ local_send_leave (GdkDragContext *context,
       tmp_event->dnd.context = g_object_ref (current_dest_drag);
       tmp_event->dnd.time = GDK_CURRENT_TIME; /* FIXME? */
       gdk_event_set_device (tmp_event, gdk_drag_context_get_device (context));
+      gdk_event_set_seat (tmp_event, gdk_device_get_seat (gdk_drag_context_get_device (context)));
 
       current_dest_drag = NULL;
 
@@ -1696,6 +1699,7 @@ local_send_enter (GdkDragContext *context,
   tmp_event->dnd.context = g_object_ref (new_context);
   tmp_event->dnd.time = GDK_CURRENT_TIME; /* FIXME? */
   gdk_event_set_device (tmp_event, gdk_drag_context_get_device (context));
+  gdk_event_set_seat (tmp_event, gdk_device_get_seat (gdk_drag_context_get_device (context)));
 
   current_dest_drag = new_context;
 
@@ -1730,6 +1734,7 @@ local_send_motion (GdkDragContext *context,
       tmp_event->dnd.context = g_object_ref (current_dest_drag);
       tmp_event->dnd.time = time;
       gdk_event_set_device (tmp_event, gdk_drag_context_get_device (current_dest_drag));
+      gdk_event_set_seat (tmp_event, gdk_device_get_seat (gdk_drag_context_get_device (current_dest_drag)));
 
       current_dest_drag->suggested_action = action;
 
@@ -1771,6 +1776,7 @@ local_send_drop (GdkDragContext *context,
       tmp_event->dnd.context = g_object_ref (current_dest_drag);
       tmp_event->dnd.time = GDK_CURRENT_TIME;
       gdk_event_set_device (tmp_event, gdk_drag_context_get_device (current_dest_drag));
+      gdk_event_set_seat (tmp_event, gdk_device_get_seat (gdk_drag_context_get_device (current_dest_drag)));
 
       context_win32 = GDK_WIN32_DRAG_CONTEXT (current_dest_drag);
       tmp_event->dnd.x_root = context_win32->ole2_dnd_last_pt.x + _gdk_offset_x;
@@ -2167,6 +2173,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
          tmp_event->dnd.context = g_object_ref (context);
          tmp_event->dnd.time = time;
           gdk_event_set_device (tmp_event, gdk_drag_context_get_device (context));
+          gdk_event_set_seat (tmp_event, gdk_device_get_seat (gdk_drag_context_get_device (context)));
 
          GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
          gdk_event_put (tmp_event);
@@ -2291,6 +2298,7 @@ gdk_win32_drag_context_drag_status (GdkDragContext *context,
          tmp_event->dnd.context = g_object_ref (src_context);
          tmp_event->dnd.time = GDK_CURRENT_TIME; /* FIXME? */
           gdk_event_set_device (tmp_event, gdk_drag_context_get_device (src_context));
+          gdk_event_set_seat (tmp_event, gdk_device_get_seat (gdk_drag_context_get_device (src_context)));
 
          if (action == GDK_ACTION_DEFAULT)
            action = 0;
@@ -2345,6 +2353,7 @@ gdk_win32_drag_context_drop_finish (GdkDragContext *context,
          tmp_event->dnd.send_event = FALSE;
          tmp_event->dnd.context = g_object_ref (src_context);
     gdk_event_set_device (tmp_event, gdk_drag_context_get_device (src_context));
+    gdk_event_set_seat (tmp_event, gdk_device_get_seat (gdk_drag_context_get_device (src_context)));
 
          GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
          gdk_event_put (tmp_event);
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index e3bfcaf..77241ad 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -201,6 +201,7 @@ generate_focus_event (GdkDeviceManager *device_manager,
   event->focus_change.in = in;
   gdk_event_set_device (event, device);
   gdk_event_set_source_device (event, source_device);
+  gdk_event_set_seat (event, gdk_device_get_seat (device));
 
   _gdk_win32_append_event (event);
 }
@@ -233,6 +234,7 @@ generate_grab_broken_event (GdkDeviceManager *device_manager,
   event->grab_broken.grab_window = grab_window;
   gdk_event_set_device (event, device);
   gdk_event_set_source_device (event, source_device);
+  gdk_event_set_seat (event, gdk_device_get_seat (device));
 
   _gdk_win32_append_event (event);
 }
@@ -1141,6 +1143,7 @@ send_crossing_event (GdkDisplay                 *display,
   event->crossing.state = mask;
   gdk_event_set_device (event, device_manager->core_pointer);
   gdk_event_set_source_device (event, device_manager->system_pointer);
+  gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
 
   _gdk_win32_append_event (event);
 }
@@ -1675,6 +1678,7 @@ generate_button_event (GdkEventType      type,
   event->button.button = button;
   gdk_event_set_device (event, device_manager->core_pointer);
   gdk_event_set_source_device (event, device_manager->system_pointer);
+  gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
 
   _gdk_win32_append_event (event);
 }
@@ -2120,6 +2124,7 @@ gdk_event_translate (MSG  *msg,
       event->key.hardware_keycode = msg->wParam;
       gdk_event_set_device (event, device_manager_win32->core_keyboard);
       gdk_event_set_source_device (event, device_manager_win32->system_keyboard);
+      gdk_event_set_seat (event, gdk_device_get_seat (device_manager_win32->core_keyboard));
       if (HIWORD (msg->lParam) & KF_EXTENDED)
        {
          switch (msg->wParam)
@@ -2270,6 +2275,7 @@ gdk_event_translate (MSG  *msg,
              event->key.window = window;
              gdk_event_set_device (event, device_manager_win32->core_keyboard);
              gdk_event_set_source_device (event, device_manager_win32->system_keyboard);
+              gdk_event_set_seat (event, gdk_device_get_seat (device_manager_win32->core_keyboard));
              build_wm_ime_composition_event (event, msg, wbuf[i], key_state);
 
              _gdk_win32_append_event (event);
@@ -2282,6 +2288,7 @@ gdk_event_translate (MSG  *msg,
              event->key.window = window;
              gdk_event_set_device (event, device_manager_win32->core_keyboard);
              gdk_event_set_source_device (event, device_manager_win32->system_keyboard);
+              gdk_event_set_seat (event, gdk_device_get_seat (device_manager_win32->core_keyboard));
              build_wm_ime_composition_event (event, msg, wbuf[i], key_state);
 
              _gdk_win32_append_event (event);
@@ -2477,6 +2484,7 @@ gdk_event_translate (MSG  *msg,
          event->motion.is_hint = FALSE;
          gdk_event_set_device (event, device_manager_win32->core_pointer);
          gdk_event_set_source_device (event, device_manager_win32->system_pointer);
+          gdk_event_set_seat (event, gdk_device_get_seat (device_manager_win32->core_pointer));
 
          _gdk_win32_append_event (event);
        }
@@ -2599,6 +2607,7 @@ gdk_event_translate (MSG  *msg,
       event->scroll.state = build_pointer_event_state (msg);
       gdk_event_set_device (event, device_manager_win32->core_pointer);
       gdk_event_set_source_device (event, device_manager_win32->system_pointer);
+      gdk_event_set_seat (event, gdk_device_get_seat (device_manager_win32->core_pointer));
 
       _gdk_win32_append_event (event);
 


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