xsettings: don't use the xsettings watch function functionality

The "watch" function functionality in xsettings-client.c is designed
for setups like GDK where filters are per-window. If we are going
to pass all events to _clutter_xsettings_client_process_event()
anyways, we can just pass in NULL for watch.

This avoids a nasty infinite loop where an event would get processed
triggering removing a filter and adding a new filter, which would
immediately run and remove a filter and add another and so on
ad-infinitum.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2415
This commit is contained in:
Owen W. Taylor 2010-11-12 18:53:51 -05:00 committed by Emmanuele Bassi
parent 03a713e18e
commit 9249bd8411

View File

@ -120,38 +120,6 @@ xsettings_filter (XEvent *xevent,
return CLUTTER_X11_FILTER_CONTINUE;
}
static Bool
clutter_backend_x11_xsettings_watch (Window window,
Bool is_start,
long mask,
void *cb_data)
{
ClutterBackendX11 *backend_x11 = cb_data;
if (is_start)
{
backend_x11->xsettings_xwin = window;
if (!backend_x11->xsettings_xwin)
return False;
clutter_x11_add_filter (xsettings_filter, backend_x11);
CLUTTER_NOTE (BACKEND, "Added filter on XSettings manager window 0x%x",
(unsigned int) backend_x11->xsettings_xwin);
}
else
{
CLUTTER_NOTE (BACKEND, "Removed filter on XSettings manager window 0x%x",
(unsigned int) backend_x11->xsettings_xwin);
clutter_x11_remove_filter (xsettings_filter, backend_x11);
backend_x11->xsettings_xwin = None;
}
return True;
}
static void
clutter_backend_x11_xsettings_notify (const char *name,
XSettingsAction action,
@ -336,9 +304,11 @@ clutter_backend_x11_post_parse (ClutterBackend *backend,
_clutter_xsettings_client_new (backend_x11->xdpy,
backend_x11->xscreen_num,
clutter_backend_x11_xsettings_notify,
clutter_backend_x11_xsettings_watch,
NULL,
backend_x11);
clutter_x11_add_filter (xsettings_filter, backend_x11);
if (clutter_synchronise)
XSynchronize (backend_x11->xdpy, True);
@ -426,6 +396,7 @@ clutter_backend_x11_finalize (GObject *gobject)
g_free (backend_x11->display_name);
clutter_x11_remove_filter (xsettings_filter, backend_x11);
_clutter_xsettings_client_destroy (backend_x11->xsettings);
XCloseDisplay (backend_x11->xdpy);