Is there a Win10 shortcut to return the mouse pointer to the last clicked location? - windows

I wondered if there's a way of returning the mouse pointer to its last clicked location in Win10?
The desired behaviour would be:
User clicks left key on mouse. This can be anywhere in the browser window, it doesn't have to be a UI element.
User uses moves mouse to another location.
User presses shortcut keys.
Mouse is returned to its last clicked location.
I've seen AHK scripts that return the mouse pointer to a specific location on the screen, but nothing that records a clicked location and then returns the mouse pointer, using a shortcut.

This can be achieved by mapping LButton (Left Mouse Button) to a hotkey with the Wildcard (*) and Tilde (~) modifiers so that the hotkey will activate even if other keys are being held down, and the hotkey will not suppress the Mouse button's normal functions respectively. This hotkey will capture the current position of the mouse using the MouseGetPos command and save the x and y coordinates into variables (in this case, xpos and ypos respectively).
Next, we can create another Hotkey (Control+q in this example) to move the mouse using the MouseMove command back to the position saved in the variables. To map this to a hotkey of your choice, check out the page on Hotkeys in the docs.
Resulting Code:
*~LButton::MouseGetPos, xPos, yPos
^q::MouseMove, xPos, yPos

Related

Listbox won't show keyboard caret when clicked on by mouse or focus programatically set

I'm using a CListBox with Extended selection. When I click on the control, no keyboard caret is shown. Using the up and down arrows also doesn't allow me to show the caret. If I press tab and then shift tab, I can then see the caret. Using GotoDlgCtrl(&listboxCtrl) or listboxCtrl.SetFocus() also don't work.
How can I get the keyboard caret to show up on mouse click or programmatically?
Using the mouse is not supposed to display the keyboard related UI features:
For example, if the last input came from the mouse, the system will hide the keyboard cues. And, if the last input came from the keyboard, the system will show the keyboard cues.
To fake a change you can use:
PostMessage/SendMessage(hListBox, WM_UPDATEUISTATE, MAKELONG(UIS_CLEAR, UISF_HIDEACCEL|UISF_HIDEFOCUS), 0);
...or send it to your top-level window if you want to apply the change to all children.

How to right click screen coordinate with mouse from command line on OSX

Is there a built command line utility to right click a screen coordinate on OSX?
Is it possible to do so with a secondary cursory such that the main cursor is not re-positioned on the screen?
If you type the key combo of command-shift-4 the curser is turned into crosshairs and the cursor position is listed on the cusor itself. Shown below is a screen capture of an area of screen containing the cross-hairs.

Normal Mac option-drag block selection in VS Code?

There are already many questions about VS Code's block selection and multi-cursor selection, and I'm not asking how to use it, but rather, how to make it behave in the standard way on a Mac (without the shift ⇧ key pressed).
The way it currently behaves is this: your current cursor location defines one corner of the block selection, and when you press ⇧⌥ and click somewhere else, you define the opposite corner of the block. You can drag as you're clicking, but dragging really only changes the definition of that opposite corner. Your (text) cursor's position always defines one of the block's corners.
Considering that the VS Code default keybinding is ⇧⌥, the behavior is proper for having the shift ⇧ key pressed. But I'm trying to find a way to get the normal behavior that you'd expect on a Mac when the shift ⇧ key is not pressed.
In normal Mac behavior (without shift), the entire block is defined by:
where you first click, before you start dragging, and
where you release, after dragging.
This behavior is exactly the same as for plain-vanilla text selection, except that you get a block, instead of a line-oriented selection.
I would like to find a way to have VS Code allow me to define the block selection solely based on where I click and drag, and not based on the current text cursor location.
How can I do this?
Note that you don't have to drag the mouse. You can single click (with no modifier keys) in one corner, press and hold Shift and Option, and click in the opposite corner, then release the Shift and Option keys. So, your attempt to start the selection is actually extending it (relative to the previous selection).
What's working for me in 1.53.1 (January 2021 release) is to click and hold the mouse button (with no keys pressed; this starts a normal, non-column selection), then press and hold Shift and Option, then continue dragging the mouse. I find this method cumbersome and prefer selecting opposite corners as above.
I don't see an obvious way to change to Option-only to start a column selection.

plugin to set selection start cursor in Firefox without holding mouse button?

when selecting large swaths of text from webpage I have to keep left mouse button pressed while searching for the selection's end. It would be nice if the browser would "remember" selection's start point and let me search for the ending point, e.g. by dragging the scrollbar downwards, without pressing the mouse button.
Does a plugin or other implementation of this sort already exist?
The answer to this is OS/Windowing system specific. In most/all systems there is a normal way to have the system perform what you are desiring. An add-on for Firefox is not required.
Windows:
If you click (button down and up, not button down and hold) at the start, or the end of the selection you desire then move the mouse to the other end of the desired selection (scrolling the page as needed to get the the other end) you can then hold the shift key down and click again. This will select the entire region from the first point you clicked to the second point you clicked while holding the shift key. You can adjust the selection by continuing to hold the shift key while doing any of: clicking on a different location, performing a click-drag movement, or using the keyboard cursor keys. This adjustment does not change the point at which you first clicked, just the second, end point.
It is also possible to use the control key to select individual items. This is possible in combination with clicks, double-clicks, and triple-clicks. An example would be to move your mouse around in this paragraph holding the ctrl key down while double-clicking on various words. Your selection will include just the words on which you double-clicked. In some instances, when using only a single ctrl-click to select from a discrete list (e.g. a Windows Explorer folder display), a second ctrl-click on the same item will de-select it. You can also combine the use of ctrl-click and shift-click to create more complex selections with the beginning of the shift-click selection starting at the most recent ctrl-click location.
The Mouse and Pointers page in the Windows Dev Center provides some fairly technical descriptions as guidelines for Windows developers.
Linux (using GNOME):
The interactions are similar to What was described for Windows, but a bit different. Section 10.1.2. Selecting Objects of the GNOME Human Interface Guidelines 2.2.3 provides a good description.
Apple/OSX:
The Macintosh Human Interface Guidelines describes how selections can be made on Apple machines.

FocusIn/FocusOut not generated

Can someone please clarify the default focus handling of the X11 server? My understanding is that the focus 'follows the mouse' and sure enough if I move the mouse between separate terminals I can see the cursor changing as each window aquires/loses the focus.
But when I run two xev windows and move the pointer between them, I see plenty of MotionNotify/EnterNotify/LeaveNotify as the pointer moves from one window to another - but FocusIn and FocusOut are nowhere to be seen. Is this an oddity in xev? Is there some special mask or property which needs to be applied in order for these events to be generated?
Many thanks, R.
While I do not fully understand the answer(s), I am grateful to parkydr, minitech and any others who may have stopped by.
Thanks again, R.
Having focus refers to the window which receives keyboard input when you press a key.
The focus handling depends on your window manager. The most common mode is click to focus, which your window manager is set to, where you only get focus when you click on the window. An alternative is that the keyboard focus follows the mouse, which is what you are expecting.
There should be a setting to change this in your window manager settings.
The cursor changing does not indicate focus, just that the terminal has defined a different cursor.
To demonstrate, open a terminal and an xev window.
Click on the xev window and press a key, you will see key events.
Move the mouse to the terminal window, you'll see the motion and leave events
Press a key and you'll still see key events from xev
Click on the terminal window, xev will give a focus out event
Press a key, the characters will be displayed in the terminal window
Move the mouse over the xev window and press a key, the character will still come out in the terminal window

Resources