Ignore all client events that were sent to a window that we don't know

Thu Jun 13 15:02:49 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkdnd-x11.c: Ignore all client events that
        were sent to a window that we don't know about or
        to a foreign window. (#81543, Young-Ho, Cha)
This commit is contained in:
Owen Taylor 2002-06-13 19:35:08 +00:00 committed by Owen Taylor
parent 16fc6b1a26
commit 8d79795203
7 changed files with 86 additions and 15 deletions

View File

@ -1,3 +1,9 @@
Thu Jun 13 15:02:49 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Ignore all client events that
were sent to a window that we don't know about or
to a foreign window. (#81543, Young-Ho, Cha)
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename): * gtk/gtkfilesel.c (gtk_file_selection_set_filename):

View File

@ -1,3 +1,9 @@
Thu Jun 13 15:02:49 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Ignore all client events that
were sent to a window that we don't know about or
to a foreign window. (#81543, Young-Ho, Cha)
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename): * gtk/gtkfilesel.c (gtk_file_selection_set_filename):

View File

@ -1,3 +1,9 @@
Thu Jun 13 15:02:49 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Ignore all client events that
were sent to a window that we don't know about or
to a foreign window. (#81543, Young-Ho, Cha)
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename): * gtk/gtkfilesel.c (gtk_file_selection_set_filename):

View File

@ -1,3 +1,9 @@
Thu Jun 13 15:02:49 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Ignore all client events that
were sent to a window that we don't know about or
to a foreign window. (#81543, Young-Ho, Cha)
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename): * gtk/gtkfilesel.c (gtk_file_selection_set_filename):

View File

@ -1,3 +1,9 @@
Thu Jun 13 15:02:49 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Ignore all client events that
were sent to a window that we don't know about or
to a foreign window. (#81543, Young-Ho, Cha)
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename): * gtk/gtkfilesel.c (gtk_file_selection_set_filename):

View File

@ -1,3 +1,9 @@
Thu Jun 13 15:02:49 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c: Ignore all client events that
were sent to a window that we don't know about or
to a foreign window. (#81543, Young-Ho, Cha)
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename): * gtk/gtkfilesel.c (gtk_file_selection_set_filename):

View File

@ -1771,6 +1771,10 @@ motif_dnd_filter (GdkXEvent *xev,
gint16 x_root, y_root; gint16 x_root, y_root;
gboolean is_reply; gboolean is_reply;
if (!event->any.window ||
gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
return GDK_FILTER_CONTINUE; /* Not for us */
/* First read some fields common to all Motif DND messages */ /* First read some fields common to all Motif DND messages */
reason = MOTIF_UNPACK_BYTE (xevent, 0); reason = MOTIF_UNPACK_BYTE (xevent, 0);
@ -1911,14 +1915,15 @@ xdnd_status_filter (GdkXEvent *xev,
Atom action = xevent->xclient.data.l[4]; Atom action = xevent->xclient.data.l[4];
GdkDragContext *context; GdkDragContext *context;
if (!event->any.window ||
gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
return GDK_FILTER_CONTINUE; /* Not for us */
GDK_NOTE (DND, GDK_NOTE (DND,
g_message ("XdndStatus: dest_window: %#x action: %ld", g_message ("XdndStatus: dest_window: %#x action: %ld",
dest_window, action)); dest_window, action));
display = gdk_drawable_get_display (event->any.window); display = gdk_drawable_get_display (event->any.window);
if (!display)
return GDK_FILTER_REMOVE;
context = gdk_drag_context_find (display, TRUE, xevent->xclient.window, dest_window); context = gdk_drag_context_find (display, TRUE, xevent->xclient.window, dest_window);
if (context) if (context)
@ -1958,13 +1963,14 @@ xdnd_finished_filter (GdkXEvent *xev,
guint32 dest_window = xevent->xclient.data.l[0]; guint32 dest_window = xevent->xclient.data.l[0];
GdkDragContext *context; GdkDragContext *context;
if (!event->any.window ||
gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
return GDK_FILTER_CONTINUE; /* Not for us */
GDK_NOTE (DND, GDK_NOTE (DND,
g_message ("XdndFinished: dest_window: %#x", dest_window)); g_message ("XdndFinished: dest_window: %#x", dest_window));
display = gdk_drawable_get_display (event->any.window); display = gdk_drawable_get_display (event->any.window);
if (!display)
return GDK_FILTER_REMOVE;
context = gdk_drag_context_find (display, TRUE, xevent->xclient.window, dest_window); context = gdk_drag_context_find (display, TRUE, xevent->xclient.window, dest_window);
if (context) if (context)
@ -2417,8 +2423,8 @@ xdnd_enter_filter (GdkXEvent *xev,
GdkEvent *event, GdkEvent *event,
gpointer cb_data) gpointer cb_data)
{ {
GdkDisplay *display = GDK_DRAWABLE_DISPLAY (event->any.window); GdkDisplay *display;
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display); GdkDisplayX11 *display_x11;
XEvent *xevent = (XEvent *)xev; XEvent *xevent = (XEvent *)xev;
GdkDragContext *new_context; GdkDragContext *new_context;
gint i; gint i;
@ -2428,9 +2434,20 @@ xdnd_enter_filter (GdkXEvent *xev,
gulong nitems, after; gulong nitems, after;
Atom *data; Atom *data;
guint32 source_window = xevent->xclient.data.l[0]; guint32 source_window;
gboolean get_types = ((xevent->xclient.data.l[1] & 1) != 0); gboolean get_types;
gint version = (xevent->xclient.data.l[1] & 0xff000000) >> 24; gint version;
if (!event->any.window ||
gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
return GDK_FILTER_CONTINUE; /* Not for us */
source_window = xevent->xclient.data.l[0];
get_types = ((xevent->xclient.data.l[1] & 1) != 0);
version = (xevent->xclient.data.l[1] & 0xff000000) >> 24;
display = GDK_DRAWABLE_DISPLAY (event->any.window);
display_x11 = GDK_DISPLAY_X11 (display);
GDK_NOTE (DND, GDK_NOTE (DND,
g_message ("XdndEnter: source_window: %#x, version: %#x", g_message ("XdndEnter: source_window: %#x, version: %#x",
@ -2529,12 +2546,18 @@ xdnd_leave_filter (GdkXEvent *xev,
{ {
XEvent *xevent = (XEvent *)xev; XEvent *xevent = (XEvent *)xev;
guint32 source_window = xevent->xclient.data.l[0]; guint32 source_window = xevent->xclient.data.l[0];
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (GDK_DRAWABLE_DISPLAY (event->any.window)); GdkDisplayX11 *display_x11;
if (!event->any.window ||
gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
return GDK_FILTER_CONTINUE; /* Not for us */
GDK_NOTE (DND, GDK_NOTE (DND,
g_message ("XdndLeave: source_window: %#x", g_message ("XdndLeave: source_window: %#x",
source_window)); source_window));
display_x11 = GDK_DISPLAY_X11 (GDK_DRAWABLE_DISPLAY (event->any.window));
if ((display_x11->current_dest_drag != NULL) && if ((display_x11->current_dest_drag != NULL) &&
(display_x11->current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) && (display_x11->current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) &&
(GDK_DRAWABLE_XID (display_x11->current_dest_drag->source_window) == source_window)) (GDK_DRAWABLE_XID (display_x11->current_dest_drag->source_window) == source_window))
@ -2563,13 +2586,19 @@ xdnd_position_filter (GdkXEvent *xev,
guint32 time = xevent->xclient.data.l[3]; guint32 time = xevent->xclient.data.l[3];
Atom action = xevent->xclient.data.l[4]; Atom action = xevent->xclient.data.l[4];
GdkDisplay *display = GDK_DRAWABLE_DISPLAY (event->any.window); GdkDisplay *display;
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display); GdkDisplayX11 *display_x11;
if (!event->any.window ||
gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
return GDK_FILTER_CONTINUE; /* Not for us */
GDK_NOTE (DND, GDK_NOTE (DND,
g_message ("XdndPosition: source_window: %#x position: (%d, %d) time: %d action: %ld", g_message ("XdndPosition: source_window: %#x position: (%d, %d) time: %d action: %ld",
source_window, x_root, y_root, time, action)); source_window, x_root, y_root, time, action));
display = GDK_DRAWABLE_DISPLAY (event->any.window);
display_x11 = GDK_DISPLAY_X11 (display);
if ((display_x11->current_dest_drag != NULL) && if ((display_x11->current_dest_drag != NULL) &&
(display_x11->current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) && (display_x11->current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) &&
@ -2606,12 +2635,18 @@ xdnd_drop_filter (GdkXEvent *xev,
XEvent *xevent = (XEvent *)xev; XEvent *xevent = (XEvent *)xev;
guint32 source_window = xevent->xclient.data.l[0]; guint32 source_window = xevent->xclient.data.l[0];
guint32 time = xevent->xclient.data.l[2]; guint32 time = xevent->xclient.data.l[2];
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (GDK_DRAWABLE_DISPLAY (event->any.window)); GdkDisplayX11 *display_x11;
if (!event->any.window ||
gdk_window_get_window_type (event->any.window) == GDK_WINDOW_FOREIGN)
return GDK_FILTER_CONTINUE; /* Not for us */
GDK_NOTE (DND, GDK_NOTE (DND,
g_message ("XdndDrop: source_window: %#x time: %d", g_message ("XdndDrop: source_window: %#x time: %d",
source_window, time)); source_window, time));
display_x11 = GDK_DISPLAY_X11 (GDK_DRAWABLE_DISPLAY (event->any.window));
if ((display_x11->current_dest_drag != NULL) && if ((display_x11->current_dest_drag != NULL) &&
(display_x11->current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) && (display_x11->current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) &&
(GDK_DRAWABLE_XID (display_x11->current_dest_drag->source_window) == source_window)) (GDK_DRAWABLE_XID (display_x11->current_dest_drag->source_window) == source_window))