# HG changeset patch # User Claus Gittinger # Date 970231484 -7200 # Node ID 1c92a842f099e7d2ffa9aca1b3963c754c606652 # Parent 3d0e6754dcd9b4bbf6746e2cc88cbc3f13665164 keyboard mapping fixes for hpux diff -r 3d0e6754dcd9 -r 1c92a842f099 XWorkstation.st --- a/XWorkstation.st Fri Sep 29 14:37:59 2000 +0200 +++ b/XWorkstation.st Fri Sep 29 14:44:44 2000 +0200 @@ -10,8 +10,6 @@ hereby transferred. " -'From Smalltalk/X, Version:4.1.1 on 29-sep-2000 at 12:58:38' ! - "{ Package: 'stx:libview' }" DeviceWorkstation subclass:#XWorkstation @@ -19,11 +17,11 @@ hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension hasImageExtension hasInputExtension ignoreBackingStore blackpixel whitepixel atoms protocolsAtom deleteWindowAtom saveYourselfAtom - quitAppAtom primaryAtom cutBuffer0Atom stringAtom - lengthAtom wmStateAtom listOfXFonts buttonsPressed eventRootX - eventRootY displayName eventTrace dispatchingExpose rgbVisual - virtualRootId rootId eventBuffer altModifierMask metaModifierMask - multiClickTime deviceIOTimeoutErrorSignal activateOnClick + quitAppAtom primaryAtom cutBuffer0Atom stringAtom lengthAtom + wmStateAtom listOfXFonts buttonsPressed eventRootX eventRootY + displayName eventTrace dispatchingExpose rgbVisual virtualRootId + rootId eventBuffer altModifierMask metaModifierMask + multiClickTime deviceIOTimeoutErrorSignal activateOnClick rawKeySymTranslation' classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength' poolDictionaries:'' @@ -4381,22 +4379,22 @@ "/ special for HPs mouse-wheel implementation (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[ - self mouseWheelMotion:0 x:x y:y amount:(button == #wheelFwd ifTrue:[10] ifFalse:[-10]) deltaTime:10 view:view. + self mouseWheelMotion:0 x:x y:y amount:(logicalButton == #wheelFwd ifTrue:[10] ifFalse:[-10]) deltaTime:10 view:view. ^ self ]. buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1). multiClickTimeDelta notNil ifTrue:[ - nextMultiClickTime := time + multiClickTimeDelta. - multiClickTime notNil ifTrue:[ - time < multiClickTime ifTrue:[ - multiClickTime := nextMultiClickTime. - self buttonMultiPress:logicalButton x:x y:y view:view. - ^ self. - ] - ]. - multiClickTime := nextMultiClickTime. + nextMultiClickTime := time + multiClickTimeDelta. + multiClickTime notNil ifTrue:[ + time < multiClickTime ifTrue:[ + multiClickTime := nextMultiClickTime. + self buttonMultiPress:logicalButton x:x y:y view:view. + ^ self. + ] + ]. + multiClickTime := nextMultiClickTime. ]. self buttonPress:logicalButton x:x y:y view:view @@ -4418,8 +4416,12 @@ "/ physical to logical button translation logicalButton := buttonTranslation at:button ifAbsent:button. + "/ special for HPs mouse-wheel implementation + (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[ + ^ self + ]. + buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1). - self buttonRelease:logicalButton x:x y:y view:view ! @@ -8965,43 +8967,45 @@ super initializeModifierMappings. + rawKeySymTranslation := RawKeySymTranslation. + map := self modifierMapping. map isNil ifTrue:[ - "/ - "/ mhmh - a crippled Xlib which does not provide modifier mappings - "/ setup some reasonable default. If that is not sufficient, - "/ you have to change things from your display.rc file. - "/ - altModifierMask := self modifier1Mask. - metaModifierMask := self modifier2Mask. + "/ + "/ mhmh - a crippled Xlib which does not provide modifier mappings + "/ setup some reasonable default. If that is not sufficient, + "/ you have to change things from your display.rc file. + "/ + altModifierMask := self modifier1Mask. + metaModifierMask := self modifier2Mask. ] ifFalse:[ - altModifierMask := 0. - metaModifierMask := 0. - - mod := map at:1. - mod notNil ifTrue:[ - shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ]. - ]. - mod := map at:3. - mod notNil ifTrue:[ - ctrlModifiers := mod collect:[ :key | self stringFromKeycode:key ]. - ]. - mod := map at:4. - mod notNil ifTrue:[ - mod := mod collect:[ :key | self stringFromKeycode:key ]. - (mod includes:'Num_Lock') ifFalse:[ - metaModifiers := mod. - metaModifierMask := 1 bitShift:(4-1). - ]. - ]. - mod := map at:5. - mod notNil ifTrue:[ - mod := mod collect:[ :key | self stringFromKeycode:key ]. - (mod includes:'Num_Lock') ifFalse:[ - altModifiers := mod. - altModifierMask := 1 bitShift:(5-1). - ]. - ] + altModifierMask := 0. + metaModifierMask := 0. + + mod := map at:1. + mod notNil ifTrue:[ + shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ]. + ]. + mod := map at:3. + mod notNil ifTrue:[ + ctrlModifiers := mod collect:[ :key | self stringFromKeycode:key ]. + ]. + mod := map at:4. + mod notNil ifTrue:[ + mod := mod collect:[ :key | self stringFromKeycode:key ]. + (mod includes:'Num_Lock') ifFalse:[ + metaModifiers := mod. + metaModifierMask := 1 bitShift:(4-1). + ]. + ]. + mod := map at:5. + mod notNil ifTrue:[ + mod := mod collect:[ :key | self stringFromKeycode:key ]. + (mod includes:'Num_Lock') ifFalse:[ + altModifiers := mod. + altModifierMask := 1 bitShift:(5-1). + ]. + ] ]. " @@ -9009,6 +9013,7 @@ " "Modified: 1.12.1995 / 23:44:40 / stefan" + ! initializeScreenProperties @@ -9301,18 +9306,18 @@ ret := Array new:8. nextKey := 1. 1 to:8 do:[ :i | - (modifierKeyMap at:nextKey) ~= 0 ifTrue:[ - |mod| - - mod := OrderedCollection new:maxKeyPerMod. - modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | - key ~= 0 ifTrue:[ - mod add:key - ]. - ]. - ret at:i put:mod. - ]. - nextKey := nextKey+maxKeyPerMod. + (modifierKeyMap at:nextKey) ~= 0 ifTrue:[ + |mod| + + mod := OrderedCollection new:maxKeyPerMod. + modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | + key ~= 0 ifTrue:[ + mod add:key + ]. + ]. + ret at:i put:mod. + ]. + nextKey := nextKey+maxKeyPerMod. ]. ^ ret @@ -9324,14 +9329,26 @@ " |mapping| - mapping := self modifierMapping. + mapping := Display modifierMapping. ^ mapping collect:[:eachRow | - eachRow notNil ifTrue:[ - eachRow collect:[ :key | self stringFromKeycode:key ]. - ] ifFalse:[ - nil - ] - ]. + eachRow notNil ifTrue:[ + eachRow collect:[ :key | Display stringFromKeycode:key ]. + ] ifFalse:[ + nil + ] + ]. + " +! + +rawKeySymTranslation + "Get the raw keyboard mapping (maps some special X-keySyms to STX-internal names + and can also be used to untranslate a stupid x-mapping (as on hpux)." + + ^ rawKeySymTranslation + + + " + Display rawKeySymTranslation " ! @@ -9411,9 +9428,12 @@ |key| - (key := untranslatedKey) isString ifTrue:[ - key := RawKeySymTranslation at:key ifAbsent:key. - key := key asSymbol. + key := untranslatedKey. + (rawKeySymTranslation includesKey:key) ifTrue:[ + key := rawKeySymTranslation at:key. + ]. + key isCharacter ifFalse:[ + key := key asSymbol ]. ^ super translateKey:key forView:aView ! ! @@ -11690,6 +11710,6 @@ !XWorkstation class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.376 2000-09-29 12:37:59 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.377 2000-09-29 12:44:44 cg Exp $' ! ! XWorkstation initialize!