]> Pileus Git - ~andy/gtk/commitdiff
DnD bugfixes (hopefully :). Rasters code is still buggy, methinks - try the dnd in...
authorElliot Lee <sopwith@src.gnome.org>
Tue, 10 Mar 1998 21:57:05 +0000 (21:57 +0000)
committerElliot Lee <sopwith@src.gnome.org>
Tue, 10 Mar 1998 21:57:05 +0000 (21:57 +0000)
gdk/gdk.c
gdk/gdkdnd.c
gdk/gdkglobals.c
gdk/gdkprivate.h
gdk/x11/gdkdnd-x11.c
gdk/x11/gdkglobals-x11.c
gdk/x11/gdkmain-x11.c

index 16d43da2bf6390c3e06b0b61fccce8e83e8f4995..1bffc2a2858405acfb3e3baca7744ce267c9d08a 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -2069,7 +2069,10 @@ gdk_event_translate (GdkEvent *event,
          /* XXX there has to be a better way to do this, perhaps with
             XTranslateCoordinates or XQueryTree - I don't know how,
             and this sort of works */
-         static Window lastwin = None, curwin = None, twin;
+         static Window lastwin = None, curwin = None;
+#if 0
+         Window twin;
+#endif
          Window childwin = gdk_root_window;
          int x, y, ox, oy;
 
@@ -2083,6 +2086,13 @@ gdk_event_translate (GdkEvent *event,
          curwin = gdk_root_window;
          ox = x = xevent->xmotion.x_root;
          oy = y = xevent->xmotion.y_root;
+#if 1
+         curwin = gdk_window_xid_at_coords(xevent->xmotion.x_root,
+                                           xevent->xmotion.y_root,
+                                           gdk_dnd.c->xids);
+         XTranslateCoordinates(gdk_display, gdk_root_window, curwin,
+                               x, y, &x, &y, &childwin);
+#else
          while(childwin != None)
            {
              ox = x; oy = y;
@@ -2095,6 +2105,7 @@ gdk_event_translate (GdkEvent *event,
                                        x, y, &x, &y, &twin);
                }
            }
+#endif
          GDK_NOTE (DND,
            g_print("Drag is now in window %#lx, lastwin was %#lx, ddc = %#lx\n",
                    curwin, lastwin, gdk_dnd.dnd_drag_curwin));
index 28900bbf5d85da003123b8277faf75b48ca6f087..0b1c256b8bb43452d2bd3082b213cd858ab2fe0a 100644 (file)
@@ -26,6 +26,8 @@ gdk_dnd_set_drag_cursors(GdkCursor *default_cursor, GdkCursor *goahead_cursor)
              gdk_window_unref(gdk_dnd.c->drag_pm_ok);
            }
          gdk_dnd.c->drag_pm_default = gdk_dnd.c->drag_pm_ok = NULL;
