13
0

Turn touchscreen debug prints into gdk-debug messages

This commit is contained in:
Robin Gareus 2024-11-07 06:13:12 +01:00
parent 2ad12280f6
commit efbc8b4390
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 40 additions and 11 deletions

View File

@ -81,7 +81,8 @@ static const GDebugKey gdk_debug_keys[] = {
{"multihead", GDK_DEBUG_MULTIHEAD},
{"xinerama", GDK_DEBUG_XINERAMA},
{"draw", GDK_DEBUG_DRAW},
{"eventloop", GDK_DEBUG_EVENTLOOP}
{"eventloop", GDK_DEBUG_EVENTLOOP},
{"touch", GDK_DEBUG_TOUCH}
};
static const int gdk_ndebug_keys = G_N_ELEMENTS (gdk_debug_keys);

View File

@ -373,10 +373,16 @@ _gdk_win32_window_procedure (HWND hwnd,
void
_gdk_events_init (void)
{
printf ("CHECK FOR Touch/Pointer API..\n");
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_TOUCH)
g_message ("CHECK FOR Touch/Pointer API..\n");
#endif
getPointerType = (PFN_GetPointerType) GetProcAddress (GetModuleHandle ("user32.dll"), "GetPointerType");
getPointerTouchInfo = (PFN_GetPointerTouchInfo) GetProcAddress (GetModuleHandle ("user32.dll"), "GetPointerTouchInfo");
printf ("Found GetPointerType = %p GetPointerTouchInfo = %p\n", getPointerType, getPointerTouchInfo);
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_TOUCH)
g_message ("Found GetPointerType = %p GetPointerTouchInfo = %p\n", getPointerType, getPointerTouchInfo);
#endif
GSource *source;
@ -2045,19 +2051,28 @@ handle_wm_pointer (GdkEventType type, GdkWindow* window, MSG* msg)
}
if (!getPointerType (GET_POINTERID_WPARAM (msg->wParam), &pointer_type))
{
printf ("getPointerType failed to translate event\n");
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_TOUCH)
g_message ("getPointerType failed to translate event\n");
#endif
return FALSE;
}
if (pointer_type != 2 /* touch */)
{
printf ("Not A Touch event\n");
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_TOUCH)
g_message ("Not A Touch event\n");
#endif
return FALSE;
}
POINTER_TOUCH_INFO touch_info;
if (!getPointerTouchInfo (GET_POINTERID_WPARAM (msg->wParam), &touch_info))
{
printf ("getPointerTouchInfo failed to translate event\n");
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_TOUCH)
g_message ("getPointerTouchInfo failed to translate event\n");
#endif
return FALSE;
}
@ -2125,7 +2140,10 @@ handle_wm_pointer (GdkEventType type, GdkWindow* window, MSG* msg)
event->touch.flags = 0; // touch_sequence == 0 ? 0x20000 : 0;
event->touch.deviceid = 0;
printf ("getPointerTouchInfo type = %d at: %.1fx%.1f root: %1.fx%1.f seq=%d\n", type, event->touch.x, event->touch.y, event->touch.x_root, event->touch.y_root, touch_sequence);
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_TOUCH)
g_message ("getPointerTouchInfo type = %d at: %.1fx%.1f root: %1.fx%1.f seq=%d\n", type, event->touch.x, event->touch.y, event->touch.x_root, event->touch.y_root, touch_sequence);
#endif
_gdk_win32_append_event (event);
}

View File

@ -263,7 +263,10 @@ _gdk_events_init (GdkDisplay *display)
int firstevent, firsterror;
if (display_x11->xi.libxi && XQueryExtension (display_x11->xdisplay, "XInputExtension", &display_x11->xid_opcode, &firstevent, &firsterror))
{
printf ("CHECK FOR TOUCHSCREENs\n");
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_TOUCH)
g_message ("CHECK FOR TOUCHSCREENs\n");
#endif
int n_devices;
XIDeviceInfo* info;
@ -290,7 +293,10 @@ _gdk_events_init (GdkDisplay *display)
}
}
if (direct_touch) {
printf ("XI: touch-device id=%d name='%s' ntouch: %d\n", dev->deviceid, dev->name, classInfo->num_touches);
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_TOUCH)
g_message ("XI: touch-device id=%d name='%s' ntouch: %d\n", dev->deviceid, dev->name, classInfo->num_touches);
#endif
if (!display_x11->touch_devices) {
display_x11->touch_devices = g_hash_table_new (g_direct_hash, NULL);
}
@ -2246,7 +2252,10 @@ gdk_event_translate (GdkDisplay *display,
&& display_x11->touch_devices && g_hash_table_lookup (display_x11->touch_devices, GUINT_TO_POINTER (((XIDeviceEvent *)xevent->xcookie.data)->deviceid)))
{
XIDeviceEvent *xev = (XIDeviceEvent *) xevent->xcookie.data;
printf ("TOUCH dev=%d src=%d | dt: %u flags: %x\n", xev->deviceid, xev->sourceid, xev->detail, xev->flags);
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_TOUCH)
g_message ("TOUCH dev=%d src=%d | dt: %u flags: %x\n", xev->deviceid, xev->sourceid, xev->detail, xev->flags);
#endif
window = gdk_window_lookup_for_display (display, xev->event);
g_object_ref (window);

View File

@ -92,7 +92,8 @@ typedef enum {
GDK_DEBUG_MULTIHEAD = 1 <<12,
GDK_DEBUG_XINERAMA = 1 <<13,
GDK_DEBUG_DRAW = 1 <<14,
GDK_DEBUG_EVENTLOOP = 1 <<15
GDK_DEBUG_EVENTLOOP = 1 <<15,
GDK_DEBUG_TOUCH = 1 <<16
} GdkDebugFlag;
#ifndef GDK_DISABLE_DEPRECATED