summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorMichael Natterer <mitch@imendio.com>2007-03-14 13:55:12 +0000
committerMichael Natterer <mitch@src.gnome.org>2007-03-14 13:55:12 +0000
commitd953ce87750f5be9a851df22f2f21a100f964ec1 (patch)
treef73b09e867e4ff78834cba891fcd67c5c5005676 /gdk
parent86ea351bd71aaf1c420b9a3b1cee74649f197b8a (diff)
downloadgtk+-d953ce87750f5be9a851df22f2f21a100f964ec1.tar.gz
Make gtk_widget_set_extension_events() work on already realized widgets
2007-03-14 Michael Natterer <mitch@imendio.com> Make gtk_widget_set_extension_events() work on already realized widgets (bug #379550, Tommi Komulainen) * gdk/x11/gdkinput.c (gdk_input_set_extension_events): allow to be called multiple times without leaking and work correctly when already realized (don't rely on a configure event following). * gtk/gtkwidget.c (gtk_widget_set_extension_events_internal): new internal function which walks the GdkWindow tree and sets the extension events on all windows that belong to the widget. (gtk_widget_realize) (gtk_widget_set_extension_events): use the new function. svn path=/trunk/; revision=17515
Diffstat (limited to 'gdk')
-rw-r--r--gdk/x11/gdkinput.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/gdk/x11/gdkinput.c b/gdk/x11/gdkinput.c
index f4d30cb209..8d87479f0e 100644
--- a/gdk/x11/gdkinput.c
+++ b/gdk/x11/gdkinput.c
@@ -313,29 +313,42 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
if (mode == GDK_EXTENSION_EVENTS_NONE)
mask = 0;
+ iw = _gdk_input_window_find (window);
+
if (mask != 0)
{
- iw = g_new(GdkInputWindow,1);
+ if (!iw)
+ {
+ iw = g_new(GdkInputWindow,1);
+
+ iw->window = window;
+ iw->mode = mode;
- iw->window = window;
- iw->mode = mode;
+ iw->obscuring = NULL;
+ iw->num_obscuring = 0;
+ iw->grabbed = FALSE;
- iw->obscuring = NULL;
- iw->num_obscuring = 0;
- iw->grabbed = FALSE;
+ display_x11->input_windows = g_list_append(display_x11->input_windows,iw);
+ }
- display_x11->input_windows = g_list_append(display_x11->input_windows,iw);
window_private->extension_events = mask;
+#ifndef XINPUT_NONE
/* Add enter window events to the event mask */
- /* FIXME, this is not needed for XINPUT_NONE */
+ /* this is not needed for XINPUT_NONE */
gdk_window_set_events (window,
gdk_window_get_events (window) |
GDK_ENTER_NOTIFY_MASK);
+
+ /* we might not receive ConfigureNotify so get the root_relative_geometry
+ * now, just in case */
+ _gdk_input_get_root_relative_geometry (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XWINDOW (window),
+ &iw->root_x, &iw->root_y, NULL, NULL);
+#endif /* !XINPUT_NONE */
}
else
{
- iw = _gdk_input_window_find (window);
if (iw)
{
display_x11->input_windows = g_list_remove(display_x11->input_windows,iw);