+         g_list_free(gdk_dnd.c->xids);
+         gdk_dnd.c->xids = NULL;
        }
       gdk_dnd_display_drag_cursor(-1, -1,
                                  gdk_dnd.dnd_drag_target?TRUE:FALSE,
@@ -41,6 +43,7 @@ gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
 {
   g_return_if_fail(default_pixmapwin != NULL);
 
+  g_list_free(gdk_dnd.c->xids); gdk_dnd.c->xids = NULL;
   if(gdk_dnd.c->drag_pm_default)
     gdk_window_unref(gdk_dnd.c->drag_pm_default);
   if(gdk_dnd.c->drag_pm_ok)
@@ -51,9 +54,11 @@ gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
   gdk_window_ref(default_pixmapwin);
   gdk_dnd.c->drag_pm_default = default_pixmapwin;
   gdk_dnd.c->default_hotspot = *default_hotspot;
+  gdk_dnd.c->xids = g_list_append(gdk_dnd.c->xids, ((GdkWindowPrivate *)default_pixmapwin)->xwindow);
   if(goahead_pixmapwin)
     {
       gdk_window_ref(goahead_pixmapwin);
+      gdk_dnd.c->xids = g_list_append(gdk_dnd.c->xids, ((GdkWindowPrivate *)goahead_pixmapwin)->xwindow);
       gdk_dnd.c->drag_pm_ok = goahead_pixmapwin;
       gdk_dnd.c->ok_hotspot = *goahead_hotspot;
     }
index e6644bb6005c72c4e8960f2b5c06f58cdf63d8a8..edfd89fd857c451be1c5d6074dd180f52c024208 100644 (file)
@@ -34,7 +34,7 @@ Atom              gdk_wm_protocols;
 Atom              gdk_wm_window_protocols[2];
 Atom              gdk_selection_property;
 GdkDndCursorInfo  gdk_dnd_cursorinfo = {None, None, NULL, NULL,
-                                       {0,0}, {0,0}};
+                                       {0,0}, {0,0}, NULL};
 GdkDndGlobals     gdk_dnd = {None,None,None,
                             None,None,None,
                             None,
index 481811ef0c06dbabdb03aeee61d59bd4df8b491f..65e9e7200f2d40b4c011b9b8f1025144ba853331 100644 (file)
@@ -146,6 +146,7 @@ struct _GdkDndCursorInfo {
   Cursor         gdk_cursor_dragdefault, gdk_cursor_dragok;
   GdkWindow     *drag_pm_default, *drag_pm_ok;
   GdkPoint       default_hotspot, ok_hotspot;
+  GList *xids;
 };
 typedef struct _GdkDndCursorInfo GdkDndCursorInfo;
 
index 28900bbf5d85da003123b8277faf75b48ca6f087..0b1c256b8bb43452d2bd3082b213cd858ab2fe0a 100644 (file)
@@ -26,6 +26,8 @@ gdk_dnd_set_drag_cursors(GdkCursor *default_cursor, GdkCursor *goahead_cursor)
              gdk_window_unref(gdk_dnd.c->drag_pm_ok);
            }
          gdk_dnd.c->drag_pm_default = gdk_dnd.c->drag_pm_ok = NULL;
+         g_list_free(gdk_dnd.c->xids);
+         gdk_dnd.c->xids = NULL;
        }
       gdk_dnd_display_drag_cursor(-1, -1,
                                  gdk_dnd.dnd_drag_target?TRUE:FALSE,
@@ -41,6 +43,7 @@ gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
 {
   g_return_if_fail(default_pixmapwin != NULL);
 
+  g_list_free(gdk_dnd.c->xids); gdk_dnd.c->xids = NULL;
   if(gdk_dnd.c->drag_pm_default)
     gdk_window_unref(gdk_dnd.c->drag_pm_default);
   if(gdk_dnd.c->drag_pm_ok)
@@ -51,9 +54,11 @@ gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
   gdk_window_ref(default_pixmapwin);
   gdk_dnd.c->drag_pm_default = default_pixmapwin;
   gdk_dnd.c->default_hotspot = *default_hotspot;
+  gdk_dnd.c->xids = g_list_append(gdk_dnd.c->xids, ((GdkWindowPrivate *)default_pixmapwin)->xwindow);
   if(goahead_pixmapwin)
     {
       gdk_window_ref(goahead_pixmapwin);
+      gdk_dnd.c->xids = g_list_append(gdk_dnd.c->xids, ((GdkWindowPrivate *)goahead_pixmapwin)->xwindow);
       gdk_dnd.c->drag_pm_ok = goahead_pixmapwin;
       gdk_dnd.c->ok_hotspot = *goahead_hotspot;
     }
index e6644bb6005c72c4e8960f2b5c06f58cdf63d8a8..edfd89fd857c451be1c5d6074dd180f52c024208 100644 (file)
@@ -34,7 +34,7 @@ Atom              gdk_wm_protocols;
 Atom              gdk_wm_window_protocols[2];
 Atom              gdk_selection_property;
 GdkDndCursorInfo  gdk_dnd_cursorinfo = {None, None, NULL, NULL,
-                                       {0,0}, {0,0}};
+                                       {0,0}, {0,0}, NULL};
 GdkDndGlobals     gdk_dnd = {None,None,None,
                             None,None,None,
                             None,
index 16d43da2bf6390c3e06b0b61fccce8e83e8f4995..1bffc2a2858405acfb3e3baca7744ce267c9d08a 100644 (file)
@@ -2069,7 +2069,10 @@ gdk_event_translate (GdkEvent *event,
          /* XXX there has to be a better way to do this, perhaps with
             XTranslateCoordinates or XQueryTree - I don't know how,
             and this sort of works */
-         static Window lastwin = None, curwin = None, twin;
+         static Window lastwin = None, curwin = None;
+#if 0
+         Window twin;
+#endif
          Window childwin = gdk_root_window;
          int x, y, ox, oy;
 
@@ -2083,6 +2086,13 @@ gdk_event_translate (GdkEvent *event,
          curwin = gdk_root_window;
          ox = x = xevent->xmotion.x_root;
          oy = y = xevent->xmotion.y_root;
+#if 1
+         curwin = gdk_window_xid_at_coords(xevent->xmotion.x_root,
+                                           xevent->xmotion.y_root,
+                                           gdk_dnd.c->xids);
+         XTranslateCoordinates(gdk_display, gdk_root_window, curwin,
+                               x, y, &x, &y, &childwin);
+#else
          while(childwin != None)
            {
              ox = x; oy = y;
@@ -2095,6 +2105,7 @@ gdk_event_translate (GdkEvent *event,
                                        x, y, &x, &y, &twin);
                }
            }
+#endif
          GDK_NOTE (DND,
            g_print("Drag is now in window %#lx, lastwin was %#lx, ddc = %#lx\n",
                    curwin, lastwin, gdk_dnd.dnd_drag_curwin));