diff options
author | Matthias Clasen <mclasen@redhat.com> | 2018-02-07 00:00:01 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2018-02-07 15:12:03 -0500 |
commit | 89f6b8751e79ba597fcbd8292df377fa98a7319f (patch) | |
tree | 99f73b7d9b9d5c0c32ad6c34d3746ea12e836153 /gdk/gdkwindow.c | |
parent | 65beb0fc222662028b969085bb6e6cc30f263e10 (diff) | |
download | gtk+-89f6b8751e79ba597fcbd8292df377fa98a7319f.tar.gz |
Remove gdk_window_add_filter
Drop the public filtering API. The x11 backend already has
the ::xevent signal as replacement. The win32 backend needs
a similar signal to replace filtering.
Reshuffle header inclusions in the x11 backend a little bit
to avoid a cyclic inclusion between gdkprivate-x11.h and
gdkdisplay-x11.h that is otherwise causing problems.
Diffstat (limited to 'gdk/gdkwindow.c')
-rw-r--r-- | gdk/gdkwindow.c | 164 |
1 files changed, 0 insertions, 164 deletions
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 2eda7db522..2be8f8d109 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -1109,58 +1109,6 @@ gdk_window_new_child (GdkWindow *parent, return gdk_window_new (gdk_window_get_display (parent), parent, &attr); } -/** - * _gdk_event_filter_unref: - * @window: (allow-none): A #GdkWindow, or %NULL to be the global window - * @filter: A window filter - * - * Release a reference to @filter. Note this function may - * mutate the list storage, so you need to handle this - * if iterating over a list of filters. - */ -void -_gdk_event_filter_unref (GdkWindow *window, - GdkEventFilter *filter) -{ - GList **filters; - GList *tmp_list; - - if (window == NULL) - filters = &_gdk_default_filters; - else - filters = &window->filters; - - tmp_list = *filters; - while (tmp_list) - { - GdkEventFilter *iter_filter = tmp_list->data; - GList *node; - - node = tmp_list; - tmp_list = tmp_list->next; - - if (iter_filter != filter) - continue; - - g_assert (iter_filter->ref_count > 0); - - filter->ref_count--; - if (filter->ref_count != 0) - continue; - - *filters = g_list_remove_link (*filters, node); - g_free (filter); - g_list_free_1 (node); - } -} - -static void -window_remove_filters (GdkWindow *window) -{ - while (window->filters) - _gdk_event_filter_unref (window, window->filters->data); -} - static void update_pointer_info_foreach (GdkDisplay *display, GdkDevice *device, @@ -1253,12 +1201,6 @@ _gdk_window_destroy_hierarchy (GdkWindow *window, case GDK_WINDOW_SUBSURFACE: if (window->window_type == GDK_WINDOW_FOREIGN && !foreign_destroy) { - /* For historical reasons, we remove any filters - * on a foreign window when it or a parent is destroyed; - * this likely causes problems if two separate portions - * of code are maintaining filter lists on a foreign window. - */ - window_remove_filters (window); } else { @@ -1328,8 +1270,6 @@ _gdk_window_destroy_hierarchy (GdkWindow *window, window->parent = NULL; window->destroyed = TRUE; - window_remove_filters (window); - window_remove_from_pointer_info (window, display); if (window->clip_region) @@ -1652,110 +1592,6 @@ gdk_window_get_children_with_user_data (GdkWindow *window, /** - * gdk_window_add_filter: (skip) - * @window: (allow-none): a #GdkWindow - * @function: filter callback - * @data: data to pass to filter callback - * - * Adds an event filter to @window, allowing you to intercept events - * before they reach GDK. This is a low-level operation and makes it - * easy to break GDK and/or GTK+, so you have to know what you're - * doing. Pass %NULL for @window to get all events for all windows, - * instead of events for a specific window. - * - * If you are interested in X GenericEvents, bear in mind that - * XGetEventData() has been already called on the event, and - * XFreeEventData() must not be called within @function. - **/ -void -gdk_window_add_filter (GdkWindow *window, - GdkFilterFunc function, - gpointer data) -{ - GList *tmp_list; - GdkEventFilter *filter; - - g_return_if_fail (window == NULL || GDK_IS_WINDOW (window)); - - if (window && GDK_WINDOW_DESTROYED (window)) - return; - - /* Filters are for the native events on the native window, so - ensure there is a native window. */ - if (window && !gdk_window_has_impl (window)) - { - g_warning ("Filters only work on toplevel windows"); - return; - } - - if (window) - tmp_list = window->filters; - else - tmp_list = _gdk_default_filters; - - while (tmp_list) - { - filter = (GdkEventFilter *)tmp_list->data; - if ((filter->function == function) && (filter->data == data)) - { - filter->ref_count++; - return; - } - tmp_list = tmp_list->next; - } - - filter = g_new (GdkEventFilter, 1); - filter->function = function; - filter->data = data; - filter->ref_count = 1; - filter->flags = 0; - - if (window) - window->filters = g_list_append (window->filters, filter); - else - _gdk_default_filters = g_list_append (_gdk_default_filters, filter); -} - -/** - * gdk_window_remove_filter: (skip) - * @window: a #GdkWindow - * @function: previously-added filter function - * @data: user data for previously-added filter function - * - * Remove a filter previously added with gdk_window_add_filter(). - */ -void -gdk_window_remove_filter (GdkWindow *window, - GdkFilterFunc function, - gpointer data) -{ - GList *tmp_list; - GdkEventFilter *filter; - - g_return_if_fail (window == NULL || GDK_IS_WINDOW (window)); - - if (window) - tmp_list = window->filters; - else - tmp_list = _gdk_default_filters; - - while (tmp_list) - { - filter = (GdkEventFilter *)tmp_list->data; - tmp_list = tmp_list->next; - - if ((filter->function == function) && (filter->data == data)) - { - filter->flags |= GDK_EVENT_FILTER_REMOVED; - - _gdk_event_filter_unref (window, filter); - - return; - } - } -} - -/** * gdk_window_is_visible: * @window: a #GdkWindow * |