summaryrefslogtreecommitdiff
path: root/tools/libinput-debug-gui.c
Commit message (Collapse)AuthorAgeFilesLines
* tools/debug-gui: fix a deprecated warningPeter Hutterer2023-04-201-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Remove duplicate empty lines in our sourcePeter Hutterer2022-11-251-1/+0
| | | | | | | We only touch src and tools, imported headers from include are not ours to change. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* debug-gui: avoid locking pointer twiceJosé Expósito2022-10-101-1/+2
| | | | | | | | | | On Sway, and probably other Wayland compositors based on wlroots, the window_lock_pointer() was called twice. Avoid errors when window_lock_pointer() is invoked multiple times. Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/808 Signed-off-by: José Expósito <jose.exposito89@gmail.com>
* meson.build: check gtk targets before buildingPeter Hutterer2022-06-111-11/+11
| | | | | | | | | | | | | | We have two different dependencies on Wayland: GTK support and the wayland-protocols we use directly. If we have GTK support but wayland-protocols is not installed at meson configure time, our build fails. To avoid having multiple ifdefs in the code, let's define two new ones: HAVE_GTK_WAYLAND and HAVE_GTK_X11, both set if GTK supports that particular target (from pkgconfig) and we have the other support libraries we need. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* util: auto-declare the element variable in ARRAY_FOR_EACHPeter Hutterer2022-03-091-6/+0
| | | | | | | All cases we have in our code base have an otherwise unused variable to loop through the array. Let's auto-declare this as part of the loop. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* High-resolution scroll wheel supportPeter Hutterer2021-08-311-32/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting with kernel v5.0 two new axes are available for high-resolution wheel scrolling: REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES. Both axes send data in fractions of 120 where each multiple of 120 amounts to one logical scroll event. Fractions of 120 indicate a wheel movement less than one detent. This commit adds a new API for scroll events. Three new event types that encode the axis source in the event type name and a new API to get a normalized-to-120 value that also used by Windows and the kernel (each multiple of 120 represents a logical scroll click). This addresses a main shortcoming with the existing API - it was unreliable to calculate the click angle based on the axis value+discrete events and thus any caller using the axis value alone would be left with some ambiguity. With the v120 API it's now possible to (usually) calculate the click angle, but more importantly it provides the simplest hw-independent way of scrolling by a click or a fraction of a click. A new event type is required, the only way to integrate the v120 value otherwise was to start sending events with a discrete value of 0. This would break existing xf86-input-libinput (divide by zero, fixed in 0.28.2) and weston (general confusion). mutter, kwin are unaffected. With the new API, the old POINTER_AXIS event are deprecated - callers should use the new API where available and discard any POINTER_AXIS events. Notable: REL_WHEEL/REL_HWHEEL are emulated by the kernel but there's no guarantee that they'll come every accumulated 120 values, e.g. Logitech mice often send events that don't add up to 120 per detent. We use the kernel's wheel click emulation instead of doing our own. libinput guarantees high-resolution events even on pre-5.0 kernels. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
* debug-gui: pointer locking on X11José Expósito2021-08-031-0/+65
| | | | Signed-off-by: José Expósito <jose.exposito89@gmail.com>
* debug-gui: pointer locking on WaylandJosé Expósito2021-08-031-11/+143
| | | | | | Use the pointer constraints protocol to lock the pointer on Wayland. Signed-off-by: José Expósito <jose.exposito89@gmail.com>
* debug-gui: migrate to GTK4José Expósito2021-08-031-4/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Global: - Stop passing commandline arguments to gtk_init: https://docs.gtk.org/gtk4/migrating-3to4.html#stop-passing-commandline-arguments-to-gtk_init window_init function: - gtk_window_new doesn't require a type anymore - gtk_window_iconify has been renamed to gtk_window_minimize - gtk_container_add has been removed in favor of container specific APIs. Use gtk_window_set_child in this case. - gtk_widget_show_all has been removed, widgets are now visible by default: https://docs.gtk.org/gtk4/migrating-3to4.html#widgets-are-now-visible-by-default - gtk_widget_set_events to NULL is no longer required, widgets must set their event handlers explicitly now: https://blog.gtk.org/2020/04/29/custom-widgets-in-gtk-4-input/ window_delete_event_cb function: - Use the new close-request event: https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtkwidget-event-signals map_event_cb function: - gtk_widget_set_cursor_from_name instead of gdk_window_set_cursor - Wait until the draw area is resized to use the whole window to start calculating sizes window_place_ui_elements function: - Use gtk_widget_get_width and gtk_widget_get_height instead of gtk_window_get_size Drawing: - Use gtk_drawing_area_set_draw_func instead of the GtkWidget::draw signal: https://docs.gtk.org/gtk4/migrating-3to4.html#adapt-to-drawing-model-changes Signed-off-by: José Expósito <jose.exposito89@gmail.com>
* tools/debug-gui: refactor UI element placementJosé Expósito2021-08-031-6/+12
| | | | | | | | | Move the code used to pace the different UI elements to its own function. Refactor, no functional changes. Signed-off-by: José Expósito <jose.exposito89@gmail.com>
* tools/debug-gui: use GMainLoop instead of gtk_mainJosé Expósito2021-08-031-3/+14
| | | | | | Migrate to GMainLoop because gtk_main is deprecated in GTK 4. Signed-off-by: José Expósito <jose.exposito89@gmail.com>
* tools/debug-gui: move gtk_main_quit to a functionJosé Expósito2021-08-031-5/+14
| | | | | | | | Wrap the calls to gtk_main_quit in its own function. Refactor, no functional changes. Signed-off-by: José Expósito <jose.exposito89@gmail.com>
* Replace fallthrough comments with __attribute__((fallthrough))Peter Hutterer2021-07-221-1/+1
| | | | | | | This has recently been endorsed by the linux kernel, it should be good enough for us. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* libinput: add hold gesture public API and tool supportJosé Expósito2021-06-091-3/+56
| | | | | | | | Add hold gestures to the public API and the private functions to notify them. Also add hold gestures to debug-events and debug-gui. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
* use more safety list_for_each_safe when remove element in traversing listweizhixiang2021-05-241-1/+1
| | | | Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
* use ARRAY_FOR_EACH when traverse arrayweizhixiang2021-05-241-8/+8
| | | | Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
* tools/debug-gui: draw a sprite for the unaccelerated pointer as wellPeter Hutterer2021-03-111-6/+20
| | | | | | | | | Add a second grey v-shaped (upside down triangle) pointer that moves around with the unaccelerated deltas. This makes it easier to visualize how the unaccelerated pointer moves around, the snake helps for some use-cases but not all of them. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools/debug-gui: move the abs pointer position into a struct pointPeter Hutterer2021-03-111-4/+4
| | | | | | No functional changes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools/debug-gui: move the pointer position into a struct pointPeter Hutterer2021-03-111-10/+10
| | | | | | No functional change Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools/debug-gui: start the unaccelerated motion deltas in the screen centerPeter Hutterer2021-03-111-0/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: print the libinput_dispatch() counter for debugging messagesPeter Hutterer2020-10-061-1/+1
| | | | | | | | The messages with priority DEBUG refer to the various internal state machines updating, so it's useful to know when they did so. Let's count up every time we trigger libinput_dispatch() so we know how the messages group together. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: only call libinput_dispatch() once per pollPeter Hutterer2020-10-061-1/+0
| | | | | | | This is a closer approximation of all callers anyway, and it makes it easier to debug which events are handled per libinput_dispatch() call. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: when running the test suite, start the debug-gui minimizedPeter Hutterer2020-07-071-0/+2
| | | | | | | This allows us to run the option parsing test without getting interrupted by a million debug-gui windows popping up for half a second. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: constify the optarg handling of seatsPeter Hutterer2020-02-241-1/+1
| | | | | | | | This shuts up scan-build complaining about memory leaks in libinput debug-events (needs the right combination of --device option and eventually triggering usage()) and saves us a bunch of unnecessary allocations. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* pad: add LIBINPUT_EVENT_TABLET_PAD_KEY for pad keysPeter Hutterer2019-12-041-0/+2
| | | | | | | | | | | | | | | | | | | | The Wacom Cintiq 24HD and later tablets send specific key events for hardware/soft buttons. KEY_PROG1..KEY_PROG3 on earlier tablets, KEY_CONTROLPANEL, KEY_ONSCREEN_DISPLAY, and KEY_BUTTONCONFIG on later tablets. We ignore KEY_PROG1-3 because starting with kernel 5.4 older tablets will too use the better-named #defines. These differ from pad buttons as the key code in itself carries semantic information, so we should pass them on as-is instead of mapping them to meaningless 0-indexed buttons like we do on the other buttons. So let's add a new event, LIBINPUT_EVENT_TABLET_PAD_KEY and the associated functions to handle that case. Pad keys have a fixed hw-defined semantic meaning and are thus not part of a tablet mode group. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: make debug-events accept multiple device nodesPeter Hutterer2019-11-261-4/+4
| | | | | | | For interaction between devices it's necessary to look at more than one device at a time. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: debug-gui: show pressure/distance as vertical barPeter Hutterer2019-11-011-0/+27
| | | | | | | | | | Both of these are normalized so let's draw a bar that shows the values accordingly. This makes it a lot easier to check whether pressure values go to the maximum, etc. A little extra square is shown whenever the tip is logically down. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Remove some usage of libinput-util.hPeter Hutterer2019-09-111-1/+4
| | | | | | | Positive side-effect - this exposed a bunch of missing #includes that got pulled in by other headers before. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: return 77 if gtk_init() fails in the debug-guiPeter Hutterer2019-06-261-1/+2
| | | | | | | And when that happens, skip the tests because what's happening here is that you're running tests as root, but your X server doesn't allow root to connect. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: handle pad strip/ring events in the debug-guiPeter Hutterer2019-06-131-8/+103
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: display tablet and tablet pad buttons when pressedPeter Hutterer2019-06-131-0/+35
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tablet: add a the Totem tool type to the tablet interfacePeter Hutterer2019-06-071-0/+28
| | | | | | | | | | | | | | | | This is the public API only, not the internal bits, so nothing will work just yet. This interface addition is for the Dell Canvas Totem tool, so let's go with the same name because options like "Rotary" are too ambiguous. The totem is a knob that can be placed on the surface, it provides us with location and rotation data. The touch major/minor fields are filled in by the current totem, but they're always the same size. The totem exports BTN_0 as well, so let's add that to the debug-events output. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: display the discrete axis steps tooPeter Hutterer2019-03-041-0/+47
| | | | | | | | | | | Draw a second smaller scroll bar that moves with every discrete step. For that to work, we have to accumulate the value from the normal scroll events until we get the first discrete one, then move up. The value per discrete event changes depending on the click wheel angle, so we can't just use discrete on its own if we want the two scroll bars aligned. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: group the scroll bits into a structPeter Hutterer2019-03-041-12/+14
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: debug-gui: change the tablet colorPeter Hutterer2019-02-141-2/+2
| | | | | | Grey isn't pretty enough Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: debug-gui: add a previously unbalanced cairo_restore()Peter Hutterer2019-02-141-13/+6
| | | | | | And remove some of the unnecessary ones Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: debug-gui: move the pointer delta code to draw_pointerPeter Hutterer2019-02-141-22/+25
| | | | | | Not sure why this was in draw_tablet(), probably copy/paste Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: draw the tablet before the touch pointsPeter Hutterer2019-02-131-1/+1
| | | | | | | On the Dell Canvas Totem, the tool will cancel existing touch points and to visually debug that, we need the touchpoints to be drawn over the tool. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: draw other buttons in the debug-guiPeter Hutterer2019-02-131-0/+42
| | | | | | | | Buttons that aren't lmr are drawn in a separate button square now with the name as it comes from the kernel. This only handles one button at a time, but it'll do for debugging. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: debug-gui: move the lmr button handling into a substructPeter Hutterer2019-02-131-9/+12
| | | | | | No functional changes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: debug-gui: show cancelled touches as unfilled circlesPeter Hutterer2019-02-131-10/+27
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: don't apply config options on device removedPeter Hutterer2018-12-191-3/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: draw evdev events in the debug-guiPeter Hutterer2018-11-071-5/+296
| | | | | | | | | Listen to the pure evdev events from each device and print them. This makes it slightly easier to associate certain jumps with the output, or otherwise see that events are coming in even when libinput doesn't seem to process them anymore. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: let debug-events take a device pathPeter Hutterer2018-11-071-4/+10
| | | | | | | This is the most common use-case other than "all from udev", so let's just parse a device path correctly without requiring --device. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: make the tools exit with exit code 2 on usage issuesPeter Hutterer2018-11-071-5/+5
| | | | | | This makes it easier to test for usage issues Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: handle sigint in debug-guiPeter Hutterer2018-11-071-0/+11
| | | | | | Exit with success on SIGINT Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: fix grab handling in libinput debug-guiPeter Hutterer2018-08-271-6/+4
| | | | | | | | | | | | The libinput context's user_data was used for deciding whether to grab the event device but also to hold the struct window data for the debug-gui. Worked fine for the initial batch of devices, but any device coming in late would just use the first field of the struct window to decide whether to grab or not. Fixes #122 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: debug-*: show unaccelerated deltas for pointer eventsPeter Hutterer2018-08-081-0/+36
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: fix grab argument passing for libinput debug-eventsPeter Hutterer2018-06-141-1/+1
| | | | | | | | | | | | | | | The &grab pointer we used to pass as userdata was the address of the function argument which goes out of scope at the end of the function. This works fine for devices immediately opened but when a device connects later, the address may have been re-used since and it's content is undefined. If not NULL, we end up grabbing the device. Instead pass the grab option in which is guaranteed to live until the end of main. https://gitlab.freedesktop.org/libinput/libinput/issues/26 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: debug-gui: add some extra targets for pointer acceleration testingPeter Hutterer2018-05-211-0/+15
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>