Repository navigation
Add the 'hold' feature as requested by #18 - #22
Conversation
Select the 'Hold' value in the 'Click type'. It disable widgets that make no sense in such situation. Emits the 'mouse down' event on start, and 'mouse up' on stop. Signed-off-by: ctxnop <ctxnop@gmail.com>
Reworked a bit the switch/case handling in mouse_up/down functions for a cleaner code. Removed a useless comment that I copy/pasted from the Gtk's documentation. Signed-off-by: ctxnop <ctxnop@gmail.com>
|
I can fix these since I'm kinda bored atm |
As pointed out by @robiot there is no reason to have two almost identical function where one function can handle both cases. Signed-off-by: ctxnop <ctxnop@gmail.com>
|
I fixed it. Let me know if you see any other issue I can solve. |
Added the 'Hold' in the "Choose click type" feature item. Signed-off-by: ctxnop <ctxnop@gmail.com>
Changed name of the MouseEvents items to reflect what it's doing. Also put click modes inside an enum
Instead of using the count variable which is for the repeat option
|
LGTM. Will check again tomorrow and hopefully merge. |
|
Yeah, I agree. I thought that the main thread could lock a mutex on start and release it on stop. So the "clicking" thread would lock the same mutex and be blocked until the main thread released it. But, to be honest, I added this feature because I needed it this afternoon for few hours only. So I didn't want to spend too much time on it. If you want me to implement something using locks, tell me, I'll propose you something soon. |
| MOUSE_EVENT_PRESS, | ||
| MOUSE_RELEASE, |
There was a problem hiding this comment.
Feels a bit weird to me. Why there is a _EVENT_ part for press but not for release?
There was a problem hiding this comment.
Thank you for pointing that out. Didn't notice it.
robiot
left a comment
There was a problem hiding this comment.
Looks good now. Let me know if you find anything weird. I'll merge as soon possible.
| g_thread_new("get_cursor_pos_handler", get_cursor_pos_handler, NULL); | ||
| } | ||
|
|
||
| void click_type_entry_changed() |
There was a problem hiding this comment.
Does not disable the Custom Location switch
There was a problem hiding this comment.
Yes, on purpose. I mean, I was wondering if it make sense. I didn't find any useful case but didn't want to prevent it as maybe someone has a use case I don't see.
I primarily implement this feature in few minutes because I was playing factorio and I needed something to hold the right click for me (which is mining resources) while I was away cooking (true story....). So I think it might make some sense in this context as I could set the custom location right under my character feets (almost screen center in this case) so that it gives me a hotkey to start mining whatever resource I'm on.
| MOUSE_EVENT_PRESS, | ||
| MOUSE_RELEASE, |
There was a problem hiding this comment.
Thank you for pointing that out. Didn't notice it.
ctxnop
left a comment
There was a problem hiding this comment.
LGTM. Maybe adding some braces on if/else branches. I'm used to omit those but that may not fit your coding styles.
|
Merging. Thank you very much. |
* Add the 'hold' feature as requested by #18 Select the 'Hold' value in the 'Click type'. It disable widgets that make no sense in such situation. Emits the 'mouse down' event on start, and 'mouse up' on stop. Signed-off-by: ctxnop <ctxnop@gmail.com> * Better case handling and removed a useless comment Reworked a bit the switch/case handling in mouse_up/down functions for a cleaner code. Removed a useless comment that I copy/pasted from the Gtk's documentation. Signed-off-by: ctxnop <ctxnop@gmail.com> * Refactor the two mouse_up/down function into one As pointed out by @robiot there is no reason to have two almost identical function where one function can handle both cases. Signed-off-by: ctxnop <ctxnop@gmail.com> * Updated the README.md to add the new feature Added the 'Hold' in the "Choose click type" feature item. Signed-off-by: ctxnop <ctxnop@gmail.com> * Minor naming fixes Changed name of the MouseEvents items to reflect what it's doing. Also put click modes inside an enum * Comment fix and formatting * Use own variable for keeping track of if already holding Instead of using the count variable which is for the repeat option * Fix Enum item naming Co-authored-by: Robiot <r0w80abc@gmail.com>
Select the 'Hold' value in the 'Click type'. It disable widgets that
make no sense in such situation. Emits the 'mouse down' event on start,
and 'mouse up' on stop.
Signed-off-by: ctxnop ctxnop@gmail.com