Implement multitouch grab

This commit is contained in:
Robin Gareus 2024-09-25 19:32:21 +02:00
parent 594d295dcd
commit b852eec228
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 31 additions and 0 deletions

View File

@ -153,6 +153,11 @@ gdk_display_dispose (GObject *object)
display->queued_events = NULL;
display->queued_tail = NULL;
if (display->touch_grabs)
{
g_hash_table_destroy (display->touch_grabs);
}
_gdk_displays = g_slist_remove (_gdk_displays, object);
if (gdk_display_get_default() == display)

View File

@ -10848,6 +10848,30 @@ proxy_button_event (GdkEvent *source_event,
type, state,
NULL, serial);
/* multitouch grab */
if (type == GDK_TOUCH_BEGIN && !source_event->any.send_event)
{
GdkEventTouch* tev = (GdkEventTouch*) source_event;
if (!display->touch_grabs) {
display->touch_grabs = g_hash_table_new (g_direct_hash, NULL);
}
event_win = _gdk_window_find_descendant_at (toplevel_window, toplevel_x, toplevel_y, NULL, NULL);
g_hash_table_insert (display->touch_grabs, GUINT_TO_POINTER (tev->sequence), event_win);
}
else if (type == GDK_TOUCH_END && display->touch_grabs)
{
GdkEventTouch* tev = (GdkEventTouch*) source_event;
g_hash_table_remove (display->touch_grabs, GUINT_TO_POINTER (tev->sequence));
}
else if (type == GDK_TOUCH_UPDATE && display->touch_grabs)
{
GdkEventTouch* tev = (GdkEventTouch*) source_event;
void* w = g_hash_table_lookup (display->touch_grabs, GUINT_TO_POINTER (tev->sequence));
if (w) {
event_win = GDK_WINDOW (w);
}
}
if (event_win == NULL || display->ignore_core_events)
return TRUE;

View File

@ -101,6 +101,8 @@ struct _GdkDisplay
GdkKeyboardGrabInfo GSEAL (keyboard_grab);
GdkPointerWindowInfo GSEAL (pointer_info);
GHashTable *GSEAL (touch_grabs);
/* Last reported event time from server */
guint32 GSEAL (last_event_time);
};