GDK W32: adapt to GdkDragProtocol removal
authorРуслан Ижбулатов <lrn1986@gmail.com>
Sat, 24 Mar 2018 16:28:52 +0000 (16:28 +0000)
committerРуслан Ижбулатов <lrn1986@gmail.com>
Thu, 29 Mar 2018 17:43:54 +0000 (17:43 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=773299

gdk/win32/gdkdnd-win32.c
gdk/win32/gdkevents-win32.c
gdk/win32/gdkmain-win32.c
gdk/win32/gdkprivate-win32.h
gdk/win32/gdkwin32dnd-private.h

index e4d00ce0efe3b83e6c4593c38685f83ded43a4e8..92cc8c88cd2a7fbd91e57fa4645fcb6948c587e6 100644 (file)
@@ -265,7 +265,7 @@ gdk_drag_context_new (GdkDisplay        *display,
   g_set_object (&context->source_surface, source_surface);
   g_set_object (&context->dest_surface, dest_surface);
   context->actions = actions;
-  context->protocol = protocol;
+  context_win32->protocol = protocol;
 
   return context;
 }
@@ -1834,7 +1834,7 @@ local_send_leave (GdkDragContext *context,
                          current_dest_drag));
 
   if ((current_dest_drag != NULL) &&
-      (current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
+      (GDK_WIN32_DRAG_CONTEXT (current_dest_drag)->protocol == GDK_DRAG_PROTO_LOCAL) &&
       (current_dest_drag->source_surface == context->source_surface))
     {
       tmp_event = gdk_event_new (GDK_DRAG_LEAVE);
@@ -1915,7 +1915,7 @@ local_send_motion (GdkDragContext *context,
                          current_dest_drag));
 
   if ((current_dest_drag != NULL) &&
-      (current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
+      (GDK_WIN32_DRAG_CONTEXT (current_dest_drag)->protocol == GDK_DRAG_PROTO_LOCAL) &&
       (current_dest_drag->source_surface == context->source_surface))
     {
       GdkWin32DragContext *current_dest_drag_win32;
@@ -1956,7 +1956,7 @@ local_send_drop (GdkDragContext *context,
                          current_dest_drag));
 
   if ((current_dest_drag != NULL) &&
-      (current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
+      (GDK_WIN32_DRAG_CONTEXT (current_dest_drag)->protocol == GDK_DRAG_PROTO_LOCAL) &&
       (current_dest_drag->source_surface == context->source_surface))
     {
       GdkWin32DragContext *context_win32;
@@ -1993,7 +1993,7 @@ gdk_drag_do_leave (GdkDragContext *context,
 
       if (!use_ole2_dnd)
        {
-         if (context->protocol == GDK_DRAG_PROTO_LOCAL)
+         if (GDK_WIN32_DRAG_CONTEXT (context)->protocol == GDK_DRAG_PROTO_LOCAL)
            local_send_leave (context, time);
        }
 
@@ -2320,7 +2320,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
          if (dest_surface)
            {
              g_set_object (&context->dest_surface, dest_surface);
-             context->protocol = protocol;
+             context_win32->protocol = protocol;
 
              switch (protocol)
                {
@@ -2368,7 +2368,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
        {
          if (context_win32->drag_status == GDK_DRAG_STATUS_DRAG)
            {
-             switch (context->protocol)
+             switch (context_win32->protocol)
                {
                case GDK_DRAG_PROTO_LOCAL:
                  local_send_motion (context, x_root, y_root, suggested_action, time);
@@ -2417,7 +2417,7 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *context,
   if (!use_ole2_dnd)
     {
       if (context->dest_surface &&
-         context->protocol == GDK_DRAG_PROTO_LOCAL)
+         GDK_WIN32_DRAG_CONTEXT (context)->protocol == GDK_DRAG_PROTO_LOCAL)
        local_send_drop (context, time);
     }
   else
@@ -2507,7 +2507,7 @@ gdk_win32_drag_context_drop_reply (GdkDragContext *context,
   if (!use_ole2_dnd)
     if (context->dest_surface)
       {
-       if (context->protocol == GDK_DRAG_PROTO_WIN32_DROPFILES)
+       if (GDK_WIN32_DRAG_CONTEXT (context)->protocol == GDK_DRAG_PROTO_WIN32_DROPFILES)
          _gdk_dropfiles_store (NULL);
       }
 }
@@ -2646,7 +2646,7 @@ gdk_win32_drag_context_drop_status (GdkDragContext *context)
 static GdkAtom
 gdk_win32_drag_context_get_selection (GdkDragContext *context)
 {
-  switch (context->protocol)
+  switch (GDK_WIN32_DRAG_CONTEXT (context)->protocol)
     {
     case GDK_DRAG_PROTO_LOCAL:
       return _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_LOCAL_DND_SELECTION);
index 6f8f7e7caa3176cc5c80a21279e4006335fba55b..dab4d7542fb5111be87763c36cc3364a74597610 100644 (file)
@@ -56,6 +56,7 @@
 #include "gdkdeviceprivate.h"
 #include "gdkdevice-wintab.h"
 #include "gdkwin32dnd.h"
+#include "gdkwin32dnd-private.h"
 #include "gdkdisplay-win32.h"
 //#include "gdkselection-win32.h"
 #include "gdkdndprivate.h"
@@ -867,7 +868,7 @@ _gdk_win32_print_event (const GdkEvent *event)
       if (event->dnd.context != NULL)
        g_print ("ctx:%p: %s %s src:%p dest:%p",
                 event->dnd.context,
-                _gdk_win32_drag_protocol_to_string (event->dnd.context->protocol),
+                _gdk_win32_drag_protocol_to_string (GDK_WIN32_DRAG_CONTEXT (event->dnd.context)->protocol),
                 event->dnd.context->is_source ? "SOURCE" : "DEST",
                 event->dnd.context->source_surface == NULL ? NULL : GDK_SURFACE_HWND (event->dnd.context->source_surface),
                 event->dnd.context->dest_surface == NULL ? NULL : GDK_SURFACE_HWND (event->dnd.context->dest_surface));
index d76106f3cd69608c108ee0f1279418cd4d5f9f20..cf73d6cf5147793e60427a95e5d96c34267c1ac1 100644 (file)
@@ -268,9 +268,6 @@ _gdk_win32_drag_protocol_to_string (GdkDragProtocol protocol)
   switch (protocol)
     {
 #define CASE(x) case GDK_DRAG_PROTO_##x: return #x
-      CASE (MOTIF);
-      CASE (XDND);
-      CASE (ROOTWIN);
       CASE (NONE);
       CASE (WIN32_DROPFILES);
       CASE (OLE2);
index 18684a914049f81100e52f9b35e5a664e3e19b08..7cea29150fb0a00c70a188db9bb85dbb964a434c 100644 (file)
@@ -151,6 +151,14 @@ typedef enum {
   GDK_WIN32_PE_INUSE
 } GdkWin32PalEntryState;
 
+typedef enum
+{
+  GDK_DRAG_PROTO_NONE = 0,
+  GDK_DRAG_PROTO_WIN32_DROPFILES,
+  GDK_DRAG_PROTO_OLE2,
+  GDK_DRAG_PROTO_LOCAL,
+} GdkDragProtocol;
+
 GType _gdk_gc_win32_get_type (void);
 
 gulong _gdk_win32_get_next_tick (gulong suggested_tick);
index 4f8f872ed79d775bce9fc0956d931a57e726b433..1492313322ebd5e409c0ea0e0d61843971726ea9 100644 (file)
@@ -39,6 +39,7 @@ struct _GdkWin32DragContextUtilityData
 struct _GdkWin32DragContext
 {
   GdkDragContext context;
+  GdkDragProtocol protocol;
   GdkSurface *ipc_window;
   GdkSurface *drag_surface;
   GdkCursor *cursor;
@@ -66,6 +67,7 @@ struct _GdkWin32DragContextClass
 struct _GdkWin32DropContext
 {
   GdkDragContext context;
+  GdkDragProtocol protocol;
   GdkDragAction actions;
   GdkDragAction current_action;