How can I detect whether the alt/option key is down in GTK on Mac OS X? - macos

I want to detect whether the alt/option key is pressed during a mouse drag in GTK on Mac OS X. I am using pygtk. Normally, holding down alt would add MOD1_MASK to event.state, but alt does affect event.state at all. In key press events alt shows up as gtk.keysyms.kana_switch, but this is not sufficient for my purposes since the user might press alt in a different application and switch to mine by clicking.
Is there an available setting that would cause alt/option to show up as a modifier in event.state? Alternatively, is there a way of detecting whether a key is currently down even if the key down event went to a different application?

I think you should use gtk.accelerator_get_default_mod_mask()
http://library.gnome.org/devel/gtk/unstable/checklist-modifiers.html

Related

How does on-screen (virtual) keyboard works in Win10

I haven't find anything relevant in Google or any Microsoft site about it so I decided to ask a question here.
Everybody knows that in Win-based OS there is a virtual keyboard. I also know that *nix based OS, have it too. So, the question is about:
HOW DOES IT WORK INSIDE?
I mean, let's have an example that I opened on screen keyboard in Windows 10. What's the actual difference between:
input via hardware keyboard: when I'm using it, like I press X button
..and using a virtual keyboard, when I press the same button
Imagine, I have an admin access to terminal/computer, is there any option to track/distinguish that in the second time I pressed button not on hardware keyboard, but on-screen (by mouse clicking) version of it?
And there are also many different software, like AutoIt (yes, it's a language, but it's relevant to this example) that emulating pressing the X button. How does they work in Win-based OS? Do they "in-common" with default on-screen keyboard and using the same driver/WinAPI or there is a difference between them?
And the second case, between:
default on-screen keyboard
compilated AutoIt script
..any other software that emulating press X button
I guess the only way to find out "how exactly button was pressed" is to check current processes list via taskmgr and find out have anything been launched or not. Or I'm totally wrong here, and missing something?
THE SCOPE
I have written a node.js script which emulates button pressing behaviour in windows app.
TL:DR business logic short => open notepad.exe and type `Hello world`
And could someone give me any advice/recommend any powershell/bat script (or any other solution) with demonstration of Get­Async­Key­State check behavior? With which I could easily check my own node.js script (not by functional of it, but by triggering press the X button event)
I found an answer for node.js case here: Detecting Key Presses Across Applications in Powershell
SendInput is the preferred method to generate user input in software. The Windows on-screen keyboard probably uses it for everything except Ctrl+Alt+Delete which I believe has some kind of special handling. The on-screen keyboard is only able to generate Ctrl+Alt+Delete in certain configurations.
Software-generated input is merged with normal hardware input in the RIT (Raw Input Thread) in the kernel.
A low-level keyboard hook can detect software-generated input.

Delphi firemonkey MAC OSX error sound when using various keys in memos

Whenever I use the arrow keys inside a TMemo and some other controls, on the MAC it plays the error sound (like there is nothing in an edit control and you press backspace).
I am certain this is a delphi bug.
Is there any solution beside telling my customer to set the volume to 0 to stop this behavior? It does this when using arrow keys, backspace, del and many other keys. It does this only on MAC OSX, not on Windows target.

Sending Keyboard Shortcuts to OSX instead of separate commands

