[gtk/fix-cursor-hiding: 7/7] text: Ignore synthetic motion events
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/fix-cursor-hiding: 7/7] text: Ignore synthetic motion events
- Date: Thu, 25 Mar 2021 19:27:11 +0000 (UTC)
commit 7cd7e781e21d40ea0ae8e0891faabf6ead7bbbf1
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Mar 25 15:25:35 2021 -0400
text: Ignore synthetic motion events
We want to re-show the obscured mouse cursor when the
user interacts with the mouse, not when the pointer position
relative to the widget changed. So, ignore synthetic
motion events.
Fixes: #3792
gtk/gtktext.c | 5 +++++
gtk/gtktextview.c | 6 ++++++
2 files changed, 11 insertions(+)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index d0711ed3f8..f17650ef9d 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -2940,6 +2940,11 @@ gtk_text_motion_controller_motion (GtkEventControllerMotion *controller,
GtkText *self)
{
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
+ GdkEvent *event;
+
+ event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (controller));
+ if (gdk_motion_event_is_synthetic (event))
+ return;
if (priv->mouse_cursor_obscured)
{
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 13b0e67752..7580f20493 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5712,6 +5712,12 @@ gtk_text_view_motion (GtkEventController *controller,
double y,
gpointer user_data)
{
+ GdkEvent *event;
+
+ event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (controller));
+ if (gdk_motion_event_is_synthetic (event))
+ return;
+
gtk_text_view_unobscure_mouse_cursor (GTK_TEXT_VIEW (user_data));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]