XWorkstation.st
changeset 3322 1c92a842f099
parent 3321 3d0e6754dcd9
child 3326 5d58d51bf927
equal deleted inserted replaced
3321:3d0e6754dcd9 3322:1c92a842f099
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 'From Smalltalk/X, Version:4.1.1 on 29-sep-2000 at 12:58:38'                    !
       
    14 
       
    15 "{ Package: 'stx:libview' }"
    13 "{ Package: 'stx:libview' }"
    16 
    14 
    17 DeviceWorkstation subclass:#XWorkstation
    15 DeviceWorkstation subclass:#XWorkstation
    18 	instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension
    16 	instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension
    19 		hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension
    17 		hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension
    20 		hasImageExtension hasInputExtension ignoreBackingStore blackpixel
    18 		hasImageExtension hasInputExtension ignoreBackingStore blackpixel
    21 		whitepixel atoms protocolsAtom deleteWindowAtom saveYourselfAtom
    19 		whitepixel atoms protocolsAtom deleteWindowAtom saveYourselfAtom
    22 		quitAppAtom primaryAtom cutBuffer0Atom stringAtom
    20 		quitAppAtom primaryAtom cutBuffer0Atom stringAtom lengthAtom
    23 		lengthAtom wmStateAtom listOfXFonts buttonsPressed eventRootX
    21 		wmStateAtom listOfXFonts buttonsPressed eventRootX eventRootY
    24 		eventRootY displayName eventTrace dispatchingExpose rgbVisual
    22 		displayName eventTrace dispatchingExpose rgbVisual virtualRootId
    25 		virtualRootId rootId eventBuffer altModifierMask metaModifierMask
    23 		rootId eventBuffer altModifierMask metaModifierMask
    26 		multiClickTime deviceIOTimeoutErrorSignal activateOnClick 
    24 		multiClickTime deviceIOTimeoutErrorSignal activateOnClick
    27 		rawKeySymTranslation'
    25 		rawKeySymTranslation'
    28 	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength'
    26 	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength'
    29 	poolDictionaries:''
    27 	poolDictionaries:''
    30 	category:'Interface-Graphics'
    28 	category:'Interface-Graphics'
    31 !
    29 !
  4379     "/ physical to logical button translation
  4377     "/ physical to logical button translation
  4380     logicalButton := buttonTranslation at:button ifAbsent:button.
  4378     logicalButton := buttonTranslation at:button ifAbsent:button.
  4381 
  4379 
  4382     "/ special for HPs mouse-wheel implementation
  4380     "/ special for HPs mouse-wheel implementation
  4383     (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
  4381     (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
  4384       self mouseWheelMotion:0 x:x y:y amount:(button == #wheelFwd ifTrue:[10] ifFalse:[-10]) deltaTime:10 view:view.
  4382       self mouseWheelMotion:0 x:x y:y amount:(logicalButton == #wheelFwd ifTrue:[10] ifFalse:[-10]) deltaTime:10 view:view.
  4385       ^ self
  4383       ^ self
  4386     ].
  4384     ].
  4387 
  4385 
  4388     buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
  4386     buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
  4389 
  4387 
  4390     multiClickTimeDelta notNil ifTrue:[
  4388     multiClickTimeDelta notNil ifTrue:[
  4391 	nextMultiClickTime := time + multiClickTimeDelta.
  4389         nextMultiClickTime := time + multiClickTimeDelta.
  4392 	multiClickTime notNil ifTrue:[
  4390         multiClickTime notNil ifTrue:[
  4393 	    time < multiClickTime ifTrue:[
  4391             time < multiClickTime ifTrue:[
  4394 		multiClickTime := nextMultiClickTime.
  4392                 multiClickTime := nextMultiClickTime.
  4395 		self buttonMultiPress:logicalButton x:x y:y view:view.
  4393                 self buttonMultiPress:logicalButton x:x y:y view:view.
  4396 		^ self.
  4394                 ^ self.
  4397 	    ]
  4395             ]
  4398 	].
  4396         ].
  4399 	multiClickTime := nextMultiClickTime.
  4397         multiClickTime := nextMultiClickTime.
  4400     ].
  4398     ].
  4401 
  4399 
  4402     self buttonPress:logicalButton x:x y:y view:view
  4400     self buttonPress:logicalButton x:x y:y view:view
  4403 !
  4401 !
  4404 
  4402 
  4416     eventRootY := rY.
  4414     eventRootY := rY.
  4417 
  4415 
  4418     "/ physical to logical button translation
  4416     "/ physical to logical button translation
  4419     logicalButton := buttonTranslation at:button ifAbsent:button.
  4417     logicalButton := buttonTranslation at:button ifAbsent:button.
  4420 
  4418 
       
  4419     "/ special for HPs mouse-wheel implementation
       
  4420     (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
       
  4421       ^ self
       
  4422     ].
       
  4423 
  4421     buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1).
  4424     buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1).
  4422 
       
  4423     self buttonRelease:logicalButton x:x y:y view:view
  4425     self buttonRelease:logicalButton x:x y:y view:view
  4424 !
  4426 !
  4425 
  4427 
  4426 circulateNotify:aView place:aSymbol
  4428 circulateNotify:aView place:aSymbol
  4427     "sent, when the stacking order changes.
  4429     "sent, when the stacking order changes.
  8963 
  8965 
  8964     |map mod|
  8966     |map mod|
  8965 
  8967 
  8966     super initializeModifierMappings.                                     
  8968     super initializeModifierMappings.                                     
  8967 
  8969 
       
  8970     rawKeySymTranslation := RawKeySymTranslation.
       
  8971 
  8968     map := self modifierMapping.
  8972     map := self modifierMapping.
  8969     map isNil ifTrue:[
  8973     map isNil ifTrue:[
  8970 	"/
  8974         "/
  8971 	"/ mhmh - a crippled Xlib which does not provide modifier mappings
  8975         "/ mhmh - a crippled Xlib which does not provide modifier mappings
  8972 	"/ setup some reasonable default. If that is not sufficient,
  8976         "/ setup some reasonable default. If that is not sufficient,
  8973 	"/ you have to change things from your display.rc file.
  8977         "/ you have to change things from your display.rc file.
  8974 	"/
  8978         "/
  8975 	altModifierMask := self modifier1Mask.
  8979         altModifierMask := self modifier1Mask.
  8976 	metaModifierMask := self modifier2Mask.
  8980         metaModifierMask := self modifier2Mask.
  8977     ] ifFalse:[
  8981     ] ifFalse:[
  8978 	altModifierMask := 0.
  8982         altModifierMask := 0.
  8979 	metaModifierMask := 0.
  8983         metaModifierMask := 0.
  8980 
  8984 
  8981 	mod := map at:1.
  8985         mod := map at:1.
  8982 	mod notNil ifTrue:[
  8986         mod notNil ifTrue:[
  8983 	    shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ].
  8987             shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ].
  8984 	].
  8988         ].
  8985 	mod := map at:3.
  8989         mod := map at:3.
  8986 	mod notNil ifTrue:[
  8990         mod notNil ifTrue:[
  8987 	    ctrlModifiers  := mod collect:[ :key | self stringFromKeycode:key ].
  8991             ctrlModifiers  := mod collect:[ :key | self stringFromKeycode:key ].
  8988 	].
  8992         ].
  8989 	mod := map at:4.
  8993         mod := map at:4.
  8990 	mod notNil ifTrue:[
  8994         mod notNil ifTrue:[
  8991 	    mod := mod collect:[ :key | self stringFromKeycode:key ].
  8995             mod := mod collect:[ :key | self stringFromKeycode:key ].
  8992 	    (mod includes:'Num_Lock') ifFalse:[
  8996             (mod includes:'Num_Lock') ifFalse:[
  8993 		metaModifiers := mod.
  8997                 metaModifiers := mod.
  8994 		metaModifierMask := 1 bitShift:(4-1).
  8998                 metaModifierMask := 1 bitShift:(4-1).
  8995 	    ].
  8999             ].
  8996 	].
  9000         ].
  8997 	mod := map at:5.
  9001         mod := map at:5.
  8998 	mod notNil ifTrue:[
  9002         mod notNil ifTrue:[
  8999 	    mod := mod collect:[ :key | self stringFromKeycode:key ].    
  9003             mod := mod collect:[ :key | self stringFromKeycode:key ].    
  9000 	    (mod includes:'Num_Lock') ifFalse:[
  9004             (mod includes:'Num_Lock') ifFalse:[
  9001 		altModifiers   := mod.    
  9005                 altModifiers   := mod.    
  9002 		altModifierMask := 1 bitShift:(5-1).
  9006                 altModifierMask := 1 bitShift:(5-1).
  9003 	    ].
  9007             ].
  9004 	]
  9008         ]
  9005     ].                                                          
  9009     ].                                                          
  9006 
  9010 
  9007     "
  9011     "
  9008       Display initializeModifierMappings
  9012       Display initializeModifierMappings
  9009     "
  9013     "
  9010 
  9014 
  9011     "Modified: 1.12.1995 / 23:44:40 / stefan"
  9015     "Modified: 1.12.1995 / 23:44:40 / stefan"
       
  9016 
  9012 !
  9017 !
  9013 
  9018 
  9014 initializeScreenProperties
  9019 initializeScreenProperties
  9015     |masks|
  9020     |masks|
  9016 
  9021 
  9299     modifierKeyMap isNil ifTrue:[^ nil].
  9304     modifierKeyMap isNil ifTrue:[^ nil].
  9300 
  9305 
  9301     ret := Array new:8.
  9306     ret := Array new:8.
  9302     nextKey := 1.
  9307     nextKey := 1.
  9303     1 to:8 do:[ :i |
  9308     1 to:8 do:[ :i |
  9304 	(modifierKeyMap at:nextKey) ~= 0 ifTrue:[
  9309         (modifierKeyMap at:nextKey) ~= 0 ifTrue:[
  9305 	    |mod|
  9310             |mod|
  9306 
  9311 
  9307 	    mod := OrderedCollection new:maxKeyPerMod.
  9312             mod := OrderedCollection new:maxKeyPerMod.
  9308 	    modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
  9313             modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
  9309 		key ~= 0 ifTrue:[
  9314                 key ~= 0 ifTrue:[
  9310 		    mod add:key
  9315                     mod add:key
  9311 		].
  9316                 ].
  9312 	    ].
  9317             ].
  9313 	    ret at:i put:mod.
  9318             ret at:i put:mod.
  9314 	].
  9319         ].
  9315 	nextKey := nextKey+maxKeyPerMod.
  9320         nextKey := nextKey+maxKeyPerMod.
  9316     ].
  9321     ].
  9317 
  9322 
  9318     ^ ret
  9323     ^ ret
  9319 
  9324 
  9320     "
  9325     "
  9322     "
  9327     "
  9323 
  9328 
  9324     "
  9329     "
  9325      |mapping|
  9330      |mapping|
  9326 
  9331 
  9327      mapping := self modifierMapping.
  9332      mapping := Display modifierMapping.
  9328      ^ mapping collect:[:eachRow | 
  9333      ^ mapping collect:[:eachRow | 
  9329 			     eachRow notNil ifTrue:[
  9334                              eachRow notNil ifTrue:[
  9330 				 eachRow collect:[ :key | self stringFromKeycode:key ].
  9335                                  eachRow collect:[ :key | Display stringFromKeycode:key ].
  9331 			     ] ifFalse:[
  9336                              ] ifFalse:[
  9332 				 nil
  9337                                  nil
  9333 			     ]
  9338                              ]
  9334 		       ].
  9339                        ].
       
  9340     "
       
  9341 !
       
  9342 
       
  9343 rawKeySymTranslation
       
  9344     "Get the raw keyboard mapping (maps some special X-keySyms to STX-internal names
       
  9345      and can also be used to untranslate a stupid x-mapping (as on hpux)."
       
  9346 
       
  9347     ^ rawKeySymTranslation
       
  9348 
       
  9349 
       
  9350     "
       
  9351      Display rawKeySymTranslation
  9335     "
  9352     "
  9336 !
  9353 !
  9337 
  9354 
  9338 rawModifierMapping
  9355 rawModifierMapping
  9339     "Get the raw Modifier Mapping."
  9356     "Get the raw Modifier Mapping."
  9409      Here, we preTranslate the key into a common ST/X symbolic name, 
  9426      Here, we preTranslate the key into a common ST/X symbolic name, 
  9410      which gets further processed in the superclasses translation method."
  9427      which gets further processed in the superclasses translation method."
  9411 
  9428 
  9412     |key|
  9429     |key|
  9413 
  9430 
  9414     (key := untranslatedKey) isString ifTrue:[
  9431     key := untranslatedKey.
  9415 	key := RawKeySymTranslation at:key ifAbsent:key.
  9432     (rawKeySymTranslation includesKey:key) ifTrue:[
  9416 	key := key asSymbol.
  9433         key := rawKeySymTranslation at:key.
       
  9434     ].
       
  9435     key isCharacter ifFalse:[
       
  9436         key := key asSymbol
  9417     ].
  9437     ].
  9418     ^ super translateKey:key forView:aView
  9438     ^ super translateKey:key forView:aView
  9419 ! !
  9439 ! !
  9420 
  9440 
  9421 !XWorkstation methodsFor:'misc'!
  9441 !XWorkstation methodsFor:'misc'!
 11688 ! !
 11708 ! !
 11689 
 11709 
 11690 !XWorkstation class methodsFor:'documentation'!
 11710 !XWorkstation class methodsFor:'documentation'!
 11691 
 11711 
 11692 version
 11712 version
 11693     ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.376 2000-09-29 12:37:59 cg Exp $'
 11713     ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.377 2000-09-29 12:44:44 cg Exp $'
 11694 ! !
 11714 ! !
 11695 XWorkstation initialize!
 11715 XWorkstation initialize!