This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Feature Updates
 Requests
 Add var to get the cursor type on gesture start
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

slangmgh

6 Posts

Posted - 07/03/2017 :  20:14:05  Show Profile
Now we have the acGetMouseCusorType, this can be useful when I need get the cursor type before the gesutre action should be fired, but sometimes I need get the cursor type on gesture start to decide which action should be taken. For example, when the mouse on the link of the browser I begin an gesture or when the mouse on the normal text I begin an gesture I may need an different action.

Rob

USA
2615 Posts

Posted - 07/04/2017 :  11:00:44  Show Profile  Visit Rob's Homepage
You might be surprised, but getting the cursor type is a very resource intensive thing to do, so I don't have S+ do that every time as it would affect the performance of S+.

I have an action that does this: http://www.strokesplus.com/scripts/2

You basically move the mouse back to the starting point, get the cursor type, then move the mouse back to the end point. It all happens extremely fast and you don't even notice it. And calling acConsumePhysicalInput stops any accidental mouse movements from being processed which could mess up the scripted movement of the mouse during the action.
Go to Top of Page

slangmgh

6 Posts

Posted - 07/04/2017 :  19:46:43  Show Profile
Thank you.
I now use another method to implement this.
I have another program which install the low level mouse hook, and save the cursor type when there is right mouse down, then in the strokeplus action I use the sendmessage to get the cursor type. The code is very simple, I don't know is is resource intensive.

void CheckCursorType() {
static HCURSOR hHand = LoadCursor(NULL, IDC_HAND);
CURSORINFO ci;
ZeroMemory(&ci, sizeof(ci));
ci.cbSize = sizeof(ci);

g_hand_cursor_set_time = GetTickCount();
if (GetCursorInfo(&ci) && ci.hCursor == hHand) {
g_hand_cursor_type = 5;
} else {
g_hand_cursor_type = 2;
}
}


There is only one annoying problem, when I disable then enable the strokeplus again, strokeplus will install the hook again and when right mouse down, it doesn't send the mouse event to the other hooks, so my program cannot recieve the event. I have to re-install the hooks of my program. :)

I will try your script to see the operation is smooth enough, thank you.

Edited by - slangmgh on 07/04/2017 19:49:35
Go to Top of Page

slangmgh

6 Posts

Posted - 07/04/2017 :  20:03:50  Show Profile
You script is works well. :)

The only problem is the link will flash one time.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 07/05/2017 :  07:41:46  Show Profile  Visit Rob's Homepage
It's not that it's SUPER resource intensive, but S+ already has to do enough stuff as fast as possible when the right-button is clicked, so I only opt to include absolutely necessary code within that event so as to pass along the right-click if the user is not trying to draw a gesture.

Also, your code is only doing the hand cursor check (since that's all you care about for this), take that times 16 for all the different cursor types and it's a lot of overhead for only a few times/users where it will be necessary that it always be available right away. Additionally, certain non-standard configurations actually don't work at all when someone has a very non-standard icon set. I've never looked deeply into that, and it was years ago, but still was enough that it made me apprehensive about the detection...so I certainly wouldn't want it to be doing that every time, taking CPU cycles, for something which isn't always guaranteed.

Like I said, it's really just to keep the right-click as lean as possible. S+ is already a slight bit slower than StrokeIt in this regard. Though I'd argue it's the trade off for some more power and flexibility, however I certainly don't want to make that any greater than is absolutely necessary.

Go to Top of Page

slangmgh

6 Posts

Posted - 07/05/2017 :  09:00:49  Show Profile
Thank you.
I can understand you position, there is always trade off.
So, another request, is it possible add an lua code event which will be triggered when the gesture begin,there is no any performance effect.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 07/05/2017 :  09:17:45  Show Profile  Visit Rob's Homepage
I'll be sure to include that in the new version of S+, whenever I get the time to actually continue that development effort! It already has something hooking into the gesture drawing process, by showing a small window displaying the current app/action matched while drawing, which changes when the gesture drawing starts to look like a different pattern, etc. So it would seem to fit in nicely there.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000