Support for graphical tablets

57 views
Skip to first unread message

Iulian-Nicu Şerbănoiu

unread,
Jan 24, 2026, 4:18:27 AM (12 days ago) Jan 24
to wx-u...@googlegroups.com
Hello everybody,

Is there any support in wxWidgets for tablet drawing (pressure, tilt etc)?

Best regards,
Iulian

Maarten Bent

unread,
Jan 25, 2026, 3:56:28 PM (11 days ago) Jan 25
to wx-u...@googlegroups.com
Hi,

No, there is no support for pressure or tilt from a stylus or pen in wxWidgets.
Maybe there is a library extending wxWidgets that adds support for it, but I'm unaware of it.

Greetings,
Maarten
--
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
---
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/wx-users/CAJ5uX7qhZK_NH6o6%2BSe53kqebGt%2BKteiRC211-1rDUwt5wsMDg%40mail.gmail.com.

Iulian-Nicu Şerbănoiu

unread,
Jan 26, 2026, 8:39:51 AM (10 days ago) Jan 26
to wx-u...@googlegroups.com
Thanks for the answer.

I would give it a try for wxMSW and possibly wxGTK as I have access to them.

For MSW I believe I should start around here: https://github.com/wxWidgets/wxWidgets/blob/8245e1073ae66fd246d2ec180160d2e20acf3644/src/msw/window.cpp#L3196 (I am familiar a little with Win32 API). Then I would go for the "Bind" method and EVT_ macros.

Is there any interest in this implementation?  

All the best,
Iulian


Vadim Zeitlin

unread,
Jan 26, 2026, 8:44:06 AM (10 days ago) Jan 26
to wx-u...@googlegroups.com
On Mon, 26 Jan 2026 15:39:31 +0200 Iulian-Nicu Şerbănoiu wrote:

IN> I would give it a try for wxMSW and possibly wxGTK as I have access to them.
IN>
IN> For MSW I believe I should start around here:
IN> https://github.com/wxWidgets/wxWidgets/blob/8245e1073ae66fd246d2ec180160d2e20acf3644/src/msw/window.cpp#L3196
IN> (I am familiar a little with Win32 API). Then I would go for the "Bind"
IN> method and EVT_ macros.
IN>
IN> Is there any interest in this implementation?

It would be definitely useful to have support for more input devices, but
it would be better to discuss the API you plan to implement first. I have
no idea what information exactly is provided by these tablets (and whether
they all provide the same data or not), but the first question is whether
they should generate wxMouseEvents or some new wxDrawInputEvent.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/

Iulian-Nicu Şerbănoiu

unread,
Jan 26, 2026, 9:30:42 AM (10 days ago) Jan 26
to wx-u...@googlegroups.com
For Windows: https://learn.microsoft.com/en-us/windows/win32/inputmsg/wmpointer-reference

So the common events would be:


move
pendown
pen up

information that should be passed to the event: 
x,y, xTilt,yTilt, pressure.

From what I saw there are ways to differentiate between these events and normal mouse events:

So we have multiple inputs:


- mouse
- pen
- touch (screen?)
- pad

So there is a need to clarify the common part and decide 

My take would be to generate some new events wxTabletEvent which contain the even information mentioned above.

Waiting for any other suggestion.

Thanks,
Iulian

Vadim Zeitlin

unread,
Jan 26, 2026, 4:09:24 PM (10 days ago) Jan 26
to wx-u...@googlegroups.com
On Mon, 26 Jan 2026 16:30:23 +0200 Iulian-Nicu Şerbănoiu wrote:

IN> For Windows:
IN> https://learn.microsoft.com/en-us/windows/win32/inputmsg/wmpointer-reference
IN> For Linux (gtk):
IN> https://developer-docs.wacom.com/docs/icbt/linux/gtk/gtk-reference/
IN>
IN> So the common events would be:
IN>
IN> move
IN> pendown
IN> pen up

Just for completeness: we could support events specific to just one of the
platforms too, they would only need to be documented as specific to that
platform.

IN> information that should be passed to the event:
IN>
IN> https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-pointer_pen_info
IN> & https://docs.gtk.org/gdk4/enum.AxisUse.html

Note that we're still using GTK/GDK 3.

