Pen input events

When I connect a pen tablet to my PC, the pen movement is visible in my application (it receives “motion-notify-events”), but the pen-down is not translated into button-press-event, as I was expecting.

What signals/events do I need to connect to in order to respond to pen-down, pen-up events, and maybe there are other pen events that I’m not aware of?

Hello, Anton!

Yes, button-press-event and button-release-event are the right signals for handling pens / styluses, as well as mouse devices. May I ask more informations, e.g which OS or distro are you using? And which GTK version? If on Linux, which windowing system (X11 / Wayland)?

It doesn’t look like im getting those.
Would button numbers be different? “Unknown” button numbers might be filtered out, so i might have to acquaint my modules with the pen button numbers.
Gtk 2.26 32bit on Ubuntu budgie

Well, unless you have a specific setup for your graphics tablet, the button numbers should be as usual: 1, 2 or 3. Are you sure about the GTK version, though? The last GTK2 release was 2.24.33

I was wrong, the GTK2 exact version is 2.24.32 (the file name is
I DO get button-press-signal with button number = 1, but only when i click into my defocused window (i.e. another window is focused, and i click into my window). No subsequent button-press in response to pen-down, until i defocus my window, and then click in it again. Makes me think I do smth wrong in signal processing? Nothing wrong, though, comes up in mouse handling: the mouse works just fine, and the app has been fully-funcitonal with the mouse for years.
I do get button-press-signal for button number = 2 or 3 when i click the corresponding button on the stylus.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.