Home » Developing U++ » U++ Developers corner » Using Pen with U++
|
|
Re: Using Pen with U++ [message #56672 is a reply to message #56671] |
Fri, 02 April 2021 12:30 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
Hi,
I'm currently out of town, but will be back home in the evening. I'll test it then ASAP.
Thanks and best regards,
Tom
|
|
|
Re: Using Pen with U++ [message #56682 is a reply to message #56671] |
Fri, 02 April 2021 21:27 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
mirek wrote on Fri, 02 April 2021 12:43Please try trunk reference/Pen now...
Notes: This is just a first rough attempt, if this works, it needs a cleanup and handling of history.
Hi Mirek,
I just updated to latest SVN. All drags start 2 cm late. (Let's call this issue 'DragLag' for short from now on.) This is no wonder as WM_POINTERUPDATE does not send MouseMove() events to the app through any channel. Giving WM_POINTER* messages to the DefWindowProc*() to handle, causes DragLag before WM_LBUTTONDOWN and respective WM_MOUSEMOVE messages are generated. I have spent last two weeks on the issue and have not found any clean and easy way out with Wacom.
I understand that you don't have this DragLag -nightmare with XP-PEN and everything you do works with it. And that my attempts here are complex and ugly.
However, in order for Wacom to work with immediate response, we have to process everything from WM_POINTER* messages to application events (such as MouseMove(), LeftDown(), etc. or Pen() with proper PenInfo to decode the operations in the app.) If we also decide to break into DefWindowProc*() processing at the end of processing WM_POINTER* messages, we will need to block its resulting output to the Pen -enabled controls.
Best regards,
Tom
|
|
|
|
|
Re: Using Pen with U++ [message #56689 is a reply to message #56688] |
Sat, 03 April 2021 08:57 |
|
mirek
Messages: 14112 Registered: November 2005
|
Ultimate Member |
|
|
In general: I strongly believe that whatever model we choose in the end, it must not require changes in CtrlLib.
WRT to draglag, after reading MSDN docs, I have the impression that this is exactly what M$ wants to happen.
Anyway, a draglag related question - it is not quite clear to me whether the draglag which you experience is
a) drag starts late, after moving pen a bit, not immediately
b) drag has offset
(With XPPEN, with current model, drag just starts a little late, but position is correct)
Mirek
|
|
|
Re: Using Pen with U++ [message #56690 is a reply to message #56689] |
Sat, 03 April 2021 10:37 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
mirek wrote on Sat, 03 April 2021 09:57In general: I strongly believe that whatever model we choose in the end, it must not require changes in CtrlLib.
WRT to draglag, after reading MSDN docs, I have the impression that this is exactly what M$ wants to happen.
Anyway, a draglag related question - it is not quite clear to me whether the draglag which you experience is
a) drag starts late, after moving pen a bit, not immediately
b) drag has offset
(With XPPEN, with current model, drag just starts a little late, but position is correct)
Mirek
What I decided to call draglag is a), it starts 2 cm late on screen, but does not introduce any offset.
Now that I read your MSDN finding, I understand draglag is the decision lag for Windows Ink to figure out 'pen gestures'.
Quote:What about other issues? I mean, does it work as mouse elsewhere?
In principle almost everything works. Draglag is the only serious problem.
Other related peculiarities (Windows pen gestures?):
- LeftHold translates to RightDown+RightUp
- While tap with barrel pressed tranlates to RightDown+RightUp, a drag with barrel becomes a left drag (=LeftDown+LeftDrag+MouseMoves+LeftUp).
Also, my Sketcher no longer works, but that should be fixable here as RectTracker works.
So, in my opinion, we should get rid of DragLag and hopefully Windows pen gestures too, and receive just the same event behavior as is available with a mouse. This way CtrlLib (and apps) would not require any changes to support pen, but with GetPenInfo() we could benefit from the pen. I would suggest that a pressed barrel would change pen down to RightDown and so on.
That would be the most natural experience for a user. If we want to emulate Right click with pen hold, we would map LeftHold to RightUp in our app.
Best regards,
Tom
|
|
|
|
Re: Using Pen with U++ [message #56692 is a reply to message #56691] |
Sat, 03 April 2021 11:37 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
Adding:
case WM_TABLET_QUERYSYSTEMGESTURESTATUS:
return TABLET_DISABLE_PRESSANDHOLD;
Removes the pen down/hold/up mapping to RightDown/RightUp and instead gives LeftDown/LeftUp. No LeftHold is generated during the prolonged pen-down though.
Unfortunately, this does not help at all with draglag.
Best regards,
Tom
|
|
|
|
Re: Using Pen with U++ [message #56694 is a reply to message #56693] |
Sat, 03 April 2021 16:02 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
mirek wrote on Sat, 03 April 2021 16:52Tom1 wrote on Sat, 03 April 2021 11:37Adding:
case WM_TABLET_QUERYSYSTEMGESTURESTATUS:
return TABLET_DISABLE_PRESSANDHOLD;
Removes the pen down/hold/up mapping to RightDown/RightUp and instead gives LeftDown/LeftUp. No LeftHold is generated during the prolonged pen-down though.
Unfortunately, this does not help at all with draglag.
Best regards,
Tom
Another thing we can try is to retain Pen method, but discard bool return value, always process with DefWindowProc. Create new RectTracker just for Pen...
OK, let's see how it turns out. GetMessageExtraInfo() may be useful to classify events to application so that we can filter out already processed pen events and not do it again as if they are coming from the mouse.
Best regards,
Tom
|
|
|
|
Re: Using Pen with U++ [message #56696 is a reply to message #56695] |
Sat, 03 April 2021 16:17 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
OK, I'll try, but I'm afraid it may fall back to you eventually...
As for the RectTracker, I would prefer it is a single RectTracker capable of reacting to both pen and mouse, so that I do not need to create separate Sketchers for each.
Best regards,
Tom
|
|
|
|
|
|
Re: Using Pen with U++ [message #56711 is a reply to message #56709] |
Sun, 04 April 2021 20:35 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
Hi Mirek,
Thanks for accepting the changes.
It was a stupid mistake of me to use Image::Arrow() instead of CursorImage(). It should be in CtrlMouse.cpp(145) like:
if(supports_pen && is_pen_event) return CursorImage(p, keyflags); // Avoid duplicated pen events
Although, after returning from every other event except 'case CURSORIMAGE:' in 'Image Ctrl::MouseEvent()' causes returning Image::Arrow()...
Without 'supports_pen' it would become a tedious battle in client code to avoid various pen originated duplicate mouse events, so I rather block them just before. Anyway, making 'bool supports_pen;' a configurable flag in Ctrl:: in CtrlCore.h is fine with me:
Ctrl& EnablePenSupport(bool b = true) { supports_pen = b; return *this; }
Then, to avoid Pen() return value assignment in Win32Proc.cpp(147), we should remove 'supports_pen =' and have just:
q->Pen(p, pen, GetMouseFlags());
This works here. (I will of course add 'EnablePenSupport();' to constructors of Pen() enabled widgets.)
This includes RectTracker::RectTracker() in LocalLoop.cpp:
RectTracker::RectTracker(Ctrl& master)
{
EnablePenSupport();
Best regards,
Tom
[Updated on: Sun, 04 April 2021 20:40] Report message to a moderator
|
|
|
Re: Using Pen with U++ [message #56712 is a reply to message #56711] |
Sun, 04 April 2021 20:42 |
|
mirek
Messages: 14112 Registered: November 2005
|
Ultimate Member |
|
|
Tom1 wrote on Sun, 04 April 2021 20:35Hi Mirek,
Thanks for accepting the changes.
It was a stupid mistake of me to use Image::Arrow() instead of CursorImage(). It should be in CtrlMouse.cpp(145) like:
if(supports_pen && is_pen_event) return CursorImage(p, keyflags); // Avoid duplicated pen events
Without 'supports_pen' it would become a tedious battle in client code to avoid various pen originated duplicate mouse events, so I rather block them just before. Anyway, making 'bool supports_pen;' a configurable flag in Ctrl:: in CtrlCore.h is fine with me:
I understand that, but would that be really that hard? Esp. now that we have K_PEN?
Quote:
Ctrl& EnablePenSupport(bool b = true) { supports_pen = b; return *this; }
Then, to avoid Pen() return value assignment in Win32Proc.cpp(147), we should remove 'supports_pen =' and have just:
q->Pen(p, pen, GetMouseFlags());
This works here. (I will of course add 'EnablePenSupport();' to constructors of Pen() enabled widgets.)
This includes RectTracker::RectTracker() in LocalLoop.cpp:
RectTracker::RectTracker(Ctrl& master)
{
EnablePenSupport();
Best regards,
Tom
Actually, maybe you could rather not call EnablePenSupport in RectTracker contructor and leave that to client code?
But then, should not that prevent call of Pen virtual method too?
BTW, given what it does, should not that rather be called "DiasbleMouse"?
Mirek
|
|
|
Re: Using Pen with U++ [message #56713 is a reply to message #56712] |
Sun, 04 April 2021 22:02 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
I agree that 'EnablePenSupport' is a bad name for it. 'DisableMouse' is not any better. In fact it should be something like 'DisableEmulatedMouseEventsForPen'.
But, as practically always, you are right: I can do everything related to 'supports_pen' flag at client side. I just add this to my Pen enabled widget:
virtual Image MouseEvent(int event, Point p, int zdelta, dword keyflags) override {
if(keyflags&K_PEN) return CursorImage(p, keyflags);
return Ctrl::MouseEvent(event, p, zdelta, keyflags);
}
In this case, I would drop everything in CtrlCore having something to do with 'supports_pen'.
So the last question is: Do you really want to get rid of 'supports_pen' flag? Both ways are fine with me.
Best regards,
Tom
|
|
|
Goto Forum:
Current Time: Sun Nov 10 20:23:22 CET 2024
Total time taken to generate the page: 0.01413 seconds
|