Faculty of Information Technology
Software Engineering Group

Ticket #134: changes_2017-05-05__09_05_49.chg

File changes_2017-05-05__09_05_49.chg, 2.4 KB (added by Jan Vrany, 3 years ago)
Line 
1'---- encoding: utf8 ----'!
2
3NameSpace name:#Benchmarks
4
5!
6!DeviceWorkstation methodsFor:'event sending'!
7
8sendKeyOrButtonEvent:typeSymbol x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask toViewId:targetId
9    "send a keyPress/Release or buttonPress/Release event to some (possibly alien) view.
10     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
11     For buttonEvents, the keySymCodeOrButtonNr must be the buttons number (1, 2 ...);
12     for key events, it can be either a symbol (as listen in X's keySyms)
13     or a numeric keysym code. If state is nil, the modifier bits (shift & control)
14     are computed from the keyboardMap - if non-nil, these are passed as modifierbits.
15     The non-nil case is the lowlevel entry, where state must include any shift/ctrl information
16     (not very user friendly)"
17
18    | view event |
19
20    view := self viewFromId: targetId.
21
22    typeSymbol == #keyPress ifTrue:[ 
23        event := WindowEvent
24                    keyPress:(self translateKey:typeSymbol forView:view)   
25                    rawKey:typeSymbol
26                    hasShift:(stateMask isBitSet: self shiftModifierMask)
27                        ctrl:(stateMask isBitSet: self ctrlModifierMask)
28                         alt:(stateMask isBitSet: self altModifierMask)
29                        meta:(stateMask isBitSet: self metaModifierMask)
30                    button1:false button2:false button3:false
31                    x:1 y:1
32                    view:view.
33    ] ifFalse:[ typeSymbol == #keyRelease ifTrue:[ 
34        event := WindowEvent
35                    keyRelease:(self translateKey:typeSymbol forView:view)   
36                    rawKey:typeSymbol
37                    hasShift:(stateMask isBitSet: self shiftModifierMask)
38                        ctrl:(stateMask isBitSet: self ctrlModifierMask)
39                         alt:(stateMask isBitSet: self altModifierMask)
40                        meta:(stateMask isBitSet: self metaModifierMask)
41                    button1:false button2:false button3:false
42                    x:1 y:1
43                    view:view.     
44    ] ifFalse:[ 
45        self notYetImplemented.
46    ]].
47
48    view sensor pushEvent: event.
49
50    "Modified: / 04-05-2017 / 23:26:47 / jv"
51! !
52
53
54WinWorkstation removeSelector:#sendKeyOrButtonEvent:x:y:keyOrButton:state:toViewId:
55
56!