|
|
Home » Developing U++ » U++ Developers corner » Using Pen with U++
|
Re: Using Pen with U++ [message #56597 is a reply to message #56595] |
Sat, 27 March 2021 09:11 |
|
mirek
Messages: 14112 Registered: November 2005
|
Ultimate Member |
|
|
Tom1 wrote on Fri, 26 March 2021 18:52
However, e.g. RectTracker does not work as is with my Wacom tablet. The specific pen support (I just posted) is simply required for it to work. (I'm now under impression that RectTracker works with your tablet perfectly without these changes... ?? Perhaps XP-PEN drivers can avoids Windows Ink and work more mouse-like through the stack.)
Sorry, I might get lost in the code that we exchange here a lot...
Do you mean that my variant where Pen returns false and RectTracker is called in normal LeftDown does not work with Wacom? (My impression so far was that you are only testing RectTracker in Pen virtual method).
If so, does it mean RectTracker does not work even in pre-Pen U++? (With Wacom in "mouse mode")
Mirek
[Updated on: Sat, 27 March 2021 09:12] Report message to a moderator
|
|
|
Re: Using Pen with U++ [message #56600 is a reply to message #56597] |
Sat, 27 March 2021 12:20 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
mirek wrote on Sat, 27 March 2021 10:11Tom1 wrote on Fri, 26 March 2021 18:52
However, e.g. RectTracker does not work as is with my Wacom tablet. The specific pen support (I just posted) is simply required for it to work. (I'm now under impression that RectTracker works with your tablet perfectly without these changes... ?? Perhaps XP-PEN drivers can avoids Windows Ink and work more mouse-like through the stack.)
Sorry, I might get lost in the code that we exchange here a lot...
Do you mean that my variant where Pen returns false and RectTracker is called in normal LeftDown does not work with Wacom? (My impression so far was that you are only testing RectTracker in Pen virtual method).
If so, does it mean RectTracker does not work even in pre-Pen U++? (With Wacom in "mouse mode")
Mirek
Hi,
With original pre-Pen U++, RectTracker worked with Wacom at correct coordinates. (It only suffered from the Windows Ink induced 2 cm starting delay, but the rectangle followed pen thereafter.)
With current trunk code and testing with:
bool Pen(Point p, const PenInfo& pn, dword keyflags) override {
if(keyflags & K_SHIFT)
return false;
if(pn.pressure) {
if((!!pn.pressure == !!pen.pressure) && drawing.GetCount())
drawing.Top().Add(MakeTuple(pn.pressure, p));
else
drawing.Add().Add(MakeTuple(pn.pressure, p));
}
pen = pn;
Refresh();
return true;
}
void LeftDown(Point p, dword keyflags) override {
if(keyflags & K_SHIFT) {
RectTracker tracker(*this);
tracker.MinSize(Size(-100000,-100000));
tracker.Track(Rect(p,p));
}
}
the tracking rect still of course has the 2 cm starting delay. However, now the rect dragged corner lags behind with a 2 cm constant dx,dy offset. Please see below a photo of a live 'while dragging' situation. So, actually, RectTracker is now worse than before introducing pen support:
Further on, what I really need with RectTracker, is that there is no 2 cm reaction delay. The tracking must start immediately from PEN_DOWN event. My RectTracker inherited sketching code requires immediate reaction for even a single pixel pen drags. This is why I need specific Pen() support in RectTracker.
Best regards,
Tom
|
|
|
Re: Using Pen with U++ [message #56604 is a reply to message #56600] |
Sat, 27 March 2021 20:23 |
|
mirek
Messages: 14112 Registered: November 2005
|
Ultimate Member |
|
|
Tom1 wrote on Sat, 27 March 2021 12:20mirek wrote on Sat, 27 March 2021 10:11Tom1 wrote on Fri, 26 March 2021 18:52
However, e.g. RectTracker does not work as is with my Wacom tablet. The specific pen support (I just posted) is simply required for it to work. (I'm now under impression that RectTracker works with your tablet perfectly without these changes... ?? Perhaps XP-PEN drivers can avoids Windows Ink and work more mouse-like through the stack.)
Sorry, I might get lost in the code that we exchange here a lot...
Do you mean that my variant where Pen returns false and RectTracker is called in normal LeftDown does not work with Wacom? (My impression so far was that you are only testing RectTracker in Pen virtual method).
If so, does it mean RectTracker does not work even in pre-Pen U++? (With Wacom in "mouse mode")
Mirek
Hi,
With original pre-Pen U++, RectTracker worked with Wacom at correct coordinates. (It only suffered from the Windows Ink induced 2 cm starting delay, but the rectangle followed pen thereafter.)
With current trunk code and testing with:
bool Pen(Point p, const PenInfo& pn, dword keyflags) override {
if(keyflags & K_SHIFT)
return false;
if(pn.pressure) {
if((!!pn.pressure == !!pen.pressure) && drawing.GetCount())
drawing.Top().Add(MakeTuple(pn.pressure, p));
else
drawing.Add().Add(MakeTuple(pn.pressure, p));
}
pen = pn;
Refresh();
return true;
}
void LeftDown(Point p, dword keyflags) override {
if(keyflags & K_SHIFT) {
RectTracker tracker(*this);
tracker.MinSize(Size(-100000,-100000));
tracker.Track(Rect(p,p));
}
}
the tracking rect still of course has the 2 cm starting delay. However, now the rect dragged corner lags behind with a 2 cm constant dx,dy offset. Please see below a photo of a live 'while dragging' situation. So, actually, RectTracker is now worse than before introducing pen support:
Further on, what I really need with RectTracker, is that there is no 2 cm reaction delay. The tracking must start immediately from PEN_DOWN event. My RectTracker inherited sketching code requires immediate reaction for even a single pixel pen drags. This is why I need specific Pen() support in RectTracker.
Best regards,
Tom
OK, this works just fine with xp-pen...
Widgets in general do work? (Because if it is this way, I would just expect the offset to be everywhere...)
What happens if you remove return 0L in pen processing?
Mirek
|
|
|
Re: Using Pen with U++ [message #56605 is a reply to message #56604] |
Sat, 27 March 2021 20:45 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
Yes. Widgets mostly work. Some flickering with e.g. Menu, but I think nothing is severely broken. I can do a more thorough check later.
Breaking out from WM_POINTER* instead of return 0L; does not have any effect on this test with RectTracker. Offset remains.
The core problem in my opinion is ::GetCursorPos which does not work with pen. This comes evident with drags.
Best regards,
Tom
|
|
|
|
Re: Using Pen with U++ [message #56611 is a reply to message #56607] |
Sun, 28 March 2021 18:11 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
Quote:OK. In the new commit I treat GetCursorPos as "not reliable", overriding it with position got from lParam.
Hi Mirek,
That was a correct move. Now RectTracker works correctly after 2 cm Windows Ink threshold is crossed. This is via "Pen() return false; to LeftDown()".
In Pen(), RectTracker does not work at all yet.
I also tested with UWord to see how different widgets work. I could not immediately find anything that does not. Only dragging a top menu item to open a drop down menu causes flickering of the selected item on the drop down menu. If the drop down menu is opened by a pen click, hovering on top of the sub menu works correctly without any flickering.
Best regards,
Tom
|
|
|
|
Re: Using Pen with U++ [message #56613 is a reply to message #56612] |
Mon, 29 March 2021 12:33 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
Mirek,
I did a video clip portraying the menu highlight flickering issue. Sent a PM on that.
There is no such anomaly on pre-pen U++.
Best regards,
Tom
|
|
|
|
Re: Using Pen with U++ [message #56615 is a reply to message #56614] |
Mon, 29 March 2021 14:36 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
The click animations are never present with mouse.
When using Windows Ink -mode for Wacom, I get those click animations for pen.
When I disable Windows Ink -mode for Wacom, the thing starts to work exactly like mouse:
+ no click animations
+ immediate response with drags (i.e. no annoying 2 cm delay)
- NO Pen() event. Everything comes in as MouseMove, LeftDown, LeftUp... (This likely means there is no WM_POINTER* messages and everything is already translated to WM_MOUSEMOVE, WM_LBUTTONDOWN,... etc.)
- NO pressure detection either due to missing WM_POINTER* -messages.
So, using Windows Ink -mode is a must.
Best regards,
Tom
|
|
|
|
Re: Using Pen with U++ [message #56617 is a reply to message #56616] |
Mon, 29 March 2021 15:50 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
mirek wrote on Mon, 29 March 2021 16:35Well, that means that in the movie, you have used pen to open the menu, right?
Does this disbehave with mouse too? (Without animation?)
What happens if you comment out CtrlCore/Win32Proc.cpp:74?
Mirek
1. Yes, I used pen throughout the video.
2. With mouse it works perfectly OK. There is no click animation with mouse.
3. Commenting out:
// POINT p;
// if(::GetCursorPos(&p))
//CurrentMousePos = p;
Does not change anything.
Best regards,
Tom
|
|
|
|
Re: Using Pen with U++ [message #56619 is a reply to message #56618] |
Mon, 29 March 2021 16:20 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
Logging the changes shows that it's HasFocus() and especially HasMouse() that oscillates:
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 32 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 31 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 31 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 31 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 32 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 31 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 31 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 31 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
Best regards,
Tom
|
|
|
|
Re: Using Pen with U++ [message #56621 is a reply to message #56620] |
Mon, 29 March 2021 17:04 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
Do you have Windows Ink enabled with your XP-PEN? If not, please do. You might then see the click animations and experience the drag lag. Maybe the menu issue shows itself then...(?)
BR,
Tom
|
|
|
Re: Using Pen with U++ [message #56622 is a reply to message #56621] |
Mon, 29 March 2021 17:18 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
Thinking about it, as hovering with pen has no trouble, it must be an issue with 'pendown' not comparable to left mouse button being down. It might be partly identified as left mouse button being pressed and partly not, giving mixed messages about the state.
This is something that partially prevents RectTracker from being used with/from Pen() interface. (Which is still a main concern for me...)
Best regards,
Tom
|
|
|
Re: Using Pen with U++ [message #56623 is a reply to message #56622] |
Mon, 29 March 2021 17:29 |
Tom1
Messages: 1253 Registered: March 2007
|
Senior Contributor |
|
|
OK, I logged some MEvent0 coordinates and tracked for mouseCtrl changes. It seems this is flipping mouseCtrl a lot:
[+ 0 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [141, 199]
[+ 0 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [141, 199]
[+ 0 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [141, 199]
[+ 0 ms] HasMouse() = false
[+ 0 ms] MEvent0 [141, 199]
[+ 0 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [141, 199]
[+ 0 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [142, 199]
[+ 0 ms] MEvent0 [142, 199]
[+ 0 ms] MEvent0 [142, 199]
[+ 0 ms] WM_MOUSEMOVE
[+ 0 ms] MEvent0 [139, 21]
[+ 0 ms] mouseCtrl != this
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] MEvent0 [139, 21]
[+ 31 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [142, 199]
[+ 0 ms] mouseCtrl != this
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [142, 199]
[+ 0 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [142, 199]
[+ 0 ms] HasMouse() = false
[+ 0 ms] MEvent0 [142, 199]
[+ 16 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [143, 199]
[+ 0 ms] MEvent0 [143, 199]
[+ 0 ms] MEvent0 [143, 199]
[+ 0 ms] WM_MOUSEMOVE
[+ 0 ms] MEvent0 [140, 21]
[+ 0 ms] mouseCtrl != this
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasFocus() = true
[+ 0 ms] HasMouse() = true
[+ 0 ms] MEvent0 [140, 21]
[+ 16 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [143, 199]
[+ 0 ms] mouseCtrl != this
[+ 0 ms] HasFocus() = false
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] HasMouse() = false
[+ 0 ms] HasMouse() = true
[+ 0 ms] WM_POINTERUPDATE
[+ 0 ms] MEvent0 [143, 199]
Please note that pen is nearly stationary during this.
Best regards,
Tom
EDIT: Added WM_POINTERUPDATE and WM_MOUSEMOVE markers to the log, so that we can identify that the incompatible coordinates are coming from respective sources.
[Updated on: Mon, 29 March 2021 17:35] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Sun Nov 10 20:20:52 CET 2024
Total time taken to generate the page: 0.01433 seconds
|
|
|