pointer: Release button when window is left

This commit is contained in:
Dorota Czaplejewicz
2019-11-20 13:17:47 +00:00
parent 8690808a29
commit 0c7e77a05f

View File

@ -158,6 +158,8 @@ eek_gtk_keyboard_real_button_press_event (GtkWidget *self,
return TRUE; return TRUE;
} }
// TODO: this belongs more in gtk_keyboard, with a way to find out which key to re-render // TODO: this belongs more in gtk_keyboard, with a way to find out which key to re-render
static gboolean static gboolean
eek_gtk_keyboard_real_button_release_event (GtkWidget *self, eek_gtk_keyboard_real_button_release_event (GtkWidget *self,
@ -170,6 +172,18 @@ eek_gtk_keyboard_real_button_release_event (GtkWidget *self,
return TRUE; return TRUE;
} }
static gboolean
eek_gtk_keyboard_leave_event (GtkWidget *self,
GdkEventCrossing *event)
{
if (event->type == GDK_LEAVE_NOTIFY) {
// TODO: can the event have different coords than the previous move event?
release(EEK_GTK_KEYBOARD(self), event->time);
}
return TRUE;
}
static gboolean static gboolean
eek_gtk_keyboard_real_motion_notify_event (GtkWidget *self, eek_gtk_keyboard_real_motion_notify_event (GtkWidget *self,
GdkEventMotion *event) GdkEventMotion *event)
@ -279,6 +293,9 @@ eek_gtk_keyboard_class_init (EekGtkKeyboardClass *klass)
eek_gtk_keyboard_real_button_release_event; eek_gtk_keyboard_real_button_release_event;
widget_class->motion_notify_event = widget_class->motion_notify_event =
eek_gtk_keyboard_real_motion_notify_event; eek_gtk_keyboard_real_motion_notify_event;
widget_class->leave_notify_event =
eek_gtk_keyboard_leave_event;
widget_class->touch_event = handle_touch_event; widget_class->touch_event = handle_touch_event;
gobject_class->set_property = eek_gtk_keyboard_set_property; gobject_class->set_property = eek_gtk_keyboard_set_property;