FocusIn/FocusOut not generated - x11

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

Related

Display iTerm on screen with cursor [or Active Screen]

I always have iTerm running in the background, and use a hotkey to show/hide it when needed, which works great when using only one screen.
Now, with two screens, I notice that with the option to have it appear with the "Screen with Cursor", the first time I press the hotkey, it appears on the screen with the cursor (first screen), but when I hide it, move the cursor to another screen (second screen) and press the hotkey again, it appears on the first screen and not the second one.
Is there another setting that I might be missing to have work properly?

How to replace Discard changes with Do you want to save changes

If Esc key is pressed in
MODIFY FILE test
window, Visual FoxPro shows
Discard changes
Yes No
prompt. How can I replace this with
Do you want to save changes to test.txt
Yes No Cancel
prompt ?
A Yes/No/Cancel prompt appears if I click on the close button in the upper right corner of the close window.
Is it possible to force it to appear when I press ESC also ?
Can ON KEY LABEL esc or some custom edit windows command be used or is there some other solution ?
Yes, you could solve it with ON KEY LABEL esc someFunctionCall(). The function has then to display the dialog you desire, and you also have to write the logic whether you pressed Yes, No or Cancel. Also keep in mind, that you have to issue ON KEY LABEL esc again, so the dialog won't show up everywhere.
Another solution would be hitting CTRL+S before you press Escape. With another dialog you have to move the mouse or press another button anyways, so there is no time to safe here.

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.

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.

Keyboard navigation of Mac OS X Finder window's search options toolbar

When I'm in a Finder window and enter terms in the spotlight search box (top right of window) and then press the TAB key the search location bar appears just below and the focus moves to the first location (usually "This Mac") shown (as it should). But then the focus seems locked in place and no keyboard key or combination I've found will get it to move (most of the time, that is; at times it's possible to select one of the shown locations with the keyboard and sometimes I've found it possible to tab to the Save button or Add Option [+] button and on to the options themselves but most times it just gets stuck [like now!] and I need to use the mouse). I've been annoyed by this for years now and am running out of new key combinations to try! Is there a way to continue with specifying the search info using the keyboard?

Resources