Call the filters on the window where the event is received, not on the

Thu Dec 19 11:42:00 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkevents-x11.c (gdk_event_translate): Call
        the filters on the window where the event is received,
        not on the window the event is "about". (#101512,
        Bolian Yin.)
This commit is contained in:
Owen Taylor 2002-12-19 16:51:02 +00:00 committed by Owen Taylor
parent defdebc5cd
commit 9902a67094
7 changed files with 67 additions and 7 deletions

View File

@ -1,3 +1,10 @@
Thu Dec 19 11:42:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Call
the filters on the window where the event is received,
not on the window the event is "about". (#101512,
Bolian Yin.)
Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org> Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org>
* tests/testtreeflow.c: the rand variable should be static to * tests/testtreeflow.c: the rand variable should be static to

View File

@ -1,3 +1,10 @@
Thu Dec 19 11:42:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Call
the filters on the window where the event is received,
not on the window the event is "about". (#101512,
Bolian Yin.)
Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org> Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org>
* tests/testtreeflow.c: the rand variable should be static to * tests/testtreeflow.c: the rand variable should be static to

View File

@ -1,3 +1,10 @@
Thu Dec 19 11:42:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Call
the filters on the window where the event is received,
not on the window the event is "about". (#101512,
Bolian Yin.)
Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org> Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org>
* tests/testtreeflow.c: the rand variable should be static to * tests/testtreeflow.c: the rand variable should be static to

View File

@ -1,3 +1,10 @@
Thu Dec 19 11:42:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Call
the filters on the window where the event is received,
not on the window the event is "about". (#101512,
Bolian Yin.)
Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org> Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org>
* tests/testtreeflow.c: the rand variable should be static to * tests/testtreeflow.c: the rand variable should be static to

View File

@ -1,3 +1,10 @@
Thu Dec 19 11:42:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Call
the filters on the window where the event is received,
not on the window the event is "about". (#101512,
Bolian Yin.)
Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org> Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org>
* tests/testtreeflow.c: the rand variable should be static to * tests/testtreeflow.c: the rand variable should be static to

View File

@ -1,3 +1,10 @@
Thu Dec 19 11:42:00 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Call
the filters on the window where the event is received,
not on the window the event is "about". (#101512,
Bolian Yin.)
Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org> Thu Dec 19 03:58:36 2002 Kristian Rietveld <kris@gtk.org>
* tests/testtreeflow.c: the rand variable should be static to * tests/testtreeflow.c: the rand variable should be static to

View File

@ -688,6 +688,7 @@ gdk_event_translate (GdkDisplay *display,
GdkWindow *window; GdkWindow *window;
GdkWindowObject *window_private; GdkWindowObject *window_private;
GdkWindow *filter_window;
GdkWindowImplX11 *window_impl = NULL; GdkWindowImplX11 *window_impl = NULL;
gint return_val; gint return_val;
gint xoffset, yoffset; gint xoffset, yoffset;
@ -742,6 +743,14 @@ gdk_event_translate (GdkDisplay *display,
window = gdk_window_lookup_for_display (display, xwindow); window = gdk_window_lookup_for_display (display, xwindow);
window_private = (GdkWindowObject *) window; window_private = (GdkWindowObject *) window;
/* We always run the filters for the window where the event
* is delivered, not the window that it relates to
*/
if (xevent->xany.window == xwindow)
filter_window = window;
else
filter_window = gdk_window_lookup_for_display (display, xevent->xany.window);
if (window) if (window)
{ {
screen = GDK_WINDOW_SCREEN (window); screen = GDK_WINDOW_SCREEN (window);
@ -791,17 +800,26 @@ gdk_event_translate (GdkDisplay *display,
goto done; goto done;
} }
} }
else if (window_private) else if (filter_window)
{ {
/* Apply per-window filters */ /* Apply per-window filters */
GdkWindowObject *filter_private = (GdkWindowObject *) filter_window;
GdkFilterReturn result; GdkFilterReturn result;
result = gdk_event_apply_filters (xevent, event,
window_private->filters); if (filter_private->filters)
if (result != GDK_FILTER_CONTINUE)
{ {
return_val = (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE; g_object_ref (filter_window);
goto done;
result = gdk_event_apply_filters (xevent, event,
filter_private->filters);
g_object_unref (filter_window);
if (result != GDK_FILTER_CONTINUE)
{
return_val = (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
goto done;
}
} }
} }