duplicateControlAndAltKeys not working on WinXP

Lex Spoon lex at cc.gatech.edu
Sat Nov 1 19:30:18 UTC 2003


"Andreas Raab" <andreas.raab at gmx.de> wrote:
> > It is impossible, short of changing the VM, to have Ctrl-End 
> > and Ctrl-D do different things. 
> 
> That, of course, is wrong. The reason why these are processed in the same
> way is that all current clients use *character* events (which implies an
> ascii representation) instead of *key* events (which implies a key pressed
> on a particular keyboard). And since the ascii range is filled with lots and
> lots of useful ascii characters there is simply not enough room to fit all
> of the different key events in there. Try checking the key-down events
> instead - I'm pretty sure those will be different.

Well, I made a proposal buried back in the depths of the thread.  Encode
control+a as "a plus control" instead of "control-a plus control".  I
see no lossage from this encoding and it would solve the immediate
problem.



> Nope. All it requires is to use untranslated keyDown events instead of
> (translated) characters ;-)
> 

Oh, that's very nice, you can handle keyDown: and keyUp: and get the raw
events.  Is it intended that these keystrokes are the same across
platforms when possible?  For example, is it intended that End and Copy
are the same on all platforms that have them?

As it stands, it looks like this facility is not implemented very well
at least on Unix.  For example, I tried this code:

	buf := OrderedCollection new.
	[ buf size < 10 ] whileTrue: [
	  evt := Sensor nextEventFromQueue.
	evt ifNotNil: [ buf add: evt ] ].
	buf

Then I pressed ctrl-end and then ctrl-d and then waved the mouse around.
 The events I see are the following:

	#(2 447859143 112 2 8 0 0 0)
	#(2 447864587 4 1 2 0 0 0) 
	#(2 447864587 4 0 2 0 0 0) 
	#(2 447864687 4 2 2 0 0 0) 
	#(2 447865692 4 1 2 0 0 0) 
	#(2 447865692 4 0 2 0 0 0) 
	#(2 447865824 4 2 2 0 0 0) 
	#(1 447867771 509 289 0 0 0 0)
	#(1 447867787 509 301 0 0 0 0) 
	#(1 447867795 509 311 0 0 0 0))

The type 2's are keystroke events of various flavors.  The second field
is a timestamp.  Looking at generateKeyboardEvent:, I see that the other
fields are:

	3  value
	4  pressType  (either keyDown (1), keyUp (2), or keystroke (0))
	5  modifiers

So, I see alt-d being released, and then the other 6 key events all have
value "4".  The control key itself doesn't generate any events.  It
would be interesting whether this has been implemented differently on
other platforms.

I've mentioned before, though maybe not on the list, that the XWindows
list of key symbols might be worth re-using in Squeak for the purpose of
encoding these values.


-Lex



More information about the Squeak-dev mailing list