diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2017-09-15 18:58:50 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2017-09-19 18:40:51 +0200 |
commit | 44cb3ccfa15d6f840b34f916d733ea393a1620a2 (patch) | |
tree | 7967a951e09f6c253994f964d3cf39963b662bf9 | |
parent | 3e1f6721709c60dd17dd41c0aeeb5b80abcd8b21 (diff) | |
download | gtk+-44cb3ccfa15d6f840b34f916d733ea393a1620a2.tar.gz |
gdk: Remove motion hints
Motion hints are now literally a thing of the past. Everything should be
using the full motion event stream.
-rw-r--r-- | gdk/gdkdevice.c | 3 | ||||
-rw-r--r-- | gdk/gdkdisplay.c | 32 | ||||
-rw-r--r-- | gdk/gdkdisplayprivate.h | 3 | ||||
-rw-r--r-- | gdk/gdkevents.c | 40 | ||||
-rw-r--r-- | gdk/gdktypes.h | 10 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 35 | ||||
-rw-r--r-- | gdk/x11/gdkdevice-core-x11.c | 1 | ||||
-rw-r--r-- | gdk/x11/gdkdevice-xi2.c | 3 | ||||
-rw-r--r-- | gdk/x11/gdkdevicemanager-xi2.c | 1 | ||||
-rw-r--r-- | gtk/gtkaboutdialog.c | 2 | ||||
-rw-r--r-- | gtk/gtkgesture.c | 2 | ||||
-rw-r--r-- | gtk/gtktooltip.c | 4 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 11 |
13 files changed, 3 insertions, 144 deletions
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c index 9c84e0ca42..fd918f374b 100644 --- a/gdk/gdkdevice.c +++ b/gdk/gdkdevice.c @@ -1378,8 +1378,7 @@ get_native_grab_event_mask (GdkEventMask grab_mask) GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK | (grab_mask & - ~(GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON_MOTION_MASK | + ~(GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK)); diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index a4a75bc2fb..b0d30b57dc 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -379,8 +379,6 @@ gdk_display_init (GdkDisplay *display) display->touch_implicit_grabs = g_array_new (FALSE, FALSE, sizeof (GdkTouchGrabInfo)); display->device_grabs = g_hash_table_new (NULL, NULL); - display->motion_hint_info = g_hash_table_new_full (NULL, NULL, NULL, - (GDestroyNotify) g_free); display->pointers_info = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) free_pointer_info); @@ -433,7 +431,6 @@ gdk_display_finalize (GObject *object) g_array_free (display->touch_implicit_grabs, TRUE); - g_hash_table_destroy (display->motion_hint_info); g_hash_table_destroy (display->pointers_info); g_list_free_full (display->input_devices, g_object_unref); @@ -605,35 +602,6 @@ gdk_flush (void) g_slist_free (list); } -void -_gdk_display_enable_motion_hints (GdkDisplay *display, - GdkDevice *device) -{ - gulong *device_serial, serial; - - device_serial = g_hash_table_lookup (display->motion_hint_info, device); - - if (!device_serial) - { - device_serial = g_new0 (gulong, 1); - *device_serial = G_MAXULONG; - g_hash_table_insert (display->motion_hint_info, device, device_serial); - } - - if (*device_serial != 0) - { - serial = _gdk_display_get_next_serial (display); - /* We might not actually generate the next request, so - make sure this triggers always, this may cause it to - trigger slightly too early, but this is just a hint - anyway. */ - if (serial > 0) - serial--; - if (serial < *device_serial) - *device_serial = serial; - } -} - static void generate_grab_broken_event (GdkDisplay *display, GdkWindow *window, diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h index 8c37ed6d22..fe6ea0f001 100644 --- a/gdk/gdkdisplayprivate.h +++ b/gdk/gdkdisplayprivate.h @@ -99,7 +99,6 @@ struct _GdkDisplay GArray *touch_implicit_grabs; GHashTable *device_grabs; - GHashTable *motion_hint_info; GdkDeviceManager *device_manager; GList *input_devices; /* Deprecated, only used to keep gdk_display_list_devices working */ @@ -298,8 +297,6 @@ GdkTouchGrabInfo * _gdk_display_has_touch_grab (GdkDisplay *display gboolean _gdk_display_end_touch_grab (GdkDisplay *display, GdkDevice *device, GdkEventSequence *sequence); -void _gdk_display_enable_motion_hints (GdkDisplay *display, - GdkDevice *device); GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display, GdkDevice *device); void _gdk_display_pointer_info_foreach (GdkDisplay *display, diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 044b3f0635..9904e5bdbe 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -1861,46 +1861,6 @@ gdk_event_get_source_device (const GdkEvent *event) } /** - * gdk_event_request_motions: - * @event: a valid #GdkEvent - * - * Request more motion notifies if @event is a motion notify hint event. - * - * This function should be used instead of gdk_window_get_pointer() to - * request further motion notifies, because it also works for extension - * events where motion notifies are provided for devices other than the - * core pointer. Coordinate extraction, processing and requesting more - * motion events from a %GDK_MOTION_NOTIFY event usually works like this: - * - * |[<!-- language="C" --> - * { - * // motion_event handler - * x = motion_event->x; - * y = motion_event->y; - * // handle (x,y) motion - * gdk_event_request_motions (motion_event); // handles is_hint events - * } - * ]| - * - * Since: 2.12 - **/ -void -gdk_event_request_motions (const GdkEventMotion *event) -{ - GdkDisplay *display; - - g_return_if_fail (event != NULL); - - if (event->type == GDK_MOTION_NOTIFY && event->is_hint) - { - gdk_device_get_state (event->device, event->window, NULL, NULL); - - display = gdk_window_get_display (event->window); - _gdk_display_enable_motion_hints (display, event->device); - } -} - -/** * gdk_event_triggers_context_menu: * @event: a #GdkEvent, currently only button events are meaningful values * diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h index 73bf2feccd..20f759f33f 100644 --- a/gdk/gdktypes.h +++ b/gdk/gdktypes.h @@ -373,7 +373,6 @@ typedef enum * GdkEventMask: * @GDK_EXPOSURE_MASK: receive expose events * @GDK_POINTER_MOTION_MASK: receive all pointer motion events - * @GDK_POINTER_MOTION_HINT_MASK: deprecated. see the explanation above * @GDK_BUTTON_MOTION_MASK: receive pointer motion events while any button is pressed * @GDK_BUTTON1_MOTION_MASK: receive pointer motion events while 1 button is pressed * @GDK_BUTTON2_MOTION_MASK: receive pointer motion events while 2 button is pressed @@ -406,14 +405,6 @@ typedef enum * See the [input handling overview][chap-input-handling] for details of * [event masks][event-masks] and [event propagation][event-propagation]. * - * %GDK_POINTER_MOTION_HINT_MASK is deprecated. It is a special mask - * to reduce the number of %GDK_MOTION_NOTIFY events received. When using - * %GDK_POINTER_MOTION_HINT_MASK, fewer %GDK_MOTION_NOTIFY events will - * be sent, some of which are marked as a hint (the is_hint member is - * %TRUE). To receive more motion events after a motion hint event, - * the application needs to asks for more, by calling - * gdk_event_request_motions(). - * * Since GTK 3.8, motion events are already compressed by default, independent * of this mechanism. This compression can be disabled with * gdk_window_set_event_compression(). See the documentation of that function @@ -430,7 +421,6 @@ typedef enum { GDK_EXPOSURE_MASK = 1 << 1, GDK_POINTER_MOTION_MASK = 1 << 2, - GDK_POINTER_MOTION_HINT_MASK = 1 << 3, GDK_BUTTON_MOTION_MASK = 1 << 4, GDK_BUTTON1_MOTION_MASK = 1 << 5, GDK_BUTTON2_MOTION_MASK = 1 << 6, diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 14bea5aa3d..3daf7d63c9 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -948,14 +948,7 @@ get_native_device_event_mask (GdkWindow *private, { GdkEventMask mask; - /* Do whatever the app asks to, since the app - * may be asking for weird things for native windows, - * but don't use motion hints as that may affect non-native - * child windows that don't want it. Also, we need to - * set all the app-specified masks since they will be picked - * up by any implicit grabs (i.e. if they were not set as - * native we would not get the events we need). */ - mask = private->event_mask & ~GDK_POINTER_MOTION_HINT_MASK; + mask = private->event_mask; /* We need thse for all native windows so we can emulate events on children: */ @@ -3397,8 +3390,6 @@ gdk_window_get_device_position_double (GdkWindow *window, if (mask) *mask = tmp_mask; - _gdk_display_enable_motion_hints (gdk_window_get_display (window), device); - if (normal_child) return _gdk_window_find_child_at (window, tmp_x, tmp_y); return NULL; @@ -3953,27 +3944,12 @@ gdk_window_set_events (GdkWindow *window, GdkEventMask event_mask) { GdkWindowImplClass *impl_class; - GdkDisplay *display; g_return_if_fail (GDK_IS_WINDOW (window)); if (window->destroyed) return; - /* If motion hint is disabled, enable motion events again */ - display = gdk_window_get_display (window); - if ((window->event_mask & GDK_POINTER_MOTION_HINT_MASK) && - !(event_mask & GDK_POINTER_MOTION_HINT_MASK)) - { - GList *devices = window->devices_inside; - - while (devices) - { - _gdk_display_enable_motion_hints (display, (GdkDevice *) devices->data); - devices = devices->next; - } - } - window->event_mask = event_mask; if (gdk_window_has_impl (window)) @@ -4027,7 +4003,6 @@ gdk_window_set_device_events (GdkWindow *window, GdkEventMask event_mask) { GdkEventMask device_mask; - GdkDisplay *display; GdkWindow *native; g_return_if_fail (GDK_IS_WINDOW (window)); @@ -4036,12 +4011,6 @@ gdk_window_set_device_events (GdkWindow *window, if (GDK_WINDOW_DESTROYED (window)) return; - /* If motion hint is disabled, enable motion events again */ - display = gdk_window_get_display (window); - if ((window->event_mask & GDK_POINTER_MOTION_HINT_MASK) && - !(event_mask & GDK_POINTER_MOTION_HINT_MASK)) - _gdk_display_enable_motion_hints (display, device); - if (G_UNLIKELY (!window->device_events)) window->device_events = g_hash_table_new (NULL, NULL); @@ -5777,8 +5746,6 @@ _gdk_display_set_window_under_pointer (GdkDisplay *display, g_object_ref (window); update_cursor (display, device); } - - _gdk_display_enable_motion_hints (display, device); } static void diff --git a/gdk/x11/gdkdevice-core-x11.c b/gdk/x11/gdkdevice-core-x11.c index e0d34ed329..418546c638 100644 --- a/gdk/x11/gdkdevice-core-x11.c +++ b/gdk/x11/gdkdevice-core-x11.c @@ -571,7 +571,6 @@ gdk_x11_device_core_select_window_events (GdkDevice *device, window_mask = gdk_window_get_events (window); filter_mask = GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c index 23857a5ca9..bdf28c4b0f 100644 --- a/gdk/x11/gdkdevice-xi2.c +++ b/gdk/x11/gdkdevice-xi2.c @@ -709,8 +709,7 @@ _gdk_x11_device_xi2_translate_event_mask (GdkX11DeviceManagerXI2 *device_manager *len = XIMaskLen (XI_LASTEVENT); mask = g_new0 (guchar, *len); - if (event_mask & GDK_POINTER_MOTION_MASK || - event_mask & GDK_POINTER_MOTION_HINT_MASK) + if (event_mask & GDK_POINTER_MOTION_MASK) XISetMask (mask, XI_Motion); if (event_mask & GDK_BUTTON_MOTION_MASK || diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c index 787da0cb3a..41d5faeafb 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -1979,7 +1979,6 @@ gdk_x11_device_manager_xi2_get_handled_events (GdkEventTranslator *translator) GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK | diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c index c4c95eeb98..23482c6757 100644 --- a/gtk/gtkaboutdialog.c +++ b/gtk/gtkaboutdialog.c @@ -2134,8 +2134,6 @@ text_view_motion_notify_event (GtkWidget *text_view, set_cursor_if_appropriate (about, GTK_TEXT_VIEW (text_view), gdk_event_get_device ((GdkEvent *) event), x, y); - gdk_event_request_motions (event); - return FALSE; } diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c index d170fd067b..67d91535da 100644 --- a/gtk/gtkgesture.c +++ b/gtk/gtkgesture.c @@ -722,8 +722,6 @@ gtk_gesture_handle_event (GtkEventController *controller, { if ((state & BUTTONS_MASK) == 0) return FALSE; - - gdk_event_request_motions ((GdkEventMotion *)event); } if (_gtk_gesture_update_point (gesture, event, FALSE) && diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index 063bedd496..7fab3c8b6f 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -1393,10 +1393,6 @@ _gtk_tooltip_handle_event (GdkEvent *event) gdk_event_get_coords (event, &dx, &dy); gtk_tooltip_handle_event_internal (event_type, window, dx, dy); - - /* Always poll for a next motion event */ - gdk_event_request_motions ((GdkEventMotion *) event); - } static void diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 262ac80039..62ae353ab9 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -6675,17 +6675,6 @@ _gtk_widget_captured_event (GtkWidget *widget, return_val |= handler (widget, event_copy); return_val |= !WIDGET_REALIZED_FOR_EVENT (widget, event_copy); - /* The widget that was originally to receive the event - * handles motion hints, but the capturing widget might - * not, so ensure we get further motion events. - */ - if (return_val && - event_copy->type == GDK_MOTION_NOTIFY && - event_copy->motion.is_hint && - (gdk_window_get_events (event_copy->any.window) & - GDK_POINTER_MOTION_HINT_MASK) != 0) - gdk_event_request_motions (&event_copy->motion); - g_object_unref (widget); out: |