Quick DND patch



This patch stops things from segfaulting when you drag something to the
root window, and also makes drops on widgets work.

BTW I forgot to mention that you can try all this out by running testgtk,
clicking on the 'Buttons' button, and then dragging 'Button1' around. I
use the 'dndtest' program from the OffiX-devel rpm to test as well.

-- Elliot					http://www.redhat.com/
How do you explain school to a higher intelligence?
                -- Elliot, "E.T."
--- gimp-0.99.10/gtk+/gdk/gdk.c.sopwith	Fri Jun 13 12:57:00 1997
+++ gimp-0.99.10/gtk+/gdk/gdk.c	Fri Jun 13 13:29:58 1997
@@ -1880,6 +1880,7 @@
 	    }
 	} else if(xevent->xclient.message_type == gdk_DndProtocol) {
 	    Window tmpwin;
+	    int tmpx, tmpy;
 	    event->drop.type = GDK_DROP_NOTIFY;
 	    /* We need to turn this X & Y relative to the root window into
 		an X & Y relative to window */
@@ -1887,8 +1888,9 @@
 				  xevent->xclient.window,
 				  xevent->xclient.data.l[3] % 65536,
 				  xevent->xclient.data.l[3] / 65536,
-				  &event->drop.x, &event->drop.y,
-				     &tmpwin);
+				  &tmpx, &tmpy, &tmpwin);
+	    event->drop.x = (guint16) tmpx;
+	    event->drop.y = (guint16) tmpy;
 	    /* The message may get sent to
 	       a toplevel window but should actually be sent the the
 	       specific widget inside that toplevel window on which
@@ -2170,6 +2172,9 @@
     unsigned long nitems, after;
     unsigned char *data;
     Window inf;
+
+    if(win == 0)
+	return DefaultRootWindow(dpy);
 
     if((WM_STATE = XInternAtom(dpy, "WM_STATE", True)) == 0)
 	return win;



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