2010-05-25 22:38:44 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2010-05-25 22:38:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gdkeventsource.h"
|
2010-10-15 02:05:51 +00:00
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
#include "gdkinternals.h"
|
2010-12-16 03:09:35 +00:00
|
|
|
#include "gdkwindow-x11.h"
|
|
|
|
#include "gdkprivate-x11.h"
|
2010-07-09 00:34:45 +00:00
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
static gboolean gdk_event_source_prepare (GSource *source,
|
|
|
|
gint *timeout);
|
|
|
|
static gboolean gdk_event_source_check (GSource *source);
|
|
|
|
static gboolean gdk_event_source_dispatch (GSource *source,
|
|
|
|
GSourceFunc callback,
|
|
|
|
gpointer user_data);
|
|
|
|
static void gdk_event_source_finalize (GSource *source);
|
|
|
|
|
|
|
|
#define HAS_FOCUS(toplevel) \
|
|
|
|
((toplevel)->has_focus || (toplevel)->has_pointer_focus)
|
|
|
|
|
|
|
|
struct _GdkEventSource
|
|
|
|
{
|
|
|
|
GSource source;
|
|
|
|
|
|
|
|
GdkDisplay *display;
|
|
|
|
GPollFD event_poll_fd;
|
|
|
|
GList *translators;
|
|
|
|
};
|
|
|
|
|
|
|
|
static GSourceFuncs event_funcs = {
|
|
|
|
gdk_event_source_prepare,
|
|
|
|
gdk_event_source_check,
|
|
|
|
gdk_event_source_dispatch,
|
|
|
|
gdk_event_source_finalize
|
|
|
|
};
|
|
|
|
|
|
|
|
static GList *event_sources = NULL;
|
|
|
|
|
|
|
|
static gint
|
2010-12-17 13:03:01 +00:00
|
|
|
gdk_event_apply_filters (XEvent *xevent,
|
|
|
|
GdkEvent *event,
|
|
|
|
GdkWindow *window)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
GList *tmp_list;
|
|
|
|
GdkFilterReturn result;
|
|
|
|
|
2010-12-17 13:03:01 +00:00
|
|
|
if (window == NULL)
|
|
|
|
tmp_list = _gdk_default_filters;
|
|
|
|
else
|
|
|
|
tmp_list = window->filters;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
GdkEventFilter *filter = (GdkEventFilter*) tmp_list->data;
|
2010-11-20 22:58:50 +00:00
|
|
|
GList *node;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-11-20 22:58:50 +00:00
|
|
|
if ((filter->flags & GDK_EVENT_FILTER_REMOVED) != 0)
|
|
|
|
{
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
filter->ref_count++;
|
2010-05-25 22:38:44 +00:00
|
|
|
result = filter->function (xevent, event, filter->data);
|
|
|
|
|
2010-12-17 13:03:01 +00:00
|
|
|
/* Protect against unreffing the filter mutating the list */
|
|
|
|
node = tmp_list->next;
|
2010-11-20 22:58:50 +00:00
|
|
|
|
2010-12-17 13:03:01 +00:00
|
|
|
_gdk_event_filter_unref (window, filter);
|
|
|
|
|
|
|
|
tmp_list = node;
|
2010-11-20 22:58:50 +00:00
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
if (result != GDK_FILTER_CONTINUE)
|
2010-12-15 17:25:38 +00:00
|
|
|
return result;
|
2010-05-25 22:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return GDK_FILTER_CONTINUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkWindow *
|
2011-05-18 19:24:57 +00:00
|
|
|
gdk_event_source_get_filter_window (GdkEventSource *event_source,
|
|
|
|
XEvent *xevent,
|
|
|
|
GdkEventTranslator **event_translator)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
2011-05-18 19:24:57 +00:00
|
|
|
GList *list = event_source->translators;
|
2010-05-25 22:38:44 +00:00
|
|
|
GdkWindow *window;
|
|
|
|
|
2011-05-18 19:24:57 +00:00
|
|
|
*event_translator = NULL;
|
|
|
|
|
|
|
|
while (list)
|
|
|
|
{
|
|
|
|
GdkEventTranslator *translator = list->data;
|
|
|
|
|
|
|
|
list = list->next;
|
|
|
|
window = _gdk_x11_event_translator_get_window (translator,
|
|
|
|
event_source->display,
|
|
|
|
xevent);
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
*event_translator = translator;
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-15 06:39:30 +00:00
|
|
|
window = gdk_x11_window_lookup_for_display (event_source->display,
|
2010-12-15 17:25:38 +00:00
|
|
|
xevent->xany.window);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
if (window && !GDK_IS_WINDOW (window))
|
|
|
|
window = NULL;
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_focus_change (GdkEventCrossing *event)
|
|
|
|
{
|
|
|
|
GdkToplevelX11 *toplevel;
|
2016-02-12 20:59:29 +00:00
|
|
|
GdkX11Screen *x11_screen;
|
2010-05-25 22:38:44 +00:00
|
|
|
gboolean focus_in, had_focus;
|
|
|
|
|
|
|
|
toplevel = _gdk_x11_window_get_toplevel (event->window);
|
2016-02-12 20:59:29 +00:00
|
|
|
x11_screen = GDK_X11_SCREEN (gdk_window_get_screen (event->window));
|
2010-05-25 22:38:44 +00:00
|
|
|
focus_in = (event->type == GDK_ENTER_NOTIFY);
|
|
|
|
|
2016-02-12 20:59:29 +00:00
|
|
|
if (x11_screen->wmspec_check_window)
|
|
|
|
return;
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
if (!toplevel || event->detail == GDK_NOTIFY_INFERIOR)
|
|
|
|
return;
|
|
|
|
|
|
|
|
toplevel->has_pointer = focus_in;
|
|
|
|
|
|
|
|
if (!event->focus || toplevel->has_focus_window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
had_focus = HAS_FOCUS (toplevel);
|
|
|
|
toplevel->has_pointer_focus = focus_in;
|
|
|
|
|
|
|
|
if (HAS_FOCUS (toplevel) != had_focus)
|
|
|
|
{
|
|
|
|
GdkEvent *focus_event;
|
|
|
|
|
|
|
|
focus_event = gdk_event_new (GDK_FOCUS_CHANGE);
|
|
|
|
focus_event->focus_change.window = g_object_ref (event->window);
|
|
|
|
focus_event->focus_change.send_event = FALSE;
|
|
|
|
focus_event->focus_change.in = focus_in;
|
|
|
|
gdk_event_set_device (focus_event, gdk_event_get_device ((GdkEvent *) event));
|
|
|
|
|
|
|
|
gdk_event_put (focus_event);
|
|
|
|
gdk_event_free (focus_event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkEvent *
|
|
|
|
gdk_event_source_translate_event (GdkEventSource *event_source,
|
|
|
|
XEvent *xevent)
|
|
|
|
{
|
|
|
|
GdkEvent *event = gdk_event_new (GDK_NOTHING);
|
2011-05-18 17:37:34 +00:00
|
|
|
GdkFilterReturn result = GDK_FILTER_CONTINUE;
|
2011-05-18 19:24:57 +00:00
|
|
|
GdkEventTranslator *event_translator;
|
2010-05-25 22:38:44 +00:00
|
|
|
GdkWindow *filter_window;
|
2011-05-18 17:37:34 +00:00
|
|
|
Display *dpy;
|
|
|
|
|
|
|
|
dpy = GDK_DISPLAY_XDISPLAY (event_source->display);
|
|
|
|
|
2011-05-20 20:21:59 +00:00
|
|
|
#ifdef HAVE_XGENERICEVENTS
|
2011-05-18 17:37:34 +00:00
|
|
|
/* Get cookie data here so it's available
|
|
|
|
* to every event translator and event filter.
|
|
|
|
*/
|
|
|
|
if (xevent->type == GenericEvent)
|
|
|
|
XGetEventData (dpy, &xevent->xcookie);
|
2011-05-20 20:21:59 +00:00
|
|
|
#endif
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2011-05-18 19:24:57 +00:00
|
|
|
filter_window = gdk_event_source_get_filter_window (event_source, xevent,
|
|
|
|
&event_translator);
|
2011-02-01 04:55:10 +00:00
|
|
|
if (filter_window)
|
|
|
|
event->any.window = g_object_ref (filter_window);
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
/* Run default filters */
|
|
|
|
if (_gdk_default_filters)
|
|
|
|
{
|
|
|
|
/* Apply global filters */
|
2010-12-17 13:03:01 +00:00
|
|
|
result = gdk_event_apply_filters (xevent, event, NULL);
|
2011-05-18 17:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (result == GDK_FILTER_CONTINUE &&
|
|
|
|
filter_window && filter_window->filters)
|
|
|
|
{
|
|
|
|
/* Apply per-window filters */
|
|
|
|
result = gdk_event_apply_filters (xevent, event, filter_window);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result != GDK_FILTER_CONTINUE)
|
|
|
|
{
|
2011-05-20 20:21:59 +00:00
|
|
|
#ifdef HAVE_XGENERICEVENTS
|
2011-05-18 17:37:34 +00:00
|
|
|
if (xevent->type == GenericEvent)
|
|
|
|
XFreeEventData (dpy, &xevent->xcookie);
|
2011-05-20 20:21:59 +00:00
|
|
|
#endif
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
if (result == GDK_FILTER_REMOVE)
|
|
|
|
{
|
|
|
|
gdk_event_free (event);
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-05-18 17:37:34 +00:00
|
|
|
else /* GDK_FILTER_TRANSLATE */
|
2010-05-25 22:38:44 +00:00
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_event_free (event);
|
|
|
|
event = NULL;
|
|
|
|
|
2011-05-18 19:24:57 +00:00
|
|
|
if (event_translator)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
2011-05-18 19:24:57 +00:00
|
|
|
/* Event translator was gotten before in get_filter_window() */
|
|
|
|
event = _gdk_x11_event_translator_translate (event_translator,
|
2010-12-15 19:49:23 +00:00
|
|
|
event_source->display,
|
|
|
|
xevent);
|
2010-05-25 22:38:44 +00:00
|
|
|
}
|
2011-05-18 19:24:57 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
GList *list = event_source->translators;
|
|
|
|
|
|
|
|
while (list && !event)
|
|
|
|
{
|
|
|
|
GdkEventTranslator *translator = list->data;
|
|
|
|
|
|
|
|
list = list->next;
|
|
|
|
event = _gdk_x11_event_translator_translate (translator,
|
|
|
|
event_source->display,
|
|
|
|
xevent);
|
|
|
|
}
|
|
|
|
}
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
if (event &&
|
|
|
|
(event->type == GDK_ENTER_NOTIFY ||
|
|
|
|
event->type == GDK_LEAVE_NOTIFY) &&
|
|
|
|
event->crossing.window != NULL)
|
|
|
|
{
|
|
|
|
/* Handle focusing (in the case where no window manager is running */
|
|
|
|
handle_focus_change (&event->crossing);
|
|
|
|
}
|
|
|
|
|
2011-05-20 20:21:59 +00:00
|
|
|
#ifdef HAVE_XGENERICEVENTS
|
2011-05-18 17:37:34 +00:00
|
|
|
if (xevent->type == GenericEvent)
|
|
|
|
XFreeEventData (dpy, &xevent->xcookie);
|
2011-05-20 20:21:59 +00:00
|
|
|
#endif
|
2011-05-18 17:37:34 +00:00
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gdk_check_xpending (GdkDisplay *display)
|
|
|
|
{
|
|
|
|
return XPending (GDK_DISPLAY_XDISPLAY (display));
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gdk_event_source_prepare (GSource *source,
|
|
|
|
gint *timeout)
|
|
|
|
{
|
|
|
|
GdkDisplay *display = ((GdkEventSource*) source)->display;
|
|
|
|
gboolean retval;
|
|
|
|
|
2012-07-28 12:40:04 +00:00
|
|
|
gdk_threads_enter ();
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
*timeout = -1;
|
2012-10-07 15:47:49 +00:00
|
|
|
|
|
|
|
if (display->event_pause_count > 0)
|
2013-11-11 23:04:34 +00:00
|
|
|
retval = _gdk_event_queue_find_first (display) != NULL;
|
2012-10-07 15:47:49 +00:00
|
|
|
else
|
|
|
|
retval = (_gdk_event_queue_find_first (display) != NULL ||
|
|
|
|
gdk_check_xpending (display));
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2012-07-28 12:40:04 +00:00
|
|
|
gdk_threads_leave ();
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gdk_event_source_check (GSource *source)
|
|
|
|
{
|
|
|
|
GdkEventSource *event_source = (GdkEventSource*) source;
|
|
|
|
gboolean retval;
|
|
|
|
|
2012-07-28 12:40:04 +00:00
|
|
|
gdk_threads_enter ();
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2012-10-07 15:47:49 +00:00
|
|
|
if (event_source->display->event_pause_count > 0)
|
2013-11-11 23:04:34 +00:00
|
|
|
retval = _gdk_event_queue_find_first (event_source->display) != NULL;
|
2012-10-07 15:47:49 +00:00
|
|
|
else if (event_source->event_poll_fd.revents & G_IO_IN)
|
2010-05-25 22:38:44 +00:00
|
|
|
retval = (_gdk_event_queue_find_first (event_source->display) != NULL ||
|
2010-12-15 17:25:38 +00:00
|
|
|
gdk_check_xpending (event_source->display));
|
2010-05-25 22:38:44 +00:00
|
|
|
else
|
|
|
|
retval = FALSE;
|
|
|
|
|
2012-07-28 12:40:04 +00:00
|
|
|
gdk_threads_leave ();
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-12-11 01:46:42 +00:00
|
|
|
_gdk_x11_display_queue_events (GdkDisplay *display)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
GdkEvent *event;
|
|
|
|
XEvent xevent;
|
|
|
|
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
|
|
|
GdkEventSource *event_source;
|
2010-12-20 16:14:04 +00:00
|
|
|
GdkX11Display *display_x11;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-20 18:20:10 +00:00
|
|
|
display_x11 = GDK_X11_DISPLAY (display);
|
2010-05-25 22:38:44 +00:00
|
|
|
event_source = (GdkEventSource *) display_x11->event_source;
|
|
|
|
|
|
|
|
while (!_gdk_event_queue_find_first (display) && XPending (xdisplay))
|
|
|
|
{
|
|
|
|
XNextEvent (xdisplay, &xevent);
|
|
|
|
|
|
|
|
switch (xevent.type)
|
2010-12-11 01:46:42 +00:00
|
|
|
{
|
|
|
|
case KeyPress:
|
|
|
|
case KeyRelease:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (XFilterEvent (&xevent, None))
|
|
|
|
continue;
|
|
|
|
}
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
event = gdk_event_source_translate_event (event_source, &xevent);
|
|
|
|
|
|
|
|
if (event)
|
|
|
|
{
|
|
|
|
GList *node;
|
|
|
|
|
|
|
|
node = _gdk_event_queue_append (display, event);
|
|
|
|
_gdk_windowing_got_event (display, node, event, xevent.xany.serial);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gdk_event_source_dispatch (GSource *source,
|
|
|
|
GSourceFunc callback,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GdkDisplay *display = ((GdkEventSource*) source)->display;
|
|
|
|
GdkEvent *event;
|
|
|
|
|
2012-07-28 12:40:04 +00:00
|
|
|
gdk_threads_enter ();
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
event = gdk_display_get_event (display);
|
|
|
|
|
|
|
|
if (event)
|
|
|
|
{
|
2010-12-02 09:59:37 +00:00
|
|
|
_gdk_event_emit (event);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
gdk_event_free (event);
|
|
|
|
}
|
|
|
|
|
2012-07-28 12:40:04 +00:00
|
|
|
gdk_threads_leave ();
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_event_source_finalize (GSource *source)
|
|
|
|
{
|
2010-09-19 02:57:36 +00:00
|
|
|
GdkEventSource *event_source = (GdkEventSource *)source;
|
|
|
|
|
|
|
|
g_list_free (event_source->translators);
|
|
|
|
event_source->translators = NULL;
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
event_sources = g_list_remove (event_sources, source);
|
|
|
|
}
|
|
|
|
|
|
|
|
GSource *
|
2010-12-15 17:25:38 +00:00
|
|
|
gdk_x11_event_source_new (GdkDisplay *display)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
GSource *source;
|
|
|
|
GdkEventSource *event_source;
|
2010-12-20 16:14:04 +00:00
|
|
|
GdkX11Display *display_x11;
|
2010-05-25 22:38:44 +00:00
|
|
|
int connection_number;
|
2010-06-03 20:24:38 +00:00
|
|
|
char *name;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
source = g_source_new (&event_funcs, sizeof (GdkEventSource));
|
2010-06-03 20:24:38 +00:00
|
|
|
name = g_strdup_printf ("GDK X11 Event source (%s)",
|
2010-12-15 17:25:38 +00:00
|
|
|
gdk_display_get_name (display));
|
2010-06-03 20:24:38 +00:00
|
|
|
g_source_set_name (source, name);
|
|
|
|
g_free (name);
|
2010-05-25 22:38:44 +00:00
|
|
|
event_source = (GdkEventSource *) source;
|
|
|
|
event_source->display = display;
|
|
|
|
|
2010-12-20 18:20:10 +00:00
|
|
|
display_x11 = GDK_X11_DISPLAY (display);
|
2010-05-25 22:38:44 +00:00
|
|
|
connection_number = ConnectionNumber (display_x11->xdisplay);
|
|
|
|
|
|
|
|
event_source->event_poll_fd.fd = connection_number;
|
|
|
|
event_source->event_poll_fd.events = G_IO_IN;
|
|
|
|
g_source_add_poll (source, &event_source->event_poll_fd);
|
|
|
|
|
|
|
|
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
|
|
|
|
g_source_set_can_recurse (source, TRUE);
|
|
|
|
g_source_attach (source, NULL);
|
|
|
|
|
|
|
|
event_sources = g_list_prepend (event_sources, source);
|
|
|
|
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-12-15 17:25:38 +00:00
|
|
|
gdk_x11_event_source_add_translator (GdkEventSource *source,
|
|
|
|
GdkEventTranslator *translator)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_EVENT_TRANSLATOR (translator));
|
|
|
|
|
|
|
|
source->translators = g_list_append (source->translators, translator);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-12-15 17:25:38 +00:00
|
|
|
gdk_x11_event_source_select_events (GdkEventSource *source,
|
|
|
|
Window window,
|
|
|
|
GdkEventMask event_mask,
|
|
|
|
unsigned int extra_x_mask)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
unsigned int xmask = extra_x_mask;
|
|
|
|
GList *list;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
list = source->translators;
|
|
|
|
|
|
|
|
while (list)
|
|
|
|
{
|
|
|
|
GdkEventTranslator *translator = list->data;
|
|
|
|
GdkEventMask translator_mask, mask;
|
|
|
|
|
2010-12-15 19:49:23 +00:00
|
|
|
translator_mask = _gdk_x11_event_translator_get_handled_events (translator);
|
2010-05-25 22:38:44 +00:00
|
|
|
mask = event_mask & translator_mask;
|
|
|
|
|
|
|
|
if (mask != 0)
|
|
|
|
{
|
2010-12-15 19:49:23 +00:00
|
|
|
_gdk_x11_event_translator_select_window_events (translator, window, mask);
|
2010-05-25 22:38:44 +00:00
|
|
|
event_mask &= ~mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
list = list->next;
|
|
|
|
}
|
|
|
|
|
2010-12-15 22:32:29 +00:00
|
|
|
for (i = 0; i < _gdk_x11_event_mask_table_size; i++)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
if (event_mask & (1 << (i + 1)))
|
2010-12-15 22:32:29 +00:00
|
|
|
xmask |= _gdk_x11_event_mask_table[i];
|
2010-05-25 22:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
XSelectInput (GDK_DISPLAY_XDISPLAY (source->display), window, xmask);
|
|
|
|
}
|