Page MenuHome

Fixes to T55589 and T60967 stylus pressure

Authored by Christopher Peerman (chris_82) on Feb 6 2019, 8:09 PM.



This fix is aimed at the following issues:

  • T60967: Grease Pencil pressure sensitivity issue with Adesso Cyber tablet T12
  • T55589: Microsoft Surface pens does not send first events when moves

The new implementation uses WM_POINTERDOWN, WM_POINTERUP and WM_POINTERUPDATE and pointer API to process stylus events. It also changes how the pressure is reset when the Windows Ink implementation is enabled.

By processing the WM_POINTERDOWN, WM_POINTERUP and WM_POINTERUPDATE events this implementation this implementation should work on Windows 8, Windows 10 (using legacy pen interaction) and Windows 10 (using the new pen interaction), as Blender will not recieve the delays introduced by gesture recognition or whilst Windows changes the event into mouse WM_MOUSExxx or WM_xBUTTONxxx events.

The previous version reset the pressure to full when the pen left the screen, however for some hardware implementations this allowed a small window where Blender may process the final move event and read the pressure as full leaving a dot on the last event.

The destructor for GHOST_WindowWin32 also had the m_user32 being free'd off in two seperate locations. The updated implementation removes the redundant lines of code.

Diff Detail

rB Blender

Event Timeline

I don't have a windows computer and I'm not familiar with the code in question either. So I don't think I will be a good reviewer for this... :P

Brecht Van Lommel (brecht) requested changes to this revision.Feb 12 2019, 1:57 PM

This introduces a bug for me with an old Wacom Bamboo tablet, where the first touch is always full pressure. This only happens when the tablet API is set to Automatic, Wintab works fine and Windows Ink gives no pressure.

I think we could solve this by always giving priority to Wintab if the API is there and a tablet is found. The current handling of both at the same time seems too unpredictable.


Code style convention: indent case.


Code style: { on new line.

warning C4715: 'GHOST_WindowWin32::getPointerInfo': not all control paths return a value
This revision now requires changes to proceed.Feb 12 2019, 1:57 PM

Thanks I'll try update soon. I just spotted in processPointerEvent, if I added window->setTabletData(&pointerInfo.tabletData); to the GHOST_kEventButtonDown case statement it should fix the problem you're experiencing.

I have not heard any updates on this issue with the Microsoft Pen not showing first events. Can you please give an update as to the status of this?

Adding window->setTabletData(&pointerInfo.tabletData); to GHOST_kEventButtonDown didn't help here.

I couldn't find another workaround, so I plan to commit the change to always use wintab when a tablet device is found through it. Hopefully computers that need Windows Ink then either won't have the Wintab driver or won't detect the device through it. It's always possible to manually change it in Preferences > Input > Tablet as well.

If it causes problems in practice we can change this behavior, perhaps always defaulting to Windows Ink and requiring users with older devices to change the preferences.

This revision is now accepted and ready to land.Apr 3 2019, 7:59 PM
This revision was automatically updated to reflect the committed changes.

I have found that since the fix on Suface Pen first events that now Grese Pencil effects do not work and the clean up loose points under strokes do not work.

Holiday greetings,

On the latest release of Blender 2.81a I have found that stylus pressure no longer works.

I've disabled all my addons to check if there was some sort of interference happening and blender still does not detect stylus pressure. I've also checked that other apps work with stylus pressure, so it is definitely a Blender issue. Below is a screenshot showing that I have pressure input enabled for my brushes:

I've also attached the blend file I'm working in.

Hope this doesn't take you away from holiday time with your families for too long, and that the fix is something easy.