IN> x,y, xTilt,yTilt, pressure.

Windows seems to provide a pretty useful "eraser button pressed" flag,
so I'd provide the possibility to pass it on.

IN> From what I saw there are ways to differentiate between these events and
IN> normal mouse events:
IN> -
IN> https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getpointertype
IN> ( +
IN> https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-get_pointerid_wparam
IN> )
IN> - https://docs.gtk.org/gdk4/method.Device.get_source.html
IN>
IN> So we have multiple inputs:
IN>
IN> https://docs.gtk.org/gdk4/enum.InputSource.html &
IN> https://learn.microsoft.com/en-us/windows/win32/api/winuser/ne-winuser-tagpointer_input_type
IN>
IN> - mouse
IN> - pen
IN> - touch (screen?)
IN> - pad

We handle only a single mouse and a single source of touch input
currently, so I guess we should handle only a single pad too, even if I
could imagine using more than one simultaneously (more easily than using 2
mice).

IN> My take would be to generate some new events wxTabletEvent which contain
IN> the even information mentioned above.

It looks like both Windows and GTK use "pad" for these devices, so maybe
wxTouchPadEvent? Or would this be confusing/overlapping with the existing
wxMultiTouchEvent (BTW, it looks like Wacom tablets can also generate what
we call wxGestureEvent too)? Speaking of touch events, you should probably
add some demonstration of the new events into the existing touchtest
sample.

Anyhow, it definitely looks like it would be nice, and suitable for wx, to
add support to allow writing cross-platform code using such devices, so I'm
looking forward to seeing it.

Good luck!

Iulian-Nicu Şerbănoiu

unread,
Feb 3, 2026, 2:27:18 AM (2 days ago) Feb 3
to wx-u...@googlegroups.com
Hi,

I return with a quick update on the status as I managed to have some spare time this weekend.

The Windows integration is working fine with a sample code taking into account the pressure when making basic drawing.
A new drawing sample copied from an existing one is working fine with event macros - haven't tested with Bind, probably it works as I rigorously copy pasted from other events.

I have the tilt (x,y), pressure, rotation, position correctly transferred to the newly created event - only pressure testable because of my tablet device.

What remains is: the button state and the erasing part (from some flags - even though I don't have that capability in my "One by Wacom" tablet).

Should I make a pull request with what I have so far, or should I finish it completely?

NOTE: I only have this tablet to test on so if there are others with such devices, their support is welcome.

Do you have any other thoughts on what should be added?

Br,
Iulian

PS: For wxPython, since I also use it, should I also help with the new feature there or is there an automated way to import the event  / sync with the C++ wxWidgets code base?

PPS:  wxFormBuilder, my GUI builder of choice, are there any developers on this list that can add this new event? I can also make it, of course, but not very fast.

Vadim Zeitlin

unread,
Feb 3, 2026, 1:05:07 PM (2 days ago) Feb 3
to wx-u...@googlegroups.com
On Tue, 3 Feb 2026 09:27:00 +0200 Iulian-Nicu Şerbănoiu wrote:

IN> The Windows integration is working fine with a sample code taking into
IN> account the pressure when making basic drawing.

Great news, thanks!

IN> A new drawing sample copied from an existing one is working fine
IN> with event macros - haven't tested with Bind, probably it works as I
IN> rigorously copy pasted from other events.

FWIW I think it would be better to add demo of this to the gestures
sample, as it already contains somewhat related functionality and we
probably don't want to add yet another new sample just for this.

I'd also encourage you to use Bind() in the new code, of course, but this
is not critical.

IN> Should I make a pull request with what I have so far, or should I finish it
IN> completely?

If it works, please make the PR already. However please include the
documentation for the new API (in interface/wx/event.h, assuming you've
defined new classes in include/wx/event.h).

IN> PS: For wxPython, since I also use it, should I also help with the new
IN> feature there or is there an automated way to import the event / sync with
IN> the C++ wxWidgets code base?

You can try building wxPython, which has just been recently updated to
build with wx 3.3 (thanks a lot Scott if you're reading this), with your
branch and see if it groks the new API on its own or needs some help with
it.

Thanks again and looking forward to your PR!
Reply all
Reply to author
Forward
0 new messages