I seem to recall someone mentioning that it is not possible to see the actual press and release of modifiers, and as such one has to infer the presses from the changes to modifer flags. However I knocked up a simple app while working on something else, which is currently just looking at key press/release, button press/release, and modifer changes. It sees a keycode with each modifier change. Filtered output below: Flag Chg 0x00020102;56; Shft LShft Flag Chg 0x00000100;56; Flag Chg 0x00020104;60; Shft RShft Flag Chg 0x00000100;60; Flag Chg 0x00100108;55; Cmd LCmd Flag Chg 0x00000100;55; Flag Chg 0x00100110;54; Cmd RCmd Flag Chg 0x00000100;54; That is on my macbook (running tiger) for press and release in sequence of: left shift (key code 56) right shift (key code 60) left command (key code 55) right command (key code 54) DF
On Dec 5, 2007, at 3:39 PM, Derek Fawcus wrote:
I seem to recall someone mentioning that it is not possible to see the actual press and release of modifiers, and as such one has to infer the presses from the changes to modifer flags.
However I knocked up a simple app while working on something else, which is currently just looking at key press/release, button press/ release, and modifer changes.
It sees a keycode with each modifier change. Filtered output below:
Flag Chg 0x00020102;56; Shft LShft Flag Chg 0x00000100;56; Flag Chg 0x00020104;60; Shft RShft Flag Chg 0x00000100;60; Flag Chg 0x00100108;55; Cmd LCmd Flag Chg 0x00000100;55; Flag Chg 0x00100110;54; Cmd RCmd Flag Chg 0x00000100;54;
So, you're receiving some sort of keypress / keyrelease event with those keycodes (56, 60, 55, 54)? Which API is this ? -- Ben Byer CoreOS / BSD Technology Group, XDarwin maintainer
On Wed, Dec 05, 2007 at 06:27:21PM -0800, Ben Byer wrote:
On Dec 5, 2007, at 3:39 PM, Derek Fawcus wrote:
Flag Chg 0x00020102;56; Shft LShft Flag Chg 0x00000100;56; Flag Chg 0x00020104;60; Shft RShft Flag Chg 0x00000100;60; Flag Chg 0x00100108;55; Cmd LCmd Flag Chg 0x00000100;55; Flag Chg 0x00100110;54; Cmd RCmd Flag Chg 0x00000100;54;
So, you're receiving some sort of keypress / keyrelease event with those keycodes (56, 60, 55, 54)? Which API is this ?
@interface TermWin : NSWindow { } - (void)flagsChanged:(NSEvent *)theEvent; @end implemented as: - (void)flagsChanged:(NSEvent *)theEvent { unsigned modifier; unsigned keyCode; modifier = [theEvent modifierFlags]; keyCode = [theEvent keyCode]; printf("Flag Chg 0x%08x;%u;%s\n", modifier, keyCode, modifiers_to_string(modifier)); } But I also see them being passed through '-(void)sendEvent:(NSEvent *)' on the NSWindow and NSApp (or at least my sub classes there of). DF
participants (2)
-
Ben Byer
-
Derek Fawcus