Detect when Ctrl is pressed - gtk

I'm implementing a ctrl+click solution for links in a textview and am having trouble setting the cursor to a hand when Ctrl is being held. Right now I
set the cursor to a hand in mouse motion when mouse moves inside the textview and control is pressed and the mouse is on top of a link (I use TextTag to style the links, so I just check whether the text below the mouse has this tag.).
set the mouse cursor back to the text edit cursor otherwise
However, when the mouse is on top of the link and I press Ctrl (without moving the mouse) the cursor does not change. Clearly, no mouse motion was detected so this is the expected behavior. My problem is how to implement this. I tried adding a keypress handler to the textview, but
it only fires when the textview has focus. This is not always the case, since I might not click the textview before clicking the link.
event.get_state() only comes with CONTROL_MASK if other key is pressed as well.
I receive no information about the mouse cursor, so I end up not knowing where it is pointing inside the keypress handler.
How can I solve these issues so I can have a Ctrl+click solution that shows adequate cursor when Ctrl is being pressed? I can already solve it by considering only mouse motion. The problem is how to detect Ctrl being pressed and react accordingly without mouse motion.

Related

VSCode keyboard scrolling

When scrolling with keyboard with ctrl + up/down in windows and the cursor still in the first place, so when I leave ctrl button and move cursor with keyboard up/down/left/right keys in order to place the cursor in currently scrolled place, the scroll goes to the first place where the cursor was! is there any way when scrolling with keyboard move cursor along with?

Is there a way to dismiss hover window (the tooltip like thingy) when I press any key?

In typescript project I hover the mouse over types to find what it contains. Then pressing any key dismisses it.
However when I bring the same tooltip via keyboard, it does not dismiss untill I press escape.
Is there some settings to auto dismiss the tooltip when it is invoked by the keyboard ?
This will help a smooth learn and edit experience

Autohotkey - Enable all mouse click functionality and also play a sound

I have this autohotkey script, I want to play a sound on mouse click. But this script doesn't let me drag windows or resize window or highlighting text using mouse left click.
Any idea how I can have all mouse left click functionality and also play the Error.wav sound on every click?
LButton::
MouseClick, Left
SoundPlay, C:\Windows\media\Error.wav
return
Your current script is not only listening for a mouse click, but also emulating a second click with MouseClick, Left. It seems that's not what you want. Also use ~ to ensure that
When the hotkey fires, its key's native function will not be blocked
(hidden from the system)
~LButton::SoundPlay, C:\Windows\media\Error.wav
See Hotkeys documentation.

Access mouse over hover in VSCode

Is there a way to access the mouse over popup in VSCode via Keyboard and navigate in it?
I often use the mouse over to get the namespace of function or variable ...
So I want to place the cursor on "bar", popup the hover (Show Hover Ctrl+k Ctrl+i), focus it, mark some text (eg. namespace::functioname), copy and close the hover.
namespace foo{
void bar();
}
First problem, the hover doesn't get the focus and I don't know how to focus it. But there is another feature "Show defintion preview hover", which actually gets focused. So far so good. But I still cannot mark or copy text inside the hover via keyboard.
Show hover (not focused):
Show definition preview hover (focused):
But I still cannot mark or copy text inside the hover via keyboard.
That should change with VSCode 1.68 (May 2022):
Lock hovers to more easily mouse over them
Some custom hovers cannot be moused over and others are tricky to mouse over without hiding it because of other things in the way (eg. like a scroll bar).
Holding alt while a hover is active will now "lock" it, giving it a wider border and preventing moving the mouse outside of the hover widget or whatever triggered it from hiding it.
This is primarily an accessibility feature to make hovers play nice with screen magnifiers but it is also useful for copying text from certain hovers.
Note that this feature only applies outside of the editor because editor hovers can always be moused over unless specified otherwise via a setting.
This will be helpful for other views (debug, terminal, ...) where variables with their popup can appear as well.
In the editor, see microsoft/vscode issue 63296
ctrl+K ctrl+I to show the hover and focus it
ctrl+A to select all the hover content
ctrl+C to copy to clipboard
It does indeed work for me (on windows) for the first two steps, however ctrl+C does not copy the text selected with ctrl+A.
It seems like there are two different selections possible in the hover:
ctrl+Aselects everything with a dark blue.
When selecting some text in the hover with the mouse (i.e. press the left mouse button while near/over a char, move mouse, release left mouse button) the selected text is shown in a lighter and brighter blue.
The two selections can coexist.
ctrl+C always copies the text selected with the mouse, or nothing if there's no such selection, no matter whether a ctrl+A selection also has been done.
If there's only a ctrl+A selection, ctrl+C doesn't copy anything.
The two selections can be selected in any order. The order doesn't change the behavior.
Think I found out what you were after.
The shortcut is: Ctrl+K Ctrl+I
See: Trigger advanced hover information with keyboard
please try control + mouse click
it may be help you

Keyboard's event considered like mouse's click on the GUI

I'm using GUI, I have 4 button in my GUI and my callback detect mouse and keyboard event.
Mouse event concerns click on button
Keyboard event concerns space press to play a .wav
When the position of mys cursor's mouse is on one of the 4 buttons, and I press space I've the following error
"Undefined function 'pushbutton4_KeyPressFcn' for input arguments of type 'struct'."
I didn't define any keyboard shortcut for the GUI's button, how can I avoid this error ?
Thanks !
Open the GUI in GUIDE.
Right click on the button and chose 'Property Inspector'.
Scroll down to the 'KeyPressFcn' field and delete the value.
Save the GUI and try again.