I was wondering how osx interprets keyboard shortcuts vs multiple keys being pressed at the same time.
For example, I have the control + left setup to move spaces to the left. When I use my keyboard osx interprets it as a shortcut.
Using http://manytricks.com/keycodes/ it does not even register, the OS seems to short-circuit the command on seems to know that it corresponds to a keyboard shortcut.
When using an external usb footswitch that sends the control key signal and the keyboard to send the left key signal the os Does not interpret it as a shortcut but instead interprets this as a control + left key As seen in the photo below
I posted this on apple.stackexchange but was hoping for a more technical answer
https://apple.stackexchange.com/questions/140732/sending-controlleft-command-with-external-footswitch-delcom-only-picking-up-c
The goal is to get the footswitch to send a correct control signal (key codes says it is sending the exact same control signal as when I hit the left control key on my keyboard)
The footswitch works as expected under ubuntu
Thank you
oh boy, from kinesis website
Note: Modifier actions from one USB device cannot modify the input of a second USB device due to limitations designed into the Apple operating system. Example: Shift, Control, Command, or Option keystrokes programmed into the footswitch cannot modify the input of a separate USB keyboard or mouse. However, a key sequence like ‘Cmd-W’ or ‘Cmd-Shift-left arrow’ will work on a Macintosh if the entire sequence of keystrokes has been pre-programmed into the footswitch. (Footswitch can only be programmed on a Windows PC).
I just tried this using my usb keyboard and built in osx keyboard and it seems to be true. I can hit control + left on my usb keyboard and it works fine but control on my usb keyboard + left on the builtin keyboard does not work:(

How to unbind Command-Control-Space key from Mac OS X 10.9?

How can I unbind Command-Control-Space from Mac OS X 10.9?
This shortcut shows Special Characters table and conflicts with my Emacs key binding, and I couldn't disable it from System Preference->Keyboard->Shortcuts.
Thanks.
At least on macOS Sierra to macOS Big Sur ⌃Space is the default binding for Select the previous input source which is on by default (even if only one input source is activated).
You can free it by:
Open System Preferences
Go to Keyboard > Shortcuts > Input Sources
Untick "Select the previous input source"
Afterwards, you should be able to bind it as expected.
You can create custom keyboard shortcuts for most app's menubar choices in System Preferences. If a desired key combination is losing precedence to a default shortcut that you don't use and can't easily disable, simply override it with a new, unobtrusive shortcut.
Open System Prefs / Keyboard / Shortcuts. Select App Shortcuts from the left pane. Toggle the All Applications category's triangle in the main window to point downward (if it's not open already).
If there's an item named Emoji & Symbols* shown there, then click its shortcut combination and enter a new shortcut (such as option-shift-command-t, in this case).
If there's not an item named Emoji & Symbols under All Applications, click the + button at the bottom, type or copy-paste Emoji & Symbols, and then enter a new keyboard shortcut (option-shift-command-t, or anything really). This will free the control-command-space combination for you to use as a specialized shortcut elsewhere.
To remove your custom shortcut, just click to highlight it in the main window of this preference pane, and click the – button at the bottom. The custom shortcut will disappear and the default action will resume.
*Note: On versions older than Mac OS 10.10.3, the menu item is called Special Characters… instead of Emoji & Symbols.
I don't know of any way to disable this, but an alternative option might be to create a shortcut for the app you want to use that in. I created a Command-Control-Space shortcut for Chrome and now Command-Control-Space doesn't bring up the special character palette anymore in Chrome.
failing that you may be better off asking in Apple Stackexchange

Emacs on Mac OS X Lion - what about the Ctrl and Alt touch?

How can I hold Ctrl and arrow key up/down to move fast in my code? Because this is a shortcut in OS X.
How can I use alt (meta) touch? Emacs doesn't recognize option or command key?
For the Control key shortcuts, you're probably best off using the Keyboard section of the System Preferences to disable any Ctrl+Arrow shortcuts. I changed all the Control key system shortcuts to use Control, Option and Command together, which is easy enough to hit (particularly on a full-size keyboard) while being much less likely to conflict with emacs.
As for the Meta key, if you are using terminal emacs, you may just have to put up with slightly poor modifier key support. (I've found a number of shortcuts to simply not work, even after playing with the terminal preferences. The terminal system is just slightly limited, it seems.) The easiest solution is to use the Esc prefix key instead of Meta - so instead of holding Meta and tapping the key, you tap Esc, and then tap the key. So for M-x, say, you would type ESC x. This is sometimes annoying (e.g., M-f and M-b aren't so convenient any more...), but it certainly does work.
If you can, I recommend switching to the GUI version of OS X emacs, which has none of these problems.
To make the option key work:
In the terminal settings 'CMD-,' click 'Profiles -> Keyboard -> Use Option as a modifier key'.

Resources