mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
Move event source apis to gdk_x11
Reduces the changes of cross-backend collisions
This commit is contained in:
parent
25c66c11e2
commit
624dc45755
@ -1100,19 +1100,19 @@ gdk_event_init (GdkDisplay *display)
|
||||
GdkDeviceManager *device_manager;
|
||||
|
||||
display_x11 = GDK_DISPLAY_X11 (display);
|
||||
display_x11->event_source = gdk_event_source_new (display);
|
||||
display_x11->event_source = gdk_x11_event_source_new (display);
|
||||
|
||||
gdk_event_source_add_translator ((GdkEventSource *) display_x11->event_source,
|
||||
GDK_EVENT_TRANSLATOR (display));
|
||||
gdk_x11_event_source_add_translator ((GdkEventSource *) display_x11->event_source,
|
||||
GDK_EVENT_TRANSLATOR (display));
|
||||
|
||||
device_manager = gdk_display_get_device_manager (display);
|
||||
gdk_event_source_add_translator ((GdkEventSource *) display_x11->event_source,
|
||||
GDK_EVENT_TRANSLATOR (device_manager));
|
||||
gdk_x11_event_source_add_translator ((GdkEventSource *) display_x11->event_source,
|
||||
GDK_EVENT_TRANSLATOR (device_manager));
|
||||
|
||||
gdk_display_add_client_message_filter (display,
|
||||
gdk_atom_intern_static_string ("WM_PROTOCOLS"),
|
||||
gdk_wm_protocols_filter,
|
||||
NULL);
|
||||
gdk_atom_intern_static_string ("WM_PROTOCOLS"),
|
||||
gdk_wm_protocols_filter,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -89,7 +89,7 @@ gdk_event_apply_filters (XEvent *xevent,
|
||||
tmp_list = node;
|
||||
|
||||
if (result != GDK_FILTER_CONTINUE)
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
return GDK_FILTER_CONTINUE;
|
||||
@ -102,7 +102,7 @@ gdk_event_source_get_filter_window (GdkEventSource *event_source,
|
||||
GdkWindow *window;
|
||||
|
||||
window = gdk_x11_window_lookup_for_display (event_source->display,
|
||||
xevent->xany.window);
|
||||
xevent->xany.window);
|
||||
|
||||
if (window && !GDK_IS_WINDOW (window))
|
||||
window = NULL;
|
||||
@ -191,7 +191,7 @@ gdk_event_source_translate_event (GdkEventSource *event_source,
|
||||
}
|
||||
else if (result == GDK_FILTER_TRANSLATE)
|
||||
return event;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdk_event_free (event);
|
||||
@ -236,7 +236,7 @@ gdk_event_source_prepare (GSource *source,
|
||||
|
||||
*timeout = -1;
|
||||
retval = (_gdk_event_queue_find_first (display) != NULL ||
|
||||
gdk_check_xpending (display));
|
||||
gdk_check_xpending (display));
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
@ -253,7 +253,7 @@ gdk_event_source_check (GSource *source)
|
||||
|
||||
if (event_source->event_poll_fd.revents & G_IO_IN)
|
||||
retval = (_gdk_event_queue_find_first (event_source->display) != NULL ||
|
||||
gdk_check_xpending (event_source->display));
|
||||
gdk_check_xpending (event_source->display));
|
||||
else
|
||||
retval = FALSE;
|
||||
|
||||
@ -336,7 +336,7 @@ gdk_event_source_finalize (GSource *source)
|
||||
}
|
||||
|
||||
GSource *
|
||||
gdk_event_source_new (GdkDisplay *display)
|
||||
gdk_x11_event_source_new (GdkDisplay *display)
|
||||
{
|
||||
GSource *source;
|
||||
GdkEventSource *event_source;
|
||||
@ -346,7 +346,7 @@ gdk_event_source_new (GdkDisplay *display)
|
||||
|
||||
source = g_source_new (&event_funcs, sizeof (GdkEventSource));
|
||||
name = g_strdup_printf ("GDK X11 Event source (%s)",
|
||||
gdk_display_get_name (display));
|
||||
gdk_display_get_name (display));
|
||||
g_source_set_name (source, name);
|
||||
g_free (name);
|
||||
event_source = (GdkEventSource *) source;
|
||||
@ -369,8 +369,8 @@ gdk_event_source_new (GdkDisplay *display)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_event_source_add_translator (GdkEventSource *source,
|
||||
GdkEventTranslator *translator)
|
||||
gdk_x11_event_source_add_translator (GdkEventSource *source,
|
||||
GdkEventTranslator *translator)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_EVENT_TRANSLATOR (translator));
|
||||
|
||||
@ -378,10 +378,10 @@ gdk_event_source_add_translator (GdkEventSource *source,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_event_source_select_events (GdkEventSource *source,
|
||||
Window window,
|
||||
GdkEventMask event_mask,
|
||||
unsigned int extra_x_mask)
|
||||
gdk_x11_event_source_select_events (GdkEventSource *source,
|
||||
Window window,
|
||||
GdkEventMask event_mask,
|
||||
unsigned int extra_x_mask)
|
||||
{
|
||||
unsigned int xmask = extra_x_mask;
|
||||
GList *list;
|
||||
|
@ -28,17 +28,17 @@ G_BEGIN_DECLS
|
||||
typedef struct _GdkEventSource GdkEventSource;
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
GSource * gdk_event_source_new (GdkDisplay *display);
|
||||
GSource * gdk_x11_event_source_new (GdkDisplay *display);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void gdk_event_source_add_translator (GdkEventSource *source,
|
||||
GdkEventTranslator *translator);
|
||||
void gdk_x11_event_source_add_translator (GdkEventSource *source,
|
||||
GdkEventTranslator *translator);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void gdk_event_source_select_events (GdkEventSource *source,
|
||||
Window window,
|
||||
GdkEventMask event_mask,
|
||||
unsigned int extra_x_mask);
|
||||
void gdk_x11_event_source_select_events (GdkEventSource *source,
|
||||
Window window,
|
||||
GdkEventMask event_mask,
|
||||
unsigned int extra_x_mask);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -562,9 +562,9 @@ create_focus_window (GdkDisplay *display,
|
||||
GDK_KEY_RELEASE_MASK |
|
||||
GDK_FOCUS_CHANGE_MASK);
|
||||
|
||||
gdk_event_source_select_events ((GdkEventSource *) display_x11->event_source,
|
||||
focus_window,
|
||||
event_mask, 0);
|
||||
gdk_x11_event_source_select_events ((GdkEventSource *) display_x11->event_source,
|
||||
focus_window,
|
||||
event_mask, 0);
|
||||
|
||||
XMapWindow (xdisplay, focus_window);
|
||||
|
||||
@ -827,9 +827,9 @@ _gdk_window_impl_new (GdkWindow *window,
|
||||
if (attributes_mask & GDK_WA_TYPE_HINT)
|
||||
gdk_window_set_type_hint (window, attributes->type_hint);
|
||||
|
||||
gdk_event_source_select_events ((GdkEventSource *) display_x11->event_source,
|
||||
GDK_WINDOW_XID (window), event_mask,
|
||||
StructureNotifyMask | PropertyChangeMask);
|
||||
gdk_x11_event_source_select_events ((GdkEventSource *) display_x11->event_source,
|
||||
GDK_WINDOW_XID (window), event_mask,
|
||||
StructureNotifyMask | PropertyChangeMask);
|
||||
}
|
||||
|
||||
static GdkEventMask
|
||||
@ -2833,9 +2833,9 @@ gdk_window_x11_set_events (GdkWindow *window,
|
||||
xevent_mask = StructureNotifyMask | PropertyChangeMask;
|
||||
|
||||
display_x11 = GDK_DISPLAY_X11 (gdk_window_get_display (window));
|
||||
gdk_event_source_select_events ((GdkEventSource *) display_x11->event_source,
|
||||
GDK_WINDOW_XID (window), event_mask,
|
||||
xevent_mask);
|
||||
gdk_x11_event_source_select_events ((GdkEventSource *) display_x11->event_source,
|
||||
GDK_WINDOW_XID (window), event_mask,
|
||||
xevent_mask);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user