Re: GTK TreeView control in Windows (DND issue)

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

 



Just a final footnote to this issue (hopefully):-

I noticed pbor's comment in bugzilla about the inelegant use of 'dest_window' so I checked our mods and realised that we'd probably reverted too much of the function.  In fact, only the first 10 lines or so need to be reverted.  The remainder can be left in its 2.20 state.  In fact, it's quite important to do it this way, since (in the more recent gdk library) the decision to use OLE2 style DnD is dependent on a runtime condition, rather than the previous compile time preprocessor directive.  By reverting the entire function we'd effectively undone that decision for this particular function.  My function in its entirety is shown below.  Currently I don't have a bugzilla account but I'll create one and transfer this comment over to bugzilla if that's more convenient.

John

void
gdk_drag_find_window_for_screen (GdkDragContext *context,
                                                          GdkWindow *drag_window,
                                                          GdkScreen *screen,
                                                          gint x_root,
                                                          gint y_root,
                                                          GdkWindow **dest_window,
                                                          GdkDragProtocol *protocol)
{
HWND hwnd;

////////  This is the section we reverted
find_window_enum_arg a;

      a.x = x_root - _gdk_offset_x;
      a.y = y_root - _gdk_offset_y;
      a.ignore = drag_window ? GDK_WINDOW_HWND (drag_window) : NULL;
      a.result = NULL;

      EnumWindows (find_window_enum_proc, (LPARAM) &a);

      if (a.result == NULL)
            *dest_window = NULL;
      else
      {
            hwnd = a.result; // Added by JE - 19-Sept-2011

////////  From here forward, it's back to the 2.20 code
            *dest_window = gdk_win32_handle_table_lookup (hwnd);

            if (*dest_window)
                  g_object_ref (*dest_window);
            else
                  *dest_window = gdk_window_foreign_new_for_display (_gdk_display, hwnd);

            if (use_ole2_dnd)
                  *protocol = GDK_DRAG_PROTO_OLE2;
            else if (context->source_window)
                  *protocol = GDK_DRAG_PROTO_LOCAL;
            else
                  *protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
      }

      GDK_NOTE (DND,
                  g_print ("gdk_drag_find_window: %p %+d%+d: %p: %p %s\n",
                  (drag_window ? GDK_WINDOW_HWND (drag_window) : NULL),
                  x_root, y_root,
                  hwnd,
                  (*dest_window ? GDK_WINDOW_HWND (*dest_window) : NULL),
                      _gdk_win32_drag_protocol_to_string (*protocol)));
}
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux