WindowSensor.st
author Claus Gittinger <cg@exept.de>
Mon, 26 Jul 1999 09:32:32 +0200
changeset 2810 f2a85b827478
parent 2787 99aa802b2de5
child 2820 a3db9137637b
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
     1
"
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
     3
	      All Rights Reserved
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
     4
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
     5
 This software is furnished under a license and may be used
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
     6
 only in accordance with the terms of that license and with the
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
     9
 other person.  No title to or ownership of the software is
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
    10
 hereby transferred.
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
    11
"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
48194c26a46c Initial revision
claus
parents:
diff changeset
    13
Object subclass:#WindowSensor
326
f04810e0425a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
    14
	instanceVariableNames:'eventSemaphore damage mouseAndKeyboard compressMotionEvents
260
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    15
		ignoreUserInput exposeEventSemaphore catchExpose gotExpose
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    16
		gotOtherEvent translateKeyboardEvents shiftDown ctrlDown metaDown
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    17
		altDown leftButtonDown middleButtonDown rightButtonDown
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
    18
		eventListener keyboardListener ignoreExposeEvents
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
    19
		damageEventAccessLock userEventAccessLock'
2123
b2dae4453526 added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
    20
	classVariableNames:'ControlCEnabled ControlYEnabled EventListener ComposeTable
b2dae4453526 added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
    21
		GotCompose Compose1'
326
f04810e0425a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
    22
	poolDictionaries:''
f04810e0425a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
    23
	category:'Interface-Support'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    24
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    25
1082
44d671491f5e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
    26
!WindowSensor class methodsFor:'documentation'!
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    27
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    28
copyright
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    29
"
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    30
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
    31
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    32
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    33
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    34
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    36
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    37
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    38
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    39
"
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    40
!
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    41
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    42
documentation
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    43
"
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
    44
    Instances of this class keep track of events and damage areas for a group of 
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
    45
    views. All incoming expose rectangles and events (from Workstation) are 
144
claus
parents: 140
diff changeset
    46
    collected here, until someone (usually the windowGroup process)
claus
parents: 140
diff changeset
    47
    gets a chance to handle them. 
claus
parents: 140
diff changeset
    48
    In contrast to ST-80 (which has one windowSensor per window), ST/X usually
claus
parents: 140
diff changeset
    49
    only assigns one sensor per windowGroup.
157
claus
parents: 154
diff changeset
    50
    (however, you could manually arrange for per view private sensors
claus
parents: 154
diff changeset
    51
     - at least, theoretically)
144
claus
parents: 140
diff changeset
    52
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
    53
    When adding an expose rectangle, WindowSensor tries to merge the rectangle 
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
    54
    with the list of existing damages to minimize redrawing.
47
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
    55
158
claus
parents: 157
diff changeset
    56
    Processing of compose key sequences is done here; if a Compose
claus
parents: 157
diff changeset
    57
    key event arrives, the following 2 characters are used to search an
claus
parents: 157
diff changeset
    58
    entry in the composeTable, and are replaced by the character found there.
claus
parents: 157
diff changeset
    59
    For example, pressing Compose-a-` gives the french a-accent-grave character;
claus
parents: 157
diff changeset
    60
    pressing Compose-a-e gives the ae ligature.
claus
parents: 157
diff changeset
    61
144
claus
parents: 140
diff changeset
    62
    Beside the above, windowSensors provide facilities (hooks) to allow
157
claus
parents: 154
diff changeset
    63
    a so-called 'eventListener' to get the event before it is entered into
144
claus
parents: 140
diff changeset
    64
    the queue. There are 3 possible listening hooks available:
claus
parents: 140
diff changeset
    65
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
    66
	a global EventListener - gets keybd/mouse events for all views
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
    67
	a per-sensor eventListener - gets only keybd/mouse events for this sensors wGroup
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
    68
	a per-sensor keyboardListener - only gets keyboard events for this sensors wGroup
144
claus
parents: 140
diff changeset
    69
172
claus
parents: 158
diff changeset
    70
    (actually, there are two more mechanisms, event delegation which allows
claus
parents: 158
diff changeset
    71
     delegation of key- and buttonEvents of a specific view,
claus
parents: 158
diff changeset
    72
     and per-windowGroup eventHooks)
144
claus
parents: 140
diff changeset
    73
claus
parents: 140
diff changeset
    74
    The global eventListener is installed via a class method (eventListener:) to
claus
parents: 140
diff changeset
    75
    the WindowSensor class; local listeners are installed via instance methods.
claus
parents: 140
diff changeset
    76
    Each listener should return true, if it handled the event and that event should
claus
parents: 140
diff changeset
    77
    therefore NOT be enqueued. Likewise, if it returns false, the event is
157
claus
parents: 154
diff changeset
    78
    processed as usual (i.e. enqueued and forwarded to the views controller).
claus
parents: 154
diff changeset
    79
144
claus
parents: 140
diff changeset
    80
    The global listener is called before the local listener, which is called
claus
parents: 140
diff changeset
    81
    before the keyboard listener. If any returns true, later listeners wont get
claus
parents: 140
diff changeset
    82
    the event.
claus
parents: 140
diff changeset
    83
    EventListeners were added to allow the implementation of event recorders
157
claus
parents: 154
diff changeset
    84
    or other spy functionality. They also allow hooking up views which otherwise
claus
parents: 154
diff changeset
    85
    insist on doing things themself.
144
claus
parents: 140
diff changeset
    86
claus
parents: 140
diff changeset
    87
    Notice, that beside event listening, you can also define a delegate for
claus
parents: 140
diff changeset
    88
    a views keyboard and button events. 
claus
parents: 140
diff changeset
    89
    Read the documentation in WindowEvent for more info.
claus
parents: 140
diff changeset
    90
claus
parents: 140
diff changeset
    91
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 581
diff changeset
    92
    [instance variables:]
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
    93
	eventSemaphore          <Semaphore>     the semaphore to be signalled when an event
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
    94
						(or damage) arrives
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
    95
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
    96
	damage                  <Collection>    collection of damage events
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
    97
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
    98
	mouseAndKeyboard        <Collection>    collection of user events
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
    99
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   100
	compressMotionEvents    <Boolean>       if true, multiple motion events are
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   101
						compressed to one event. If false, each
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   102
						event is handled individual.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   103
						(should be set to false when doing free-hand drawing)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   104
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   105
	ignoreUserInput         <Boolean>       if true, key & button events are ignored
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   106
						(usually set to true by WindowGroup, while a
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   107
						 modalbox covers a view)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   108
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   109
	shiftDown               <Boolean>       true while shift/meta/control-key is pressed
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   110
	metaDown                                (to support ST-80 style query: sensor shiftDown)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   111
	ctrlDown
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   112
	altDown                                 (notice, that on most systems, alt and meta key is
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   113
						 the same, both reported as #Alt)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   114
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   115
	exposeEventSemaphore    <Semaphore>     X-special: semaphore to be signalled when
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   116
						expose event arrives after a copyArea.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   117
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   118
	catchExpose             <SetOfView>     if nonEMpty, the drawables which wait for
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   119
						an expose/noExpose event.  (after a copyArea)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   120
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   121
	gotExpose               <SetOfView>     the set of drawables which got an expose/noExpose
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   122
						event.  (after a copyarea)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   123
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   124
	gotOtherEvent           <SetOfView>     set of drawables which received if other events,
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   125
						while waiting for expose (after a copyarea).
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   126
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   127
	translateKeyboardEvents <Boolean>       if true, keyboard events are translated via
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   128
						the devices leyboardMap; if false, they
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   129
						are reported as raw-keys. Default is true.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   130
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   131
	eventListener           <Object>        if non nil, this one will get all pointer
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   132
						and keyboard events for this sensors views first.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   133
						If it returns true, the event is supposed to
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   134
						be already handled by the listener and not sent to
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   135
						the view. If false, the event is handled as usual.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   136
						This allows applications to catch events for any of
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   137
						its views.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   138
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   139
	keyboardListener        <Object>        if non nil, this one will get all keyboard events 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   140
						for this sensors views first (but after the eventListener,
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   141
						if any).
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   142
						If it returns true, the event is supposed to
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   143
						be already handled by the listener and not sent to
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   144
						the view. If false, the event is handled as usual.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   145
						This allows applications to catch events for any of
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   146
						its views.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   147
						ApplicationModels can catch keyboard input with:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   148
						    postOpenWith:aBuilder
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   149
							aBuilder window sensor keyboardListener:self
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   150
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   151
	accessLock              <Semaphore>     controls access to the event queues
140
claus
parents: 133
diff changeset
   152
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 581
diff changeset
   153
    [class variables:]
140
claus
parents: 133
diff changeset
   154
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   155
	ControlCEnabled         <Boolean>       if true (which is the default) Control-C
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   156
						will interrupt the process handling the
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   157
						view.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   158
						For secure stand-alone applications,
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   159
						this can be set to false, in which case 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   160
						Control-C does NOT interrupt the process.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   161
						(actually, Control-C is wrong here; the actual
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   162
						 key is #UserInterrupt, which may be mapped onto
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   163
						 any key)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   164
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   165
	ControlYEnabled         <Boolean>       if true (which is the default) Control-Y
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   166
						will raise the abortSignal in the process 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   167
						handling the view.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   168
						This can be used to abort a long operation
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   169
						(such as a long fileRead in the fileBrowser)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   170
						without entering the debugger.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   171
						(actually, Control-Y is wrong here; the actual
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   172
						 key is #UserAbort, which may be mapped onto
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   173
						 any key)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   174
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   175
	EventListener           <Object>        if non nil, this one will get all pointer
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   176
						and keyboard events for ALL views first.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   177
						If it returns true, the event is supposed to
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   178
						be already handled by the listener and not enqueued. 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   179
						If false, the event is handled as usual.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   180
						This allows overall event catchers to be
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   181
						installed for example to implement event
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   182
						recorders, active help managers etc.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   183
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   184
	ComposeTable            <Array>         compose-key translation table
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 581
diff changeset
   185
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 581
diff changeset
   186
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   187
    [author:]
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   188
	Claus Gittinger
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   189
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 581
diff changeset
   190
    [see also:]
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   191
	WindowGroup 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   192
	WindowEvent KeyboardMap KeyboardForwarder EventListener
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   193
	DeviceWorkstation View
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   194
"
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   195
! !
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   196
1082
44d671491f5e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
   197
!WindowSensor class methodsFor:'initialization'!
47
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
   198
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
   199
initialize
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   200
    "initialize the classes constants"
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   201
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   202
    ControlCEnabled := true.
2123
b2dae4453526 added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   203
    ControlYEnabled := true.
158
claus
parents: 157
diff changeset
   204
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   205
    ComposeTable isNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   206
	self initializeComposeKeyTable
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   207
    ]
157
claus
parents: 154
diff changeset
   208
claus
parents: 154
diff changeset
   209
    "
claus
parents: 154
diff changeset
   210
     WindowSensor initialize
claus
parents: 154
diff changeset
   211
    "
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   212
2123
b2dae4453526 added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   213
    "Modified: / 20.5.1998 / 14:01:52 / cg"
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   214
!
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   215
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   216
initializeComposeKeyTable
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   217
    "setup the composeKey table"
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   218
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   219
    ComposeTable := #(
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   220
	"/ format is:
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   221
	"/ ( key1 key2 <character or asciiValue> )
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   222
	"/
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   223
	($+ $+ $#)         "/ number-sign
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   224
	($A $A $@)         "/ at-sign
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   225
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   226
	($( $- ${)         "/ left brace
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   227
	($) $- $})         "/ right brace
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   228
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   229
	($| $c 16rA2)      "/ cent-sign 
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   230
	($| $S $$)         "/ dollar-sign
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   231
	($= $L 16rA3)      "/ pound-sign     
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   232
	($= $Y 16rA5)      "/ yen-sign        
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   233
	($!! $s 16rA7)      "/ section-sign    
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   234
	($O $C 16rA9)      "/ copyright        
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   235
	($< $< 16rAB)      "/ french <<-quotes 
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   236
	($O $R 16rAE)      "/ registered       
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   237
	($/ $u 16rB5)      "/ greek mu         
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   238
	($!! $p 16rB6)      "/ paragraph sign   
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   239
	($> $> 16rBB)      "/ french >> quotes 
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   240
	($^ $0 16rB0)      "/ degree sign      
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   241
	($+ $- 16rB1)      "/ plus-minus       
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   242
	($^ $2 16rB2)      "/ superscript-2    
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   243
	($^ $3 16rB3)      "/ superscript-3    
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   244
	($^ $. 16rB7)      "/ middle dot       
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   245
	($^ $1 16rB9)      "/ superscript-1    
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   246
	($1 $4 16rBC)      "/ 1/4              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   247
	($1 $2 16rBD)      "/ 1/2              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   248
	($3 $4 16rBE)      "/ 3/4              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   249
	($? $? 16rBF)      "/ ?-inverted       
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   250
	($- $: 16rF7)      "/ divide           
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   251
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   252
	"/ diacriticals: Compose diacrit character
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   253
	"/ grave
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   254
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   255
	($A $` 16rC0)      "/ A-`              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   256
	($a $` 16rE0)      "/ a-`              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   257
	($E $` 16rC8)      "/ E-`              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   258
	($e $` 16rE8)      "/ e-`              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   259
	($I $` 16rCC)      "/ I-`              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   260
	($i $` 16rEC)      "/ i-`              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   261
	($O $` 16rD2)      "/ O-`              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   262
	($o $` 16rF2)      "/ o-`              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   263
	($U $` 16rD9)      "/ U-`              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   264
	($u $` 16rF9)      "/ u-`              
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   265
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   266
	"/ acute
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   267
	($A $' 16rC1)      "/ A-'             
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   268
	($a $' 16rE1)      "/ a-'             
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   269
	($E $' 16rC9)      "/ E-'            
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   270
	($e $' 16rE9)      "/ e-'           
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   271
	($I $' 16rCD)      "/ I-'          
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   272
	($i $' 16rED)      "/ i-'         
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   273
	($O $' 16rD3)      "/ O-'        
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   274
	($o $' 16rF3)      "/ o-'       
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   275
	($U $' 16rDA)      "/ U-'      
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   276
	($u $' 16rFA)      "/ u-'     
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   277
	($Y $' 16rDD)      "/ Y-'    
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   278
	($y $' 16rFD)      "/ y-'   
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   279
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   280
	"/ circumflex
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   281
	($A $^ 16rC2)      "/ A-^              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   282
	($a $^ 16rE2)      "/ a-^             
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   283
	($E $^ 16rCA)      "/ E-^            
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   284
	($e $^ 16rEA)      "/ e-^           
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   285
	($I $^ 16rCE)      "/ I-^          
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   286
	($i $^ 16rEE)      "/ i-^         
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   287
	($O $^ 16rD4)      "/ O-^        
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   288
	($o $^ 16rF4)      "/ o-^       
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   289
	($U $^ 16rDB)      "/ U-^      
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   290
	($u $^ 16rFB)      "/ u-^     
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   291
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   292
	"/ tilde
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   293
	($A $~ 16rC3)      "/ A-~              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   294
	($a $~ 16rE3)      "/ a-~             
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   295
	($O $~ 16rD5)      "/ O-~            
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   296
	($o $~ 16rF5)      "/ o-~           
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   297
	($N $~ 16rD1)      "/ N-tilde      
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   298
	($n $~ 16rF1)      "/ n-~         
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   299
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   300
	"/ ring above
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   301
	($a $* 16rE5)      "/ a-*              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   302
	($A $* 16rC5)      "/ A-*             
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   303
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   304
	"/ cedille
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   305
	($C $, 16rC7)      "/ C-,              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   306
	($c $, 16rE7)      "/ c-,             
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   307
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   308
	"/ dieresis
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   309
	($A $" 16rC4)      "/ A-"              
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   310
	($a $" 16rE4)      "/ a-"             
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   311
	($E $" 16rCB)      "/ E-"            
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   312
	($e $" 16rEB)      "/ e-"           
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   313
	($I $" 16rCF)      "/ I-"          
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   314
	($i $" 16rEF)      "/ i-"         
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   315
	($O $" 16rD6)      "/ O-"        
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   316
	($o $" 16rF6)      "/ o-"       
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   317
	($U $" 16rDC)      "/ U-"      
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   318
	($u $" 16rFC)      "/ u-"     
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   319
	($y $" 16rFF)      "/ y-"    
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   320
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   321
	"/ slashed
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   322
	($o $/ 16rF8)      "/ o-/        
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   323
	($O $/ 16rD8)      "/ O-/    
608
3370e1f983d4 o-slash compose sequence
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   324
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   325
	"/ ligatures
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   326
	($s $s 16rDF)      "/ german sz        
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   327
	($a $e 16rE6)      "/ (french) ae     
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   328
	($A $E 16rC6)      "/ (french) AE    
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   329
    ).
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   330
608
3370e1f983d4 o-slash compose sequence
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   331
    "              
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   332
     WindowSensor initializeComposeKeyTable
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   333
    "
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   334
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   335
    "Created: 22.4.1996 / 14:06:43 / cg"
608
3370e1f983d4 o-slash compose sequence
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   336
    "Modified: 24.4.1996 / 16:37:08 / cg"
140
claus
parents: 133
diff changeset
   337
! !
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   338
1082
44d671491f5e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
   339
!WindowSensor class methodsFor:'instance creation'!
140
claus
parents: 133
diff changeset
   340
claus
parents: 133
diff changeset
   341
new
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   342
    "return a new initialized instance"
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   343
140
claus
parents: 133
diff changeset
   344
    ^ self basicNew initialize
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   345
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   346
    "Modified: 22.4.1996 / 16:19:40 / cg"
124
f5b3dd3d38db *** empty log message ***
claus
parents: 118
diff changeset
   347
! !
f5b3dd3d38db *** empty log message ***
claus
parents: 118
diff changeset
   348
1082
44d671491f5e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
   349
!WindowSensor class methodsFor:'accessing'!
47
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
   350
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   351
composeTable
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   352
    "return the compose-key table.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   353
     Entries consist of 3-element arrays each, where
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   354
     the first two entries (of each entry) are the raw characters,
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   355
     and the third is the resulting composed-key"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   356
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   357
    ^ ComposeTable
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   358
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   359
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   360
composeTable:aTable
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   361
    "set the compose-key table.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   362
     Entries consist of 3-element arrays each, where
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   363
     the first two entries (of each entry) are the raw characters,
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   364
     and the third is the resulting composed-key"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   365
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   366
    ComposeTable := aTable
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   367
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   368
144
claus
parents: 140
diff changeset
   369
controlCEnabled:aBoolean
claus
parents: 140
diff changeset
   370
    "enable/disable Control-C processing. 
claus
parents: 140
diff changeset
   371
     If enabled, pressing CNTL-C in a view will interrupt it and bring
1940
83012f66306a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
   372
     its process into the debugger (actually raising a UserInterrupt signal).
47
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
   373
     Otherwise, CNTL-C is sent to the view like any other key.
144
claus
parents: 140
diff changeset
   374
     The default is true (enabled).
1940
83012f66306a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
   375
     Be very careful - only disable CNTL-C handling for well-debugged
83012f66306a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
   376
     applications ... however, even if disabled, there still is the CNTL-C
83012f66306a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
   377
     key on the startup (x)-terminal window (which can also be disabled).
47
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
   378
    "
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
   379
144
claus
parents: 140
diff changeset
   380
    ControlCEnabled := aBoolean
1940
83012f66306a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
   381
83012f66306a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
   382
    "Modified: / 29.10.1997 / 15:48:29 / cg"
124
f5b3dd3d38db *** empty log message ***
claus
parents: 118
diff changeset
   383
!
f5b3dd3d38db *** empty log message ***
claus
parents: 118
diff changeset
   384
f5b3dd3d38db *** empty log message ***
claus
parents: 118
diff changeset
   385
eventListener
f5b3dd3d38db *** empty log message ***
claus
parents: 118
diff changeset
   386
    "return the eventListener 
f5b3dd3d38db *** empty log message ***
claus
parents: 118
diff changeset
   387
     - see documentation for what this can be used for"
f5b3dd3d38db *** empty log message ***
claus
parents: 118
diff changeset
   388
f5b3dd3d38db *** empty log message ***
claus
parents: 118
diff changeset
   389
    ^ EventListener
157
claus
parents: 154
diff changeset
   390
!
claus
parents: 154
diff changeset
   391
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   392
eventListener:aListener
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   393
    "set the eventListener 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   394
     - see documentation for what this can be used for"
157
claus
parents: 154
diff changeset
   395
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   396
    EventListener := aListener
47
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
   397
! !
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
   398
1082
44d671491f5e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
   399
!WindowSensor class methodsFor:'queries'!
133
claus
parents: 124
diff changeset
   400
claus
parents: 124
diff changeset
   401
cursorPoint
140
claus
parents: 133
diff changeset
   402
    "ST-80 compatibility: 
157
claus
parents: 154
diff changeset
   403
     return the position of the cursor on the current display"
133
claus
parents: 124
diff changeset
   404
153
claus
parents: 152
diff changeset
   405
    ^ Screen current pointerPosition
133
claus
parents: 124
diff changeset
   406
claus
parents: 124
diff changeset
   407
    "
claus
parents: 124
diff changeset
   408
     WindowSensor cursorPoint
claus
parents: 124
diff changeset
   409
    "
claus
parents: 124
diff changeset
   410
! !
claus
parents: 124
diff changeset
   411
1412
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   412
!WindowSensor methodsFor:'ST-80 compatibility'!
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   413
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   414
eventQuit:event
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   415
    "ST-80 compatibility:
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   416
     push an event for terminating the topViews application"
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   417
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   418
    ^ self pushEvent:(WindowEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   419
			     for:nil
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   420
			     type:#quit)
1412
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   421
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   422
    "Modified: 3.3.1997 / 20:15:00 / cg"
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   423
! !
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   424
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   425
!WindowSensor methodsFor:'accessing'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   426
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   427
compressMotionEvents:aBoolean
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   428
    "turn on/off motion event compression.
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   429
     Normally, motion event compression is enabled; however, 
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   430
     applications which want to follow every motion 
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   431
     (i.e. paint-like applications) may want to get them all)"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   432
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   433
    compressMotionEvents := aBoolean
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   434
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   435
    "Modified: / 6.6.1998 / 21:12:57 / cg"
1847
f449f3009e88 need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   436
!
f449f3009e88 need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   437
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   438
eventListener
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   439
    "return the eventListener 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   440
     - see documentation for what this can be used for"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   441
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   442
    ^ eventListener
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   443
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   444
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   445
eventListener:aListener
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   446
    "set the eventListener 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   447
     - see documentation for what this can be used for"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   448
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   449
    eventListener := aListener
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   450
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   451
!
140
claus
parents: 133
diff changeset
   452
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   453
eventSemaphore
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   454
    "return the semaphore used to signal event arrival"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   455
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   456
    ^ eventSemaphore
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   457
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   458
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   459
eventSemaphore:aSemaphore
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   460
    "set the semaphore used to signal event arrival"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   461
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   462
    eventSemaphore := aSemaphore
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   463
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   464
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   465
ignoreExposeEvents:aBoolean
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   466
    "turn on/off expose event ignoring"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   467
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   468
    ignoreExposeEvents := aBoolean
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   469
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   470
    "Created: / 21.5.1996 / 18:21:18 / cg"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   471
    "Modified: / 6.6.1998 / 21:13:14 / cg"
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   472
!
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   473
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   474
ignoreUserInput
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   475
    "return true, if user events are currently ignored"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   476
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   477
    ^ ignoreUserInput
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   478
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   479
    "Modified: / 6.6.1998 / 21:13:50 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   480
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   481
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   482
ignoreUserInput:aBoolean
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   483
    "turn on/off ignoring of user events processing.
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   484
     This can be used to avoid hacing events queued for a master-view,
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   485
     while a modal dialog is open for it."
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   486
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   487
    ignoreUserInput := aBoolean
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   488
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   489
    "Modified: / 6.6.1998 / 21:14:25 / cg"
140
claus
parents: 133
diff changeset
   490
!
claus
parents: 133
diff changeset
   491
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   492
keyboardListener
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   493
    "return the keyboardListener 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   494
     - see documentation for what this can be used for"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   495
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   496
    ^ keyboardListener
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   497
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   498
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   499
keyboardListener:aListener
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   500
    "set the keyboardListener 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   501
     - see documentation for what this can be used for"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   502
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   503
    keyboardListener := aListener
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   504
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   505
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   506
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   507
!WindowSensor methodsFor:'accessing - private'!
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   508
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   509
criticalDamageEventQueueAccess:aBlock
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   510
    "perform some action which needs synchronized (exclusive)
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   511
     access to the damage event queue. 
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   512
     (i.e. protected by a critical region)"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   513
2391
a8a92e36683c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2312
diff changeset
   514
    |wasBlocked p|
a8a92e36683c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2312
diff changeset
   515
a8a92e36683c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2312
diff changeset
   516
    p := Processor activeProcess.
a8a92e36683c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2312
diff changeset
   517
    wasBlocked := p blockInterrupts.
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   518
    [
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   519
	damageEventAccessLock critical:aBlock
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   520
    ] valueNowOrOnUnwindDo:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   521
	wasBlocked ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   522
	    p unblockInterrupts.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   523
	]
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   524
    ]
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   525
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   526
    "Created: / 6.6.1998 / 21:04:02 / cg"
2391
a8a92e36683c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2312
diff changeset
   527
    "Modified: / 14.10.1998 / 17:17:05 / cg"
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   528
!
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   529
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   530
criticalUserEventQueueAccess:aBlock
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   531
    "perform some action which needs synchronized (exclusive)
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   532
     access to the user event queue. 
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   533
     (i.e. protected by a critical region)"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   534
2391
a8a92e36683c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2312
diff changeset
   535
    |wasBlocked p|
a8a92e36683c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2312
diff changeset
   536
a8a92e36683c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2312
diff changeset
   537
    p := Processor activeProcess.
a8a92e36683c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2312
diff changeset
   538
    wasBlocked := p blockInterrupts.
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   539
    [
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   540
	userEventAccessLock critical:aBlock
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   541
    ] valueNowOrOnUnwindDo:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   542
	wasBlocked ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   543
	    p unblockInterrupts.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   544
	]
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   545
    ]
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   546
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   547
    "Created: / 6.6.1998 / 21:06:43 / cg"
2391
a8a92e36683c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2312
diff changeset
   548
    "Modified: / 14.10.1998 / 15:56:08 / cg"
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   549
!
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   550
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   551
damageEventAccessLock
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   552
    "return the semaphore which controls access to the damage event queue.
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   553
     This should probably not be exposed to the public,
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   554
     so be prepared that this method may vanish."
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   555
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   556
    ^ damageEventAccessLock
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   557
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   558
    "Created: / 6.6.1998 / 21:06:14 / cg"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   559
    "Modified: / 6.6.1998 / 21:16:49 / cg"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   560
!
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   561
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   562
userEventAccessLock
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   563
    "return the semaphore which controls access to the mouse and keyboard event queue.
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   564
     This should probably not be exposed to the public,
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   565
     so be prepared that this method may vanish."
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   566
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   567
    ^ userEventAccessLock
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   568
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   569
    "Created: / 6.6.1998 / 21:05:56 / cg"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   570
    "Modified: / 6.6.1998 / 21:16:57 / cg"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   571
! !
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   572
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   573
!WindowSensor methodsFor:'event flushing'!
144
claus
parents: 140
diff changeset
   574
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   575
compressKeyPressEventsWithKey:aKey
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   576
    "count and remove multiple pending keyPress events for the
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   577
     same key, aKey. This is currently used in TextViews to compress
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   578
     multiple cursorUp/cursorDown events and do the scroll in one
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   579
     operation. (to avoid run-after-cursor on slow displays)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   580
2022
90d1cebc9a92 fixed compressKeyFor:
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
   581
    |n ev evKey|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   582
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   583
    n := 0.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   584
    ev := self pendingEvent.
2022
90d1cebc9a92 fixed compressKeyFor:
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
   585
90d1cebc9a92 fixed compressKeyFor:
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
   586
    [ev notNil and:[ev isKeyEvent]] whileTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   587
	evKey := ev arguments at:1.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   588
	(evKey == aKey) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   589
	    ev isKeyReleaseEvent ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   590
		n := n + 1.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   591
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   592
	    self nextEvent.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   593
	    ev := self pendingEvent.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   594
	] ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   595
	    ev := nil
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   596
	]
144
claus
parents: 140
diff changeset
   597
    ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   598
    ^ n
2022
90d1cebc9a92 fixed compressKeyFor:
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
   599
90d1cebc9a92 fixed compressKeyFor:
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
   600
    "Modified: / 27.1.1998 / 14:15:00 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   601
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   602
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   603
flushEventsFor:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   604
    "throw away all events for aView, 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   605
     or any view, if the argument is nil."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   606
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   607
    self flushExposeEventsFor:aView.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   608
    self flushUserEventsFor:aView.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   609
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   610
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   611
flushEventsFor:aView inQueue:anEventQueue where:aCondition
1790
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   612
    "throw away all pending damage events for aView, 
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   613
     for which aCondition returns true.
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   614
     Or any view for which aCondition returns true, if the argument is nil. 
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   615
     A helper for the various flush entries."
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   616
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   617
    |action|
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   618
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   619
    action := [
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   620
	|nEvent "{ Class: SmallInteger }" 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   621
	 anEvent
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   622
	 queue|
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   623
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   624
	queue := anEventQueue.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   625
	nEvent := queue size.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   626
	1 to:nEvent do:[:index |
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   627
	    anEvent := queue at:index.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   628
	    anEvent notNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   629
		(aView isNil or:[anEvent view == aView]) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   630
		    (aCondition value:anEvent) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   631
			queue at:index put:nil
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   632
		    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   633
		]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   634
	    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   635
	].
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   636
    ].
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   637
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   638
    anEventQueue == damage ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   639
	self criticalDamageEventQueueAccess:action
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   640
    ] ifFalse:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   641
	self criticalUserEventQueueAccess:action
1790
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   642
    ]
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   643
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   644
    "Modified: / 6.6.1998 / 21:10:22 / cg"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   645
    "Created: / 6.6.1998 / 21:17:54 / cg"
1790
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   646
!
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   647
2163
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   648
flushEventsFor:aView withType:type
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   649
    "throw away all events for aView, 
2177
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
   650
     (or any view, if the argument is nil) which have a particular type."
2163
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   651
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   652
    self flushEventsFor:aView inQueue:damage where:[:event | event type==type].
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   653
    self flushEventsFor:aView inQueue:mouseAndKeyboard where:[:event | event type==type].
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   654
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   655
    "Created: / 20.6.1998 / 16:41:35 / cg"
2177
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
   656
    "Modified: / 21.7.1998 / 18:16:11 / cg"
2163
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   657
!
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   658
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   659
flushExposeEvents
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   660
    "throw away all pending expose events; this
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   661
     can be done after a full redraw (or in views, which are
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   662
     doing full redraws anly)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   663
1790
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   664
    self
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   665
	flushEventsFor:nil inQueue:damage where:[:event | event isDamage].
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   666
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   667
    "Modified: / 6.6.1998 / 21:18:03 / cg"
144
claus
parents: 140
diff changeset
   668
!
claus
parents: 140
diff changeset
   669
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   670
flushExposeEventsFor:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   671
    "throw away all pending expose events for aView, 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   672
     or any view, if the argument is nil. 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   673
     This can be done after a full redraw 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   674
     (or in views, which are always doing full redraws -
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   675
      instead of drawing the clip-area only)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   676
1790
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   677
    self
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   678
	flushEventsFor:aView inQueue:damage where:[:event | event isDamage].
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   679
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   680
    "Modified: / 6.6.1998 / 21:18:05 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   681
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   682
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   683
flushKeyboard
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   684
    "ST-80 compatibility: throw away all pending keyboard events"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   685
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   686
    self flushKeyboardFor:nil
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   687
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   688
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   689
flushKeyboardFor:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   690
    "throw away all pending keyboard events for aView, 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   691
     or any view, if the argument is nil." 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   692
1790
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   693
    self
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   694
	flushEventsFor:aView inQueue:mouseAndKeyboard 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   695
	where:[:event | event isKeyEvent]
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   696
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   697
    "Modified: / 6.6.1998 / 21:18:08 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   698
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   699
1731
ca
parents: 1616
diff changeset
   700
flushMotionEventsFor:aView
ca
parents: 1616
diff changeset
   701
    "throw away all pending motion events for aView, 
ca
parents: 1616
diff changeset
   702
     or for any view, if the argument is nil." 
ca
parents: 1616
diff changeset
   703
1790
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   704
    self
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   705
	flushEventsFor:aView inQueue:mouseAndKeyboard 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   706
	where:[:event | event isButtonMotionEvent]
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   707
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   708
    "Modified: / 6.6.1998 / 21:18:10 / cg"
1731
ca
parents: 1616
diff changeset
   709
!
ca
parents: 1616
diff changeset
   710
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   711
flushUserEvents
2163
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   712
    "throw away all pending user events (i.e. key & button stuff)"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   713
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   714
    (mouseAndKeyboard isNil or:[mouseAndKeyboard size > 0]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   715
	self flushUserEventsFor:nil
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   716
    ].
1159
e5247f8a48f3 do not flush synthetic events in #flushUserEvents
Claus Gittinger <cg@exept.de>
parents: 1155
diff changeset
   717
2163
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   718
    "Modified: / 20.6.1998 / 16:40:02 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   719
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   720
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   721
flushUserEventsFor:aView
2163
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   722
    "throw away all pending user events for aView (i.e. key & button stuff), 
1159
e5247f8a48f3 do not flush synthetic events in #flushUserEvents
Claus Gittinger <cg@exept.de>
parents: 1155
diff changeset
   723
     or for any view, if the argument is nil." 
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   724
1790
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
   725
    self
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   726
	flushEventsFor:aView inQueue:mouseAndKeyboard 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   727
	where:[:event | event isUserEvent]
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
   728
2163
31383028eec6 more flushing stuff.
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   729
    "Modified: / 20.6.1998 / 16:40:09 / cg"
2787
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   730
!
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   731
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   732
flushUserEventsFor:aView withType:type
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   733
    "throw away all pending user events with specified type for aView (i.e. key & button stuff), 
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   734
     or for any view, if the argument is nil." 
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   735
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   736
    self
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   737
        flushEventsFor:aView inQueue:mouseAndKeyboard 
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   738
        where:[:event | event type==type]
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   739
99aa802b2de5 added #flushUserEventsFor:withType:
Claus Gittinger <cg@exept.de>
parents: 2734
diff changeset
   740
    "Modified: / 20.6.1998 / 16:40:09 / cg"
157
claus
parents: 154
diff changeset
   741
! !
claus
parents: 154
diff changeset
   742
claus
parents: 154
diff changeset
   743
!WindowSensor methodsFor:'event processing'!
claus
parents: 154
diff changeset
   744
140
claus
parents: 133
diff changeset
   745
buttonMotion:state x:x y:y view:aView
claus
parents: 133
diff changeset
   746
    "mouse was moved - this is sent from the device (Display)"
claus
parents: 133
diff changeset
   747
2687
de85d8f2f7d0 care for invalid WM_MOUSEMOVE message after an activate in the client area
Claus Gittinger <cg@exept.de>
parents: 2662
diff changeset
   748
    |args ev ignoreIt prevLeftDown prevMiddleDown prevRightDown|
de85d8f2f7d0 care for invalid WM_MOUSEMOVE message after an activate in the client area
Claus Gittinger <cg@exept.de>
parents: 2662
diff changeset
   749
2689
2cbeb733da80 nope - the last one was not good
Claus Gittinger <cg@exept.de>
parents: 2687
diff changeset
   750
    "/ update my idea of button and modifier state information
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
   751
    self updateModifierStateFrom:state device:(aView graphicsDevice).
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
   752
140
claus
parents: 133
diff changeset
   753
    EventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   754
	(EventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
   755
    ].
claus
parents: 133
diff changeset
   756
    eventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   757
	(eventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
   758
    ].
claus
parents: 133
diff changeset
   759
claus
parents: 133
diff changeset
   760
    ignoreUserInput == true ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   761
	^ self
140
claus
parents: 133
diff changeset
   762
    ].
claus
parents: 133
diff changeset
   763
    args := Array with:state with:x with:y.
claus
parents: 133
diff changeset
   764
claus
parents: 133
diff changeset
   765
    compressMotionEvents ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   766
	"
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   767
	 merge with last motion
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   768
	"
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   769
	self criticalUserEventQueueAccess:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   770
	    |idx|
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   771
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   772
	    idx := mouseAndKeyboard size.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   773
	    [idx > 0] whileTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   774
		ev := mouseAndKeyboard at:idx.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   775
		ev notNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   776
		    ((ev type == #buttonMotion:x:y:) 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   777
		    and:[(ev view == aView)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   778
		    and:[(ev arguments at:1) == state]]) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   779
			ev arguments:args.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   780
			idx := 0.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   781
			ignoreIt := true
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   782
		    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   783
		].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   784
		idx := idx - 1.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   785
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   786
	].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   787
	ignoreIt == true ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   788
	    ^ self
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   789
	]
140
claus
parents: 133
diff changeset
   790
    ].
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   791
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   792
    ev := WindowEvent buttonEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   793
	     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   794
	     type:#buttonMotion:x:y:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   795
	     arguments:args.
1862
e56d9a7389bb also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
   796
    ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2123
diff changeset
   797
       button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   798
    self pushEvent:ev.
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   799
2689
2cbeb733da80 nope - the last one was not good
Claus Gittinger <cg@exept.de>
parents: 2687
diff changeset
   800
    "Modified: / 20.5.1999 / 17:22:43 / cg"
140
claus
parents: 133
diff changeset
   801
!
claus
parents: 133
diff changeset
   802
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   803
buttonMultiPress:button x:x y:y view:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   804
    "mouse button was pressed - this is sent from the device (Display)"
140
claus
parents: 133
diff changeset
   805
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   806
    |ev|
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   807
1083
6e947cc67324 fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   808
    self button:button inView:aView state:true.
6e947cc67324 fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   809
140
claus
parents: 133
diff changeset
   810
    EventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   811
	(EventListener buttonMultiPress:button x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
   812
    ].
claus
parents: 133
diff changeset
   813
    eventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   814
	(eventListener buttonMultiPress:button x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
   815
    ].
claus
parents: 133
diff changeset
   816
claus
parents: 133
diff changeset
   817
    ignoreUserInput == true ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   818
	^ self
140
claus
parents: 133
diff changeset
   819
    ].
1083
6e947cc67324 fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   820
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   821
    ev := WindowEvent buttonEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   822
	     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   823
	     type:#buttonMultiPress:x:y:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   824
	     arguments:(Array with:button with:x with:y).
1862
e56d9a7389bb also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
   825
    ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2123
diff changeset
   826
       button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   827
    self pushEvent:ev.
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   828
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2123
diff changeset
   829
    "Modified: / 21.5.1998 / 00:20:40 / cg"
140
claus
parents: 133
diff changeset
   830
!
claus
parents: 133
diff changeset
   831
claus
parents: 133
diff changeset
   832
buttonPress:button x:x y:y view:aView
claus
parents: 133
diff changeset
   833
    "mouse button was pressed - this is sent from the device (Display)"
claus
parents: 133
diff changeset
   834
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   835
    |ev|
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   836
157
claus
parents: 154
diff changeset
   837
    self button:button inView:aView state:true.
claus
parents: 154
diff changeset
   838
140
claus
parents: 133
diff changeset
   839
    EventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   840
	(EventListener buttonPress:button x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
   841
    ].
claus
parents: 133
diff changeset
   842
    eventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   843
	(eventListener buttonPress:button x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
   844
    ].
claus
parents: 133
diff changeset
   845
claus
parents: 133
diff changeset
   846
    ignoreUserInput == true ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   847
	^ self
140
claus
parents: 133
diff changeset
   848
    ].
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   849
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   850
    ev := WindowEvent buttonEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   851
	     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   852
	     type:#buttonPress:x:y:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   853
	     arguments:(Array with:button with:x with:y).
1862
e56d9a7389bb also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
   854
    ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2123
diff changeset
   855
       button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   856
    self pushEvent:ev.
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   857
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2123
diff changeset
   858
    "Modified: / 21.5.1998 / 00:20:44 / cg"
140
claus
parents: 133
diff changeset
   859
!
claus
parents: 133
diff changeset
   860
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   861
buttonRelease:button x:x y:y view:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   862
    "mouse button was released- this is sent from the device (Display)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   863
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   864
    |ev|
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   865
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   866
    self button:button inView:aView state:false.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   867
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   868
    EventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   869
	(EventListener buttonRelease:button x:x y:y view:aView) ifTrue:[^ self]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   870
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   871
    eventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   872
	(eventListener buttonRelease:button x:x y:y view:aView) ifTrue:[^ self]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   873
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   874
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   875
    ignoreUserInput == true ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   876
	^ self
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   877
    ].
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   878
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   879
    ev := WindowEvent buttonEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   880
	     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   881
	     type:#buttonRelease:x:y:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   882
	     arguments:(Array with:button with:x with:y).
1862
e56d9a7389bb also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
   883
    ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2123
diff changeset
   884
       button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
1861
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   885
    self pushEvent:ev.
1b1e49147380 remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents: 1852
diff changeset
   886
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2123
diff changeset
   887
    "Modified: / 21.5.1998 / 00:21:19 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   888
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   889
1545
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   890
clientMessage:type format:format eventData:data view:aView
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   891
    "some other data sent to a view.
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   892
     This is an X-specific event."
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   893
2708
855835147902 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
   894
    self pushEvent:(WindowEvent clientEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   895
			 for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   896
			 type:#clientMessage:format:eventData:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   897
			 arguments:(Array with:type with:format with:data)).
1545
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   898
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2123
diff changeset
   899
    "Created: / 4.4.1997 / 17:51:08 / cg"
2708
855835147902 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
   900
    "Modified: / 21.5.1999 / 19:46:43 / cg"
1545
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   901
!
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   902
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   903
configureX:x y:y width:w height:h view:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   904
    "a views size or position has changed - this is sent from the device (Display)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   905
2611
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   906
    |args|
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   907
1108
748f9e5c5b1e ignore configureEvents for subviews.
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   908
    aView superView notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   909
	"/ this is a configure event for a subView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   910
	"/ I guess, this resulted from a resize of
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   911
	"/ myself (are there any windowManagers which resize subviews ?)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   912
	"/ Therefore, ignore it here.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   913
	"/ This also fixed problems due to late-arriving configure events,
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   914
	"/ in case of a resized view, which was resized before.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   915
	"/ Without the return below, we need a flushConfigureEvents entry here,
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   916
	"/ to be invoked whenever a subview is resized / repositioned.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   917
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   918
	"/ A kludge-workaround had to be added to children of
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   919
	"/ external top views - since the external view does not get any
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   920
	"/ events delivered, we must react upon changes of the
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   921
	"/ child. (sigh).
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   922
	aView superView isExternalTopView ifFalse:[
2429
c54c8e30fe13 support for external topViews.
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
   923
"/            'ignored configure for: ' print. aView class printCR.
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   924
	    ^ self
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   925
	]
1969
d2d7073b7c56 experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   926
    ].
d2d7073b7c56 experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   927
d2d7073b7c56 experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   928
    "/
2612
a9376094c600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
   929
    "/ position changes alone are not queued, 
a9376094c600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
   930
    "/ but directly processed (WIN32 speedup)
2611
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   931
    "/
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   932
    (w == aView width
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   933
    and:[h == aView height]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   934
	aView configureX:x y:y width:w height:h.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   935
	^ self.
2611
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   936
    ].
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   937
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   938
    args := Array with:x with:y with:w with:h.
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   939
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   940
    "/
2612
a9376094c600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
   941
    "/ remove any old configure event (WIN32 speedup)
1969
d2d7073b7c56 experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   942
    "/
d2d7073b7c56 experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   943
    damage size ~~ 0 ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   944
	damage keysAndValuesDo:[:idx :aDamage |
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   945
	    (aDamage notNil 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   946
	    and:[aDamage type == #configureX:y:width:height:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   947
	    and:[aDamage view == aView]]) ifTrue:[
2611
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   948
"/                aDamage arguments:args.
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   949
"/                ^ self
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   950
		damage at:idx put:nil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   951
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   952
	]
1108
748f9e5c5b1e ignore configureEvents for subviews.
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   953
    ].
748f9e5c5b1e ignore configureEvents for subviews.
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   954
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   955
    self pushDamageEvent:(WindowEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   956
			     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   957
			     type:#configureX:y:width:height:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   958
			     arguments:args).
2611
0d6fbbb92448 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
   959
2612
a9376094c600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
   960
    "Modified: / 29.4.1999 / 10:06:47 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   961
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   962
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   963
coveredBy:sibling view:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   964
    "aView was covered by one of its siblings - this is sent from the device (Display)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   965
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   966
    self pushDamageEvent:(WindowEvent
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   967
			     for:aView
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   968
			     type:#coveredBy:
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   969
			     arguments:(Array with:sibling)).
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   970
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   971
    "Modified: 18.1.1997 / 14:18:32 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   972
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   973
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   974
destroyedView:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   975
    "view was destroyed (from window manager) - this is sent from the device (Display)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   976
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   977
    "at this time, the view is already gone; remove
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   978
     all pending events for this one ..."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   979
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   980
    self flushEventsFor:aView.
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   981
    self pushDamageEvent:(WindowEvent
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   982
			     for:aView
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   983
			     type:#destroyed).
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   984
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   985
    "Modified: 18.1.1997 / 14:18:19 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   986
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   987
1545
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   988
dropMessage:dropType data:dropValue view:aView
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   989
    "a drop sent to a view. The dropType is a symbolic specifier,
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   990
     which may be ignored, since the dropValue has already been
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   991
     converted into an ST/X dropObject."
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   992
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   993
    self pushEvent:(WindowEvent 
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   994
			     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   995
			     type:#dropMessage:data:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
   996
			     arguments:(Array with:dropType with:dropValue)).
1545
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   997
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   998
    "Created: 4.4.1997 / 18:13:41 / cg"
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
   999
    "Modified: 4.4.1997 / 18:55:25 / cg"
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
  1000
!
f821b3870502 client- and drop messages
Claus Gittinger <cg@exept.de>
parents: 1529
diff changeset
  1001
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1002
exposeX:left y:top width:width height:height view:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1003
    "an expose event arrived - this is sent from the device (Display)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1004
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1005
    ignoreExposeEvents ~~ true ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1006
	self addDamage:(Rectangle left:left top:top width:width height:height) 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1007
		  view:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1008
		wakeup:true.
1851
6a6225647696 fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1009
    ] ifFalse:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1010
	'ignored expose' printCR
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1011
    ]
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1012
2397
d1f0fda167af checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2391
diff changeset
  1013
    "Modified: / 9.11.1998 / 14:23:01 / cg"
140
claus
parents: 133
diff changeset
  1014
!
claus
parents: 133
diff changeset
  1015
claus
parents: 133
diff changeset
  1016
focusInView:aView
claus
parents: 133
diff changeset
  1017
    "view got input focus - this is sent from the device (Display)"
claus
parents: 133
diff changeset
  1018
2708
855835147902 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  1019
    self pushEvent:(WindowEvent focusEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1020
		     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1021
		     type:#focusIn).
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1022
2708
855835147902 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  1023
    "Modified: / 21.5.1999 / 19:46:04 / cg"
140
claus
parents: 133
diff changeset
  1024
!
claus
parents: 133
diff changeset
  1025
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1026
focusOutView:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1027
    "view lost input focus - this is sent from the device (Display)"
140
claus
parents: 133
diff changeset
  1028
2708
855835147902 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  1029
    self pushEvent:(WindowEvent focusEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1030
		     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1031
		     type:#focusOut).
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1032
2708
855835147902 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  1033
    "Modified: / 21.5.1999 / 19:46:10 / cg"
140
claus
parents: 133
diff changeset
  1034
!
claus
parents: 133
diff changeset
  1035
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  1036
graphicsExposeX:left y:top width:width height:height final:final view:aView
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1037
    "a graphic expose event arrived - this is sent from the device (Display)"
140
claus
parents: 133
diff changeset
  1038
1243
0c33cb7f8458 hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1039
    "/ this is also a possible response to a scroll operation
0c33cb7f8458 hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1040
    "/ (if an expose is pending)
0c33cb7f8458 hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1041
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  1042
    final ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1043
	(catchExpose includes:aView) ifTrue:[
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  1044
	    gotExpose add:aView.
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  1045
	    exposeEventSemaphore signalForAll
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  1046
	] ifFalse:[
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  1047
	    'WSensor [warning]: got exposeEvent for non-catching view:' infoPrint. aView infoPrintCR
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1048
	]
1243
0c33cb7f8458 hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1049
    ].
0c33cb7f8458 hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1050
751
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1051
    self addDamage:(left @ top extent:width @ height) view:aView wakeup:false.
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1052
1268
612204a36c38 no, regular expose events should not trigger the exposeSema
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
  1053
    "Modified: 23.1.1997 / 22:15:53 / cg"
140
claus
parents: 133
diff changeset
  1054
!
claus
parents: 133
diff changeset
  1055
claus
parents: 133
diff changeset
  1056
keyPress:key x:x y:y view:aView
claus
parents: 133
diff changeset
  1057
    "key was pressed - this is sent from the device (Display).
claus
parents: 133
diff changeset
  1058
     beside the keyboard translation, CntlC processing is done here."
claus
parents: 133
diff changeset
  1059
510
c0c7a04317a9 resources
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  1060
    <resource: #keyboard ( #Compose #DestroyView #DestroyTopView #FlushInput
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1061
			   #UserInterrupt #UserAbort) >
1528
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1062
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1063
    |xlatedKey group process ev|
140
claus
parents: 133
diff changeset
  1064
144
claus
parents: 140
diff changeset
  1065
    self key:key state:true. 
claus
parents: 140
diff changeset
  1066
2413
08e6fadff67d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  1067
    "/ bail out of a popUpView with ctrl-escape
08e6fadff67d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  1068
    "/ (useful to avoid total lock of system with non-functioning grabbing opUpView)
08e6fadff67d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  1069
    (key == #Escape) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1070
	aView isPopUpView ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1071
	    ctrlDown ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1072
		aView device ungrabPointer.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1073
		aView device ungrabKeyboard.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1074
		aView destroy.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1075
		^ self
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1076
	    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1077
	]
2413
08e6fadff67d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  1078
    ].
08e6fadff67d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  1079
140
claus
parents: 133
diff changeset
  1080
    EventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1081
	(EventListener keyPress:key x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
  1082
    ].
claus
parents: 133
diff changeset
  1083
    eventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1084
	(eventListener keyPress:key x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
  1085
    ].
claus
parents: 133
diff changeset
  1086
    keyboardListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1087
	(keyboardListener keyPress:key x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
  1088
    ].
claus
parents: 133
diff changeset
  1089
claus
parents: 133
diff changeset
  1090
    translateKeyboardEvents ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1091
	xlatedKey := aView graphicsDevice translateKey:key forView:aView.
140
claus
parents: 133
diff changeset
  1092
    ] ifFalse:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1093
	xlatedKey := key.
140
claus
parents: 133
diff changeset
  1094
    ].
157
claus
parents: 154
diff changeset
  1095
140
claus
parents: 133
diff changeset
  1096
    xlatedKey isNil ifTrue:[^ self].
claus
parents: 133
diff changeset
  1097
157
claus
parents: 154
diff changeset
  1098
    (xlatedKey == #Compose) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1099
	GotCompose := true. Compose1 := nil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1100
	^ self
157
claus
parents: 154
diff changeset
  1101
    ].
claus
parents: 154
diff changeset
  1102
    GotCompose == true ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1103
	Compose1 isNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1104
	    (self isModifierKey:xlatedKey) ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1105
		Compose1 := xlatedKey. 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1106
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1107
	    ^ self
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1108
	].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1109
	(self isModifierKey:xlatedKey) ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1110
	    xlatedKey  := self compose:Compose1 with:xlatedKey.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1111
	    Compose1 := nil. GotCompose := false.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1112
	]
157
claus
parents: 154
diff changeset
  1113
    ].
claus
parents: 154
diff changeset
  1114
claus
parents: 154
diff changeset
  1115
    (xlatedKey == #CmdCtrlV) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1116
	'Smalltalk/X ' errorPrint. 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1117
	Smalltalk versionString errorPrint. ' of ' errorPrint.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1118
	Smalltalk versionDate errorPrintCR.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1119
	Smalltalk copyrightString errorPrintCR.
140
claus
parents: 133
diff changeset
  1120
    ].
claus
parents: 133
diff changeset
  1121
157
claus
parents: 154
diff changeset
  1122
    (xlatedKey == #DestroyView) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1123
	aView closeRequest.
157
claus
parents: 154
diff changeset
  1124
    ].
claus
parents: 154
diff changeset
  1125
    (xlatedKey == #DestroyTopView) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1126
	aView topView closeRequest.
157
claus
parents: 154
diff changeset
  1127
    ].
claus
parents: 154
diff changeset
  1128
152
claus
parents: 144
diff changeset
  1129
    (xlatedKey == #FlushInput) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1130
	"this removes any enqueued user events -
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1131
	 helps, if you pressed DoIt too often, and want to flush those
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1132
	"
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1133
	self flushUserEvents.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1134
	^ self
152
claus
parents: 144
diff changeset
  1135
    ].
claus
parents: 144
diff changeset
  1136
2123
b2dae4453526 added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1137
    (((xlatedKey == #UserInterrupt) and:[ControlCEnabled])
b2dae4453526 added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1138
    or:[((xlatedKey == #UserAbort) and:[ControlYEnabled])]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1139
	"
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1140
	 Special handling for 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1141
	    Ctrl-C: interrupt the underlying process.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1142
	 and:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1143
	    Ctrl-Y: raise abortSignal the underlying process.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1144
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1145
	 cannot halt here (this would stop the event-dispatcher),
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1146
	 but instead interrupt the underlying process and have it
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1147
	 perform the userInterrupt in the interrupt-method.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1148
	"
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1149
	group := aView windowGroup.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1150
	group notNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1151
	    process := group process.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1152
	    process notNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1153
		(xlatedKey == #UserAbort) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1154
		    process interruptWith:[:where | AbortSignal raise]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1155
		] ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1156
		    process interruptWith:[:where | process userInterruptIn:where]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1157
		]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1158
	    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1159
	].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1160
	^ self
140
claus
parents: 133
diff changeset
  1161
    ].
claus
parents: 133
diff changeset
  1162
claus
parents: 133
diff changeset
  1163
    ignoreUserInput == true ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1164
	^ self
140
claus
parents: 133
diff changeset
  1165
    ].
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1166
1528
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1167
    ev := WindowEvent keyboardEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1168
	     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1169
	     type:#keyPress:x:y:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1170
	     arguments:(Array with:xlatedKey with:x with:y).
1528
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1171
    ev rawKey:key.
1862
e56d9a7389bb also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
  1172
    ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1173
			  button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
1528
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1174
    self pushEvent:ev.
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1175
2413
08e6fadff67d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  1176
    "Modified: / 4.12.1998 / 15:35:32 / cg"
140
claus
parents: 133
diff changeset
  1177
!
claus
parents: 133
diff changeset
  1178
claus
parents: 133
diff changeset
  1179
keyRelease:key x:x y:y view:aView
claus
parents: 133
diff changeset
  1180
    "key was released - this is sent from the device (Display)."
claus
parents: 133
diff changeset
  1181
1528
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1182
    |xlatedKey ev|
140
claus
parents: 133
diff changeset
  1183
144
claus
parents: 140
diff changeset
  1184
    self key:key state:false. 
claus
parents: 140
diff changeset
  1185
140
claus
parents: 133
diff changeset
  1186
    EventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1187
	(EventListener keyRelease:key x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
  1188
    ].
claus
parents: 133
diff changeset
  1189
    eventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1190
	(eventListener keyRelease:key x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
  1191
    ].
claus
parents: 133
diff changeset
  1192
    keyboardListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1193
	(keyboardListener keyRelease:key x:x y:y view:aView) ifTrue:[^ self]
140
claus
parents: 133
diff changeset
  1194
    ].
claus
parents: 133
diff changeset
  1195
claus
parents: 133
diff changeset
  1196
    ignoreUserInput == true ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1197
	^ self
140
claus
parents: 133
diff changeset
  1198
    ].
claus
parents: 133
diff changeset
  1199
    translateKeyboardEvents ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1200
	xlatedKey := aView graphicsDevice translateKey:key forView:aView.
140
claus
parents: 133
diff changeset
  1201
    ] ifFalse:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1202
	xlatedKey := key.
140
claus
parents: 133
diff changeset
  1203
    ].
claus
parents: 133
diff changeset
  1204
    xlatedKey isNil ifTrue:[^ self].
claus
parents: 133
diff changeset
  1205
1528
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1206
    ev := WindowEvent keyboardEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1207
	     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1208
	     type:#keyRelease:x:y:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1209
	     arguments:(Array with:xlatedKey with:x with:y).
1528
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1210
    ev rawKey:key.
1862
e56d9a7389bb also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
  1211
    ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1212
			  button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
1528
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1213
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1214
    self pushEvent:ev.
78c64c132593 started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  1215
1862
e56d9a7389bb also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
  1216
    "Modified: 13.8.1997 / 22:19:22 / cg"
140
claus
parents: 133
diff changeset
  1217
!
claus
parents: 133
diff changeset
  1218
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1219
mappedView:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1220
    "view was mapped (from window manager) - this is sent from the device (Display)"
140
claus
parents: 133
diff changeset
  1221
2058
59a52789086a fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  1222
    self flushExposeEventsFor:aView.
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1223
    self pushDamageEvent:(WindowEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1224
			     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1225
			     type:#mapped).
1851
6a6225647696 fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1226
2058
59a52789086a fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  1227
    "Modified: / 16.2.1998 / 13:20:41 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1228
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1229
2733
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1230
mouseWheelMotion:state x:x y:y amount:amount deltaTime:dTime view:aView
2699
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1231
    "mouse-wheel was turned - this is sent from the device (Display)"
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1232
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1233
    |args ev ignoreIt prevLeftDown prevMiddleDown prevRightDown focusView|
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1234
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1235
    "/ update my idea of button and modifier state information
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1236
    self updateModifierStateFrom:state device:(aView graphicsDevice).
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1237
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1238
    EventListener notNil ifTrue:[
2734
13a72f215666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2733
diff changeset
  1239
        (EventListener mouseWheelMotion:state x:x y:y amount:amount deltaTime:dTime view:aView) ifTrue:[^ self]
2699
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1240
    ].
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1241
    eventListener notNil ifTrue:[
2734
13a72f215666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2733
diff changeset
  1242
        (eventListener mouseWheelMotion:state x:x y:y amount:amount deltaTime:dTime view:aView) ifTrue:[^ self]
2699
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1243
    ].
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1244
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1245
    ignoreUserInput == true ifTrue:[
2734
13a72f215666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2733
diff changeset
  1246
        ^ self
2699
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1247
    ].
2733
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1248
    args := Array with:state with:x with:y with:amount with:dTime.
2699
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1249
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1250
    focusView := aView windowGroup focusView.
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1251
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1252
    ev := WindowEvent inputEvent
2734
13a72f215666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2733
diff changeset
  1253
             for:focusView
13a72f215666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2733
diff changeset
  1254
             type:#mouseWheelMotion:x:y:amount:deltaTime: 
13a72f215666 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2733
diff changeset
  1255
             arguments:args.
2699
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1256
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1257
    ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1258
       button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1259
    self pushEvent:ev.
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1260
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1261
    "Created: / 21.5.1999 / 13:05:18 / cg"
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1262
    "Modified: / 21.5.1999 / 13:12:40 / cg"
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1263
!
01594e76fc92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1264
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1265
noExposeView:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1266
    "an noexpose event arrived - this is sent from the device (Display)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1267
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  1268
    (catchExpose includes:aView) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1269
	gotExpose add:aView.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1270
	exposeEventSemaphore signalForAll
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1271
    ] ifFalse:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1272
	'WSensor [warning]: got noExpose for non-catching view:' infoPrint. aView infoPrintCR
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1273
    ]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1274
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1275
1340
f028f125f606 pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents: 1331
diff changeset
  1276
pasteFromClipBoard:something view:aView
f028f125f606 pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents: 1331
diff changeset
  1277
    "a clipboard paste - this is handled like a user event"
f028f125f606 pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents: 1331
diff changeset
  1278
f028f125f606 pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents: 1331
diff changeset
  1279
    self pushEvent:(WindowEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1280
		     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1281
		     type:#pasteFromClipBoard:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1282
		     arguments:(Array with:something)).
1340
f028f125f606 pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents: 1331
diff changeset
  1283
f028f125f606 pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents: 1331
diff changeset
  1284
    "Modified: 18.1.1997 / 14:07:25 / cg"
f028f125f606 pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents: 1331
diff changeset
  1285
    "Created: 13.2.1997 / 13:40:24 / cg"
f028f125f606 pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents: 1331
diff changeset
  1286
!
f028f125f606 pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents: 1331
diff changeset
  1287
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1288
pointerEnter:state x:x y:y view:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1289
    "mouse cursor was moved into the view - this is sent from the device (Display)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1290
1864
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1291
    |ev|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1292
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1293
    "/ update my idea of shift/alt/ctrl pressed information
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1294
    self updateModifierStateFrom:state device:(aView graphicsDevice).
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1295
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1296
    EventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1297
	(EventListener pointerEnter:state x:x y:y view:aView) ifTrue:[^ self]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1298
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1299
    eventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1300
	(eventListener pointerEnter:state x:x y:y view:aView) ifTrue:[^ self]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1301
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1302
1864
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1303
    ev := WindowEvent inputEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1304
	     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1305
	     type:#pointerEnter:x:y:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1306
	     arguments:(Array with:state with:x with:y).
1864
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1307
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1308
    ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1309
			  button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
1864
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1310
    self pushEvent:ev.
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1311
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1312
    "Modified: 13.8.1997 / 23:04:09 / cg"
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1313
!
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1314
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1315
pointerLeave:state view:aView
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1316
    "mouse cursor was moved out of the view - this is sent from the device (Display)"
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1317
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1318
    |ev|
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1319
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1320
    "/ update my idea of shift/alt/ctrl pressed information
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1321
    self updateModifierStateFrom:state device:(aView graphicsDevice).
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1322
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1323
    EventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1324
	(EventListener pointerLeave:state view:aView) ifTrue:[^ self]
1864
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1325
    ].
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1326
    eventListener notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1327
	(eventListener pointerLeave:state view:aView) ifTrue:[^ self]
1864
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1328
    ].
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1329
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1330
    ev := WindowEvent inputEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1331
	     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1332
	     type:#pointerLeave:
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1333
	     arguments:(Array with:state).
1864
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1334
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1335
    ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1336
			  button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown.
1864
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1337
    self pushEvent:ev.
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1338
4aeff6edaab6 remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
  1339
    "Modified: 13.8.1997 / 23:04:13 / cg"
140
claus
parents: 133
diff changeset
  1340
!
claus
parents: 133
diff changeset
  1341
claus
parents: 133
diff changeset
  1342
saveAndTerminateView:aView
claus
parents: 133
diff changeset
  1343
    "view should save & terminate (from window manager) - this is sent from the device (Display)"
claus
parents: 133
diff changeset
  1344
claus
parents: 133
diff changeset
  1345
    self flushEventsFor:aView.
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1346
    self pushDamageEvent:(WindowEvent
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1347
			     for:aView
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1348
			     type:#saveAndTerminate).
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1349
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1350
    "Modified: 18.1.1997 / 14:17:37 / cg"
140
claus
parents: 133
diff changeset
  1351
!
claus
parents: 133
diff changeset
  1352
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1353
terminateView:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1354
    "view should terminate (from window manager) - this is sent from the device (Display)"
140
claus
parents: 133
diff changeset
  1355
2731
8bec6c7db9b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1356
    |wg|
8bec6c7db9b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1357
140
claus
parents: 133
diff changeset
  1358
    self flushEventsFor:aView.
2731
8bec6c7db9b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1359
8bec6c7db9b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1360
    ((wg := aView windowGroup) notNil
8bec6c7db9b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1361
    and:[wg process isNil
2733
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1362
	  or:[wg process isDead]]) ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1363
	'WindowSensor [warning]: destroying view for dead windowGroup' infoPrintCR.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1364
	aView topView destroy.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1365
	^ self
2731
8bec6c7db9b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1366
    ].
8bec6c7db9b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1367
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1368
    self pushDamageEvent:(WindowEvent
2733
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1369
			     for:aView
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1370
			     type:#terminate).
2731
8bec6c7db9b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1371
8bec6c7db9b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1372
    "Modified: / 25.5.1999 / 15:52:20 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1373
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1374
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1375
unmappedView:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1376
    "view was unmapped (from window manager) - this is sent from the device (Display)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1377
2058
59a52789086a fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  1378
    self flushExposeEventsFor:aView.
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1379
    self pushDamageEvent:(WindowEvent
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1380
			     for:aView
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1381
			     type:#unmapped).
2058
59a52789086a fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  1382
59a52789086a fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  1383
    "Modified: / 16.2.1998 / 13:20:37 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1384
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1385
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1386
!WindowSensor methodsFor:'event processing - private'!
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1387
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1388
button:button inView:aView state:onOrOff
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1389
    "update the state of the xxxButtonDown flags"
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1390
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1391
    |physicalButton|
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1392
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1393
    physicalButton := aView graphicsDevice buttonTranslation keyAtValue:button ifAbsent:button.
1084
9c433066e960 oops - leftover debugPrint
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  1394
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1395
    (physicalButton == 1) ifTrue:[
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1396
	leftButtonDown := onOrOff.
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1397
	^ self
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1398
    ].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1399
    (physicalButton == 2) ifTrue:[
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1400
	middleButtonDown := onOrOff.
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1401
	^ self
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1402
    ].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1403
    (physicalButton == 3) ifTrue:[
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1404
	rightButtonDown := onOrOff.
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1405
	^ self
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1406
    ].
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1407
1084
9c433066e960 oops - leftover debugPrint
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  1408
    "Modified: 21.10.1996 / 11:47:35 / cg"
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1409
!
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1410
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1411
compose:key1 with:key2
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1412
    "compose a 2-character sequence into a composed key"
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1413
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1414
    ComposeTable do:[:entry |
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1415
	|v|
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1416
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1417
	((key1 == (entry at:1)) and:[key2 == (entry at:2)]) ifTrue:[
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1418
	    v := entry at:3.
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1419
	    v isCharacter ifFalse:[v := Character value:v].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1420
	    ^ v
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1421
	]
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1422
    ].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1423
    "/
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1424
    "/ for illegal sequence, return 2nd key
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1425
    "/
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1426
"/ key1 print. ' ' print. key2 printNL.
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1427
    ^ key2
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1428
!
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1429
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1430
isModifierKey:key
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1431
    "return true if key is a modifier (Alt, Shift, Ctrl or Meta)"
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1432
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1433
    (key == #Shift
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1434
    or:[key == #'Shift_R' 
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1435
    or:[key == #'Shift_L']]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1436
	^ true
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1437
    ].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1438
    (key == #Alt
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1439
    or:[key == #'Alt_R' or:[key == #'Alt_L']])  ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1440
	^ true
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1441
    ].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1442
    (key == #Meta
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1443
    or:[key == #'Meta_R' or:[key == #'Meta_L']]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1444
	^ true
2262
c97df93c1781 Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1445
    ].
c97df93c1781 Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1446
    (key == #Ctrl
c97df93c1781 Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1447
    or:[key == #'Ctrl_R' or:[key == #'Ctrl_L']]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1448
	^ true
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1449
    ].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1450
    (key == #Control
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1451
    or:[key == #'Control_R' or:[key == #'Control_L']]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1452
	^ true
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1453
    ].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1454
    ^ false
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1455
2262
c97df93c1781 Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1456
    "Modified: / 22.8.1998 / 02:33:46 / cg"
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1457
!
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1458
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1459
key:key state:onOrOff
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1460
    "update the state of the shiftDown/metaDown and ctrlDown
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1461
     flags"
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1462
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1463
    (key = #Shift
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1464
    or:[key = #'Shift_R' 
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1465
    or:[key = #'Shift_L']]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1466
	shiftDown := onOrOff.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1467
	^ self
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1468
    ].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1469
    (key = #Alt
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1470
    or:[key = #'Alt_R' or:[key = #'Alt_L']])  ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1471
	altDown := onOrOff.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1472
	^ self
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1473
    ].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1474
    (key = #Meta
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1475
    or:[key = #'Meta_R' or:[key = #'Meta_L']]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1476
	metaDown := onOrOff.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1477
	^ self
2262
c97df93c1781 Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1478
    ].
c97df93c1781 Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1479
    (key = #Ctrl
c97df93c1781 Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1480
    or:[key = #'Ctrl_R' or:[key = #'Ctrl_L']]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1481
	ctrlDown := onOrOff.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1482
	^ self
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1483
    ].
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1484
    (key = #Control
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1485
    or:[key = #'Control_R' or:[key = #'Control_L']]) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1486
	ctrlDown := onOrOff.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1487
	^ self
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1488
    ].
2262
c97df93c1781 Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1489
c97df93c1781 Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents: 2177
diff changeset
  1490
    "Modified: / 22.8.1998 / 02:33:04 / cg"
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1491
!
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1492
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  1493
notifyEventArrival:aView
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1494
    "an event arrived - if there is an eventSemaphore,
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1495
     signal it, to wake up any windowGroup process"
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1496
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1497
    (catchExpose includesIdentical:aView) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1498
	"
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1499
	 dont wake up, if we are currently waiting for an expose
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1500
	 but remember arrival of something.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1501
	"
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1502
	gotOtherEvent add:aView.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1503
	^ self
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1504
    ].
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1505
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1506
    eventSemaphore notNil ifTrue:[
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1507
"/        eventSemaphore signal
1184
1372bad824af single trigger on the eventSemaphore is ok
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  1508
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1509
	"/ can get along with a single trigger;
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1510
	"/ because processEvents will read all events
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1511
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1512
	eventSemaphore signalOnce
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1513
    ]
1184
1372bad824af single trigger on the eventSemaphore is ok
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  1514
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1515
    "Modified: 8.2.1997 / 12:01:48 / cg"
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1516
!
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1517
2312
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1518
updateModifierStateFrom:stateIn device:aDevice
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1519
    "this updates the modifier key-states.
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1520
     Called privately when pointer enters a view."
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1521
2312
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1522
    |state|
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1523
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1524
    "/ Prevents wrong behavior in the following scenario:
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1525
    "/    ctrl is pressed in a view
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1526
    "/    pointer is moved out of view
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1527
    "/    ctrl is released
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1528
    "/    pointer moved back into view
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1529
    "/    popup-menu still thinks that ctrl is pressed"
2312
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1530
    "/ state := aDevice buttonStates.
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1531
    state := stateIn.
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1532
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1533
    shiftDown := (state bitAnd:(aDevice shiftMask)) ~~ 0.
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1534
    ctrlDown := (state bitAnd:(aDevice controlMask)) ~~ 0.
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1535
    metaDown := (state bitAnd:(aDevice metaModifierMask)) ~~ 0.
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1536
    altDown := (state bitAnd:(aDevice altModifierMask)) ~~ 0.
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1537
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1538
    leftButtonDown := (state bitAnd:(aDevice leftButtonStateMask)) ~~ 0.
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1539
    middleButtonDown := (state bitAnd:(aDevice middleButtonStateMask)) ~~ 0.
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1540
    rightButtonDown := (state bitAnd:(aDevice rightButtonStateMask)) ~~ 0.
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1541
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1542
    "Created: / 27.2.1996 / 14:54:38 / cg"
0ec069be9679 mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  1543
    "Modified: / 8.9.1998 / 15:11:44 / cg"
581
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1544
! !
23dc2352dce9 commentary
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1545
140
claus
parents: 133
diff changeset
  1546
!WindowSensor methodsFor:'event queue'!
claus
parents: 133
diff changeset
  1547
144
claus
parents: 140
diff changeset
  1548
addDamage:aRectangle view:aView
1318
5810dfc3137a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  1549
    "{ Pragma: +optSpeed }"
5810dfc3137a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
  1550
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1551
    "Add aRectangle to the damage list.
144
claus
parents: 140
diff changeset
  1552
     Try to merge incoming rectangles with the existing damage rectangles.
claus
parents: 140
diff changeset
  1553
     Incoming rectangles which are completely contained in any existing damage rect are ignored,
claus
parents: 140
diff changeset
  1554
     any existing damage rectangle which is completely contained in the incoming rectangle
2469
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1555
     is replaced."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1556
751
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1557
    ^ self addDamage:aRectangle view:aView wakeup:true
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1558
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1559
    "Modified: 28.5.1996 / 21:52:47 / cg"
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1560
!
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1561
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1562
addDamage:aRectangle view:aView wakeup:doWakeup
1317
e1bd3b4aee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1563
    "{ Pragma: +optSpeed }"
e1bd3b4aee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1564
751
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1565
    "Add aRectangle to the damage list.
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1566
     Try to merge incoming rectangles with the existing damage rectangles.
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1567
     Incoming rectangles which are completely contained in any existing damage rect are ignored,
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1568
     any existing damage rectangle which is completely contained in the incoming rectangle
2469
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1569
     is replaced. 
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1570
     Returns true, if a new event has been added to the queue, false if it
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1571
     was optimized away."
751
043bbbd431e6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1572
1492
cb0118ee73e3 avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents: 1412
diff changeset
  1573
    |ret|
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1574
1492
cb0118ee73e3 avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents: 1412
diff changeset
  1575
    ret := false.
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1576
    self criticalDamageEventQueueAccess:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1577
	(self basicAddDamage:aRectangle view:aView)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1578
	ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1579
	    doWakeup ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1580
		self notifyEventArrival:aView.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1581
		ret := true
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1582
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1583
	].
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1584
    ].
1492
cb0118ee73e3 avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents: 1412
diff changeset
  1585
    ^ ret
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1586
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1587
    "Created: / 28.5.1996 / 21:51:16 / cg"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1588
    "Modified: / 6.6.1998 / 21:09:06 / cg"
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1589
!
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1590
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1591
basicAddDamage:aRectangle view:aView
1317
e1bd3b4aee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1592
    "{ Pragma: +optSpeed }"
e1bd3b4aee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1593
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1594
    "Add aRectangle to the damage list.
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1595
     Try to merge incoming rectangles with the existing damage rectangles.
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1596
     Incoming rectangles which are completely contained in any existing damage rect are ignored,
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1597
     any existing damage rectangle which is completely contained in the incoming rectangle
2469
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1598
     is replaced.
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1599
     Returns true, if a new event has been added to the queue, false if it
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1600
     was optimized away."
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1601
2470
0a7b3943ce90 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1602
    |newEvent r fullRedraw aDamage 
0a7b3943ce90 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1603
     nDamagesForView bounds areaOfIndividualRects thisRectangle
2469
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1604
     sz                "{ Class: SmallInteger }"|
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1605
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1606
    sz := damage size.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1607
152
claus
parents: 144
diff changeset
  1608
    r := aRectangle.
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1609
    (fullRedraw := aView redrawsFull) ifTrue:[
2733
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1610
	r := 0@0 corner:9999@9999.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1611
	newEvent := WindowEvent damageFor:aView rectangle:r.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1612
	damage add:newEvent.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1613
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1614
	"/ remove all other damages for this view ...
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1615
	1 to:sz do:[:idx |
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1616
	    aDamage := damage at:idx.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1617
	    aDamage notNil ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1618
		(aDamage isDamageForView:aView) ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1619
		    damage at:idx put:nil
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1620
		]
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1621
	    ].
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1622
	].
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1623
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1624
	^ true
2469
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1625
    ].
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1626
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1627
    "/ remove other damages which are contained in this rectangle
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1628
2470
0a7b3943ce90 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1629
    nDamagesForView := 0.
0a7b3943ce90 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1630
    bounds := r.
0a7b3943ce90 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1631
    areaOfIndividualRects := r area.
2469
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1632
    1 to:sz do:[:idx |
2733
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1633
	aDamage := damage at:idx.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1634
	aDamage notNil ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1635
	    (aDamage isDamageForView:aView) ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1636
		thisRectangle := aDamage rectangle.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1637
		(r contains:thisRectangle) ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1638
		    "/ the new rectangle contains that old damage
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1639
		    damage at:idx put:nil
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1640
		] ifFalse:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1641
		    "/ the old damage contains the new rectangle    
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1642
		    (thisRectangle contains:r) ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1643
			^ false
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1644
		    ].
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1645
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1646
		    "/ try to merge at left/right    
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1647
		    r top == thisRectangle top ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1648
			r height == thisRectangle height ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1649
			    thisRectangle left:(r left min:thisRectangle left).
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1650
			    thisRectangle right:(r right max:thisRectangle right).
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1651
			    ^ false
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1652
			]
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1653
		    ] ifFalse:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1654
			"/ try to merge at top/bottom    
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1655
			r left == thisRectangle left ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1656
			    r width == thisRectangle width ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1657
				thisRectangle top:(r top min:thisRectangle top).
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1658
				thisRectangle bottom:(r bottom max:thisRectangle bottom).
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1659
				^ false
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1660
			    ]
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1661
			]
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1662
		    ].
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1663
		    nDamagesForView := nDamagesForView + 1.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1664
		    bounds := bounds merge:thisRectangle.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1665
		    areaOfIndividualRects := areaOfIndividualRects + thisRectangle area.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1666
		]
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1667
	    ]
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1668
	].
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
  1669
    ].
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
  1670
2662
267bc0a1042c comments
Claus Gittinger <cg@exept.de>
parents: 2612
diff changeset
  1671
    "/ if there are many rectangles for this view,
267bc0a1042c comments
Claus Gittinger <cg@exept.de>
parents: 2612
diff changeset
  1672
    "/ or the bounding rectangles area is not too much
267bc0a1042c comments
Claus Gittinger <cg@exept.de>
parents: 2612
diff changeset
  1673
    "/ bigger, replace by a single rectangle
267bc0a1042c comments
Claus Gittinger <cg@exept.de>
parents: 2612
diff changeset
  1674
2470
0a7b3943ce90 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1675
    (nDamagesForView > 10
0a7b3943ce90 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1676
    or:[bounds notNil 
2733
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1677
	and:[(areaOfIndividualRects * 1.5) > bounds area]])  ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1678
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1679
	"/ remove all other damages for this view ...
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1680
	1 to:sz do:[:idx |
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1681
	    aDamage := damage at:idx.
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1682
	    aDamage notNil ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1683
		(aDamage isDamageForView:aView) ifTrue:[
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1684
		    damage at:idx put:nil
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1685
		]
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1686
	    ].
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1687
	].
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1688
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1689
	r := bounds.
2470
0a7b3943ce90 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1690
    ].
0a7b3943ce90 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  1691
2662
267bc0a1042c comments
Claus Gittinger <cg@exept.de>
parents: 2612
diff changeset
  1692
    "/ add the new damage
1312
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1693
    newEvent := WindowEvent damageFor:aView rectangle:r.
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1694
    damage add:newEvent.
92570edec99c try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1695
2469
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1696
    ^ true.
faf22c6b0746 rectangle merging simplified.
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
  1697
2725
607fdf1b833e allow terminate of a dead-process window.
Claus Gittinger <cg@exept.de>
parents: 2717
diff changeset
  1698
    "Modified: / 23.5.1999 / 17:39:38 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1699
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1700
428
33156201125b added #hasConfigureEvent
werner
parents: 386
diff changeset
  1701
damage
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1702
    "return the damage event list"
428
33156201125b added #hasConfigureEvent
werner
parents: 386
diff changeset
  1703
33156201125b added #hasConfigureEvent
werner
parents: 386
diff changeset
  1704
    ^ damage.
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1705
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1706
    "Modified: 18.1.1997 / 14:11:08 / cg"
428
33156201125b added #hasConfigureEvent
werner
parents: 386
diff changeset
  1707
!
33156201125b added #hasConfigureEvent
werner
parents: 386
diff changeset
  1708
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1709
nextDamage
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1710
    "retrieve the next damage (either expose or resize event)
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1711
     or nil, if there is none. Remove it from the queue."
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1712
2437
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1713
    |d|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1714
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1715
    damage size == 0 ifTrue:[^ nil].
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1716
2437
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1717
    "
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1718
     be careful: events are inserted at higher prio ...
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1719
    "
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1720
    self criticalDamageEventQueueAccess:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1721
	|foundOne|
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1722
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1723
	foundOne := false.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1724
	[foundOne] whileFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1725
	    damage size == 0 ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1726
		foundOne := true
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1727
	    ] ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1728
		d := damage removeFirst.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1729
		foundOne := d notNil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1730
	    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1731
	]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1732
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1733
    ^ d
476
cc4848695a66 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
  1734
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1735
    "Modified: / 6.6.1998 / 21:10:27 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1736
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1737
2408
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1738
nextDamageEventFor:aViewOrNil
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1739
    "retrieve the next damage event for aView (or any view if nil).
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1740
     Return if there are no damage events.
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1741
     Remove it from the queue."
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1742
2437
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1743
    |theEvent|
2431
4304b047a42f oops - damage queue grew over time (slowing down event handling)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1744
2408
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1745
    damage size == 0 ifTrue:[^ nil].
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1746
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1747
    "
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1748
     be careful: events are inserted at higher prio ...
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1749
    "
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1750
    self criticalDamageEventQueueAccess:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1751
	|anEvent idx damageSize firstNonNilIndex|
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1752
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1753
	idx := 1.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1754
	damageSize := damage size.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1755
	[idx <= damageSize] whileTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1756
	    anEvent := damage at:idx.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1757
	    anEvent notNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1758
		firstNonNilIndex isNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1759
		    firstNonNilIndex := idx
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1760
		].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1761
		(aViewOrNil isNil or:[anEvent view == aViewOrNil]) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1762
		    damage at:idx put:nil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1763
		    theEvent := anEvent.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1764
		    idx := damageSize.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1765
		].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1766
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1767
	    idx := idx + 1.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1768
	].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1769
	firstNonNilIndex isNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1770
	    damage removeAll
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1771
	] ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1772
	    firstNonNilIndex ~~ 1 ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1773
		damage removeFromIndex:1 toIndex:(firstNonNilIndex-1)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1774
	    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1775
	]
2408
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1776
    ].
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1777
2437
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1778
    ^ theEvent
2408
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1779
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1780
    "Created: / 3.12.1998 / 13:41:49 / cg"
2439
358644786358 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2437
diff changeset
  1781
    "Modified: / 5.2.1999 / 20:58:20 / cg"
2408
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1782
!
dd4371ba92e1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2397
diff changeset
  1783
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1784
nextEvent
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1785
    "retrieve the next event or nil, if there is none.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1786
     Remove it from the queue."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1787
2437
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1788
    |e|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1789
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1790
    mouseAndKeyboard size == 0 ifTrue:[^ nil].
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1791
2437
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1792
    "
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1793
     be careful: events are inserted at higher prio ...
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1794
    "
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1795
    self criticalUserEventQueueAccess:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1796
	|foundOne|
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1797
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1798
	foundOne := false.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1799
	[foundOne] whileFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1800
	    mouseAndKeyboard size == 0 ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1801
		foundOne := true
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1802
	    ] ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1803
		e := mouseAndKeyboard removeFirst.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1804
		foundOne := e notNil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1805
	    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1806
	]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1807
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1808
    ^ e
476
cc4848695a66 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
  1809
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1810
    "Modified: / 6.6.1998 / 21:10:39 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1811
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1812
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1813
nextExposeEventFor:aView
1806
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1791
diff changeset
  1814
    "retrieve the next expose event for aView (or any view if nil).
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1791
diff changeset
  1815
     Return if there are no expose events.
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1816
     Remove it from the queue."
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1817
2437
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1818
    |theEvent|
2432
d4daad924fbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2431
diff changeset
  1819
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1820
    damage size == 0 ifTrue:[^ nil].
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1821
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1822
    "
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1823
     be careful: events are inserted at higher prio ...
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1824
    "
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1825
    self criticalDamageEventQueueAccess:[
2810
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1826
        |firstNonNilIndex anEvent idx damageSize|
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1827
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1828
        idx := 1.
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1829
        damageSize := damage size.
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1830
        [idx <= damageSize] whileTrue:[
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1831
            anEvent := damage at:idx.
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1832
            anEvent notNil ifTrue:[
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1833
                firstNonNilIndex isNil ifTrue:[
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1834
                    firstNonNilIndex := idx
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1835
                ].
2733
5af2417bc450 pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1836
                
2810
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1837
                anEvent isConfigureEvent ifTrue:[
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1838
                    (aView isNil or:[anEvent view == aView]) ifTrue:[
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1839
                        ^ nil
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1840
                    ]   
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1841
                ].
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1842
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1843
                anEvent isDamage ifTrue:[
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1844
                    (aView isNil or:[anEvent view == aView]) ifTrue:[
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1845
                        theEvent := anEvent.
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1846
                        damage at:idx put:nil.
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1847
                        idx := damageSize.
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1848
                    ]
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1849
                ].
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1850
            ].
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1851
            idx := idx + 1.
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1852
        ].
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1853
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1854
        firstNonNilIndex isNil ifTrue:[
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1855
            damage removeAll
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1856
        ] ifFalse:[
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1857
            firstNonNilIndex ~~ 1 ifTrue:[
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1858
                damage removeFromIndex:1 toIndex:(firstNonNilIndex-1)
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1859
            ]
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  1860
        ].
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1861
    ].
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1862
2437
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1863
    ^ theEvent
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1864
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1865
    "Created: / 21.5.1996 / 17:20:54 / cg"
2439
358644786358 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2437
diff changeset
  1866
    "Modified: / 5.2.1999 / 20:58:28 / cg"
703
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1867
!
4324ab5e3630 added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
  1868
140
claus
parents: 133
diff changeset
  1869
pendingEvent
152
claus
parents: 144
diff changeset
  1870
    "retrieve the next pending user (i.e. non-damage) event.
claus
parents: 144
diff changeset
  1871
     Return nil, if there is none pending.
140
claus
parents: 133
diff changeset
  1872
     Do not remove it from the queue."
47
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
  1873
1063
ba1bf8091bc1 unused variable cleanup
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1874
    |e|
47
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
  1875
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1876
    mouseAndKeyboard size == 0 ifTrue:[^ nil].
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1877
2437
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1878
    "
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1879
     be careful: events are inserted at higher prio ...
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1880
    "
2058aceaed41 tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1881
    self criticalUserEventQueueAccess:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1882
	[e isNil] whileTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1883
	    mouseAndKeyboard size == 0 ifTrue:[^ nil].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1884
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1885
	    e := mouseAndKeyboard first.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1886
	    e isNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1887
		mouseAndKeyboard removeFirst
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1888
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1889
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1890
    ].
47
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
  1891
    ^ e
476
cc4848695a66 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 470
diff changeset
  1892
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1893
    "Modified: / 6.6.1998 / 21:10:51 / cg"
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1894
!
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1895
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1896
pushDamageEvent:anEvent
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1897
    "put an event into the damage queue
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1898
     - this is not meant for public use"
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1899
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1900
    self criticalDamageEventQueueAccess:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1901
	damage addLast:anEvent.
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1902
    ].
1851
6a6225647696 fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1903
    self notifyEventArrival:anEvent view
6a6225647696 fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1904
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1905
    "Created: / 18.1.1997 / 14:16:45 / cg"
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1906
    "Modified: / 6.6.1998 / 21:10:56 / cg"
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1907
!
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1908
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1909
pushEvent:anEvent
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1910
    "put an event into the queue - this can also be sent by
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1911
     applications and allows simulation of events 
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1912
     (implementation of recorders & playback)
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1913
     or asynchronous communication between view applications
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1914
     (by sending arbitrary events, which leads to a message sent,
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1915
      when the target windowGroups process is rescheduled)."
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1916
1412
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1917
    |v|
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1918
c2553d477315 handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1919
    v := anEvent view.
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1920
    self criticalUserEventQueueAccess:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  1921
	mouseAndKeyboard addLast:anEvent.
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1922
    ].
1851
6a6225647696 fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents: 1847
diff changeset
  1923
    self notifyEventArrival:v
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1924
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  1925
    "Created: / 18.9.1995 / 22:37:57 / claus"
2157
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  1926
    "Modified: / 18.6.1998 / 09:27:56 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1927
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1928
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1929
!WindowSensor methodsFor:'event simulation'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1930
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1931
forwardKeyEventsTo:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1932
    "remove all keyboard events and send them to aViews sensor instead"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1933
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1934
    1 to:mouseAndKeyboard size do:[:i |
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1935
	|anEvent|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1936
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1937
	anEvent := mouseAndKeyboard at:i.
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1938
	anEvent notNil ifTrue:[
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1939
	    anEvent isKeyEvent ifTrue:[
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1940
		anEvent view:aView.
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1941
		aView sensor pushEvent:anEvent.
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1942
		mouseAndKeyboard at:i put:nil
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1943
	    ]
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1944
	]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1945
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1946
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  1947
    "Modified: 18.1.1997 / 14:05:02 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1948
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1949
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1950
pushUserEvent:aSelector for:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1951
    "manually put an event into the queue - this allows
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1952
     simulation of events (implementation of recorders & playback)
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1953
     or asynchronous communication between view applications.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1954
     The view will perform a method as specified by aSelector,
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1955
     when it performs event processing; this is different than sending
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1956
     this message directly, since the execution is done by the views process,
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1957
     not by the current process (which is especially worthwhile, if that method 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1958
     shows a modal box or similar)."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1959
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1960
     self pushUserEvent:aSelector for:aView withArguments:#() 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1961
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1962
    "Modified: 18.9.1995 / 22:40:12 / claus"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1963
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1964
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1965
pushUserEvent:aSelector for:aView withArguments:arguments
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1966
    "manually put an event into the queue - this allows
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1967
     simulation of events (implementation of recorders & playback)
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1968
     or asynchronous communication between view applications.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1969
     The view will perform a method as specified by aSelector,
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1970
     when it performs event processing; this is different than sending
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1971
     this message directly, since the execution is done by the views process,
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1972
     not by the current process (which is especially worthwhile, if that method 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1973
     shows a modal box or similar)."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1974
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1975
    self pushEvent:(WindowEvent 
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1976
		     for:aView
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1977
		     type:aSelector
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1978
		     arguments:arguments).
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1979
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1980
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1981
     |b|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1982
     b := Button label:'test'.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1983
     b open.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1984
     (Delay forSeconds:5) wait.
1155
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1985
     b sensor pushUserEvent:#pointerEnter:x:y: for:b withArguments:#(0 1 1).
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1986
     (Delay forSeconds:1) wait.
1155
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1987
     b sensor pushUserEvent:#buttonPress:x:y: for:b withArguments:#(1 1 1).
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1988
     (Delay forSeconds:2) wait.
1155
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1989
     b sensor pushUserEvent:#buttonRelease:x:y: for:b withArguments:#(1 1 1).
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1990
     (Delay forSeconds:1) wait.
1155
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1991
     b sensor pushUserEvent:#pointerLeave: for:b withArguments:#(0).
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1992
    "
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1993
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1994
    "
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1995
     |b|
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1996
     b := Button label:'test'.
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1997
     b open.
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1998
     (Delay forSeconds:5) wait.
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  1999
     b sensor pushUserEvent:#fooBar for:b withArguments:#().
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2000
    "
1155
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2001
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2002
    "
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2003
     |b|
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2004
     b := Button label:'test'.
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2005
     b open.
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2006
     (Delay forSeconds:3) wait.
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2007
     b sensor pushUserEvent:#disable for:b withArguments:#().
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2008
    "
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2009
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2010
    "Modified: 4.1.1997 / 13:53:01 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2011
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2012
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2013
!WindowSensor methodsFor:'initialization'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2014
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2015
initialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2016
    "initialize the event queues to empty"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2017
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  2018
    damageEventAccessLock := Semaphore forMutualExclusion.
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  2019
    damageEventAccessLock name:'WSensor ev-q damageEventAccessLock'.
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  2020
    userEventAccessLock := Semaphore forMutualExclusion.
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  2021
    userEventAccessLock name:'WSensor ev-q userEventAccessLock'.
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  2022
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2023
    damage := OrderedCollection new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2024
    mouseAndKeyboard := OrderedCollection new.
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2025
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2026
    gotExpose := IdentitySet new.
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2027
    catchExpose := IdentitySet new.
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2028
    gotOtherEvent := IdentitySet new.
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2029
    exposeEventSemaphore := Semaphore new name:'WSensor exposeSema'.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2030
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2031
    compressMotionEvents := translateKeyboardEvents := true.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2032
    ignoreUserInput := false.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2033
    shiftDown := ctrlDown := altDown := metaDown := false.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2034
    leftButtonDown := middleButtonDown := rightButtonDown := false.
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  2035
2137
cec979de294c now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  2036
    "Modified: / 6.6.1998 / 21:14:49 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2037
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2038
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2039
reinitialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2040
    "called when an image is restarted;
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2041
     reinitialize the event queues to empty; leave other setup as-is"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2042
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2043
    self flushUserEvents.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2044
    self flushExposeEvents.
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2045
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2046
    gotExpose := IdentitySet new.
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2047
    catchExpose := IdentitySet new.
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2048
    gotOtherEvent := IdentitySet new.
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2049
    exposeEventSemaphore := Semaphore new name:'WSensor exposeSema'.
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2050
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2051
    shiftDown := ctrlDown := altDown := metaDown := false.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2052
    leftButtonDown := middleButtonDown := rightButtonDown := false.
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  2053
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  2054
    "Modified: 18.1.1997 / 15:30:23 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2055
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2056
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2057
!WindowSensor methodsFor:'queries - event queue'!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2058
2085
908c3baa4a56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2059
damageCount 
908c3baa4a56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2060
    "return the number of pending damage events (i.e. expose or resize)"
908c3baa4a56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2061
908c3baa4a56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2062
    ^ damage size
908c3baa4a56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2063
908c3baa4a56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2064
    "Modified: / 2.4.1997 / 14:14:01 / cg"
908c3baa4a56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2065
    "Created: / 5.4.1998 / 11:35:04 / cg"
908c3baa4a56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2066
!
908c3baa4a56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2067
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2068
eventPending
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2069
    "return true, if either damage or events are pending"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2070
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2071
    mouseAndKeyboard size ~~ 0 ifTrue:[^ true].
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2072
    ^ damage size ~~ 0
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2073
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2074
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2075
hasButtonEventFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2076
    "return true, if any button events are pending.
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2077
     If the argument, aView is nil, the information is regarding any
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2078
     view (i.e. is there a button event for any of my views);
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2079
     otherwise, the information is regarding that specific view."
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2080
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2081
    (self hasButtonMotionEventFor:aView) ifTrue:[^ true].
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2082
    (self hasButtonPressEventFor:aView) ifTrue:[^ true].
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2083
    ^ (self hasButtonReleaseEventFor:aView)
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2084
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2085
    "Created: 1.11.1996 / 17:02:23 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2086
    "Modified: 1.11.1996 / 17:12:03 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2087
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2088
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2089
hasButtonMotionEventFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2090
    "return true, if any buttonMotion events are pending.
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2091
     If the argument, aView is nil, the information is regarding any
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2092
     view (i.e. is there a motion event for any of my views);
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2093
     otherwise, the information is regarding that specific view."
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2094
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2095
    ^ self hasEvent:#buttonMotion:x:y: orPendingDeviceEvent:#buttonMotion for:aView
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2096
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2097
    "Created: 1.11.1996 / 17:04:01 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2098
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2099
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2100
hasButtonPressEventFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2101
    "return true, if any buttonPress events are pending.
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2102
     If the argument, aView is nil, the information is regarding any
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2103
     view (i.e. is there a buttonPress event for any of my views);
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2104
     otherwise, the information is regarding that specific view."
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2105
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2106
    ^ self hasEvent:#buttonPress:x:y: orPendingDeviceEvent:#buttonPress for:aView
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2107
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2108
    "Created: 1.11.1996 / 17:05:10 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2109
    "Modified: 1.11.1996 / 17:11:09 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2110
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2111
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2112
hasButtonReleaseEventFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2113
    "return true, if any buttonRelease events are pending.
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2114
     If the argument, aView is nil, the information is regarding any
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2115
     view (i.e. is there a buttonrelease event for any of my views);
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2116
     otherwise, the information is regarding that specific view."
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2117
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2118
    ^ self hasEvent:#buttonRelease:x:y: orPendingDeviceEvent:#buttonRelease for:aView
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2119
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2120
    "Created: 1.11.1996 / 17:05:26 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2121
    "Modified: 1.11.1996 / 17:11:18 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2122
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2123
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2124
hasConfigureEventFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2125
    "return true, if any resize/position events are pending.
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2126
     If the argument, aView is nil, the information is regarding any
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2127
     view (i.e. is there a configure event for any of my views);
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2128
     otherwise, the information is regarding that specific view."
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2129
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2130
    ^ self hasEvent:#configureX:y:width:height: orPendingDeviceEvent:#structureNotify for:aView
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2131
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2132
    "Modified: 1.11.1996 / 17:11:27 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2133
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2134
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2135
hasDamage 
1512
489ff9d103a0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1505
diff changeset
  2136
    "return true, if any damage events (i.e. expose or resize) are pending.
489ff9d103a0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1505
diff changeset
  2137
     Since this is often invoked by ST-80 classes to poll the sensor,
489ff9d103a0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1505
diff changeset
  2138
     a yield is done here to avoid a busy wait blocking other processes."
489ff9d103a0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1505
diff changeset
  2139
489ff9d103a0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1505
diff changeset
  2140
    Processor yield.
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2141
    ^ damage size ~~ 0
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2142
1512
489ff9d103a0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1505
diff changeset
  2143
    "Modified: 2.4.1997 / 14:14:01 / cg"
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2144
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2145
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2146
hasDamageFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2147
    "return true, if any damage events (i.e. expose or resize)
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2148
     are pending for aView"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2149
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2150
    damage size ~~ 0 ifTrue:[
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2151
	damage do:[:aDamage |
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2152
	    aDamage notNil ifTrue:[
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2153
		aDamage view == aView ifTrue:[^ true].
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2154
	    ].
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2155
	]
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2156
    ].
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2157
    ^ false
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2158
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2159
    "Modified: 21.5.1996 / 17:15:09 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2160
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2161
2144
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2162
hasEvent:type for:aView
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2163
    "return true, if a specific event is pending in my queues.
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2164
     Type is the type of event, dType the corresponding device event.
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2165
     If the argument, aView is nil, the information is regarding any
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2166
     view (i.e. is there an event for any of my views);
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2167
     otherwise, the information is regarding to that specific view."
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2168
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2169
    mouseAndKeyboard size ~~ 0 ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2170
	mouseAndKeyboard do:[:anEvent |
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2171
	    anEvent notNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2172
		(aView isNil or:[anEvent view == aView]) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2173
		    (type isNil or:[anEvent type == type]) ifTrue:[^ true].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2174
		]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2175
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2176
	]
2144
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2177
    ].
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2178
    damage size ~~ 0 ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2179
	damage do:[:anEvent |
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2180
	    anEvent notNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2181
		(aView isNil or:[anEvent view == aView]) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2182
		    (type isNil or:[anEvent type == type]) ifTrue:[^ true].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2183
		]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2184
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2185
	]
2144
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2186
    ].
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2187
    ^ false
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2188
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2189
    "Created: / 10.6.1998 / 17:33:46 / cg"
2157
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2190
    "Modified: / 18.6.1998 / 09:29:18 / cg"
2144
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2191
!
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2192
1155
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2193
hasEvent:type for:aView withArguments:args 
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2194
    "return true, if a specific event is pending in my queues.
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2195
     Type is the type of event, args are the arguments.
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2196
     If the argument, aView is nil, the information is regarding any
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2197
     view (i.e. is there an event for any of my views);
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2198
     otherwise, the information is regarding to that specific view."
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2199
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2200
    ^ self
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2201
	hasEvent:type 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2202
	for:aView 
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2203
	withMatchingArguments:[:evArgs | evArgs = args]
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2204
!
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2205
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2206
hasEvent:type for:aView withMatchingArguments:argMatchBlock 
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2207
    "return true, if a matching event is pending in my queues.
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2208
     Type is the type of event, matchBlock is a block which gets the event args
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2209
     and should return true.
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2210
     If the argument, aView is nil, the information is regarding any
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2211
     view (i.e. is there an event for any of my views);
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2212
     otherwise, the information is regarding to that specific view."
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2213
1155
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2214
    mouseAndKeyboard size ~~ 0 ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2215
	mouseAndKeyboard do:[:anEvent |
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2216
	    anEvent notNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2217
		(aView isNil or:[anEvent view == aView]) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2218
		    anEvent type == type ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2219
			(argMatchBlock value:anEvent arguments) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2220
			    ^ true
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2221
			].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2222
		    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2223
		]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2224
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2225
	]
1155
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2226
    ].
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2227
    damage size ~~ 0 ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2228
	damage do:[:anEvent |
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2229
	    anEvent notNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2230
		(aView isNil or:[anEvent view == aView]) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2231
		    anEvent type == type ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2232
			(argMatchBlock value:anEvent arguments) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2233
			    ^ true
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2234
			]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2235
		    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2236
		]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2237
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2238
	]
1155
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2239
    ].
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2240
    ^ false
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2241
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2242
    "Modified: 1.11.1996 / 17:11:47 / cg"
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2243
    "Created: 4.1.1997 / 14:00:29 / cg"
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2244
!
e8b6f0e8484e added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  2245
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2246
hasEvent:type orPendingDeviceEvent:dType for:aView
2144
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2247
    "return true, if a specific event is pending in a queue
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2248
     or in the devices event queue.
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2249
     Type is the type of event, dType the corresponding device event.
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2250
     If the argument, aView is nil, the information is regarding any
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2251
     view (i.e. is there an event for any of my views);
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2252
     otherwise, the information is regarding to that specific view."
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2253
2144
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2254
    "/ look in my queues
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2255
    (self hasEvent:type for:aView) ifTrue:[^ true].
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2256
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2257
    aView notNil ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2258
	"/ ask the device if it has something pending
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2259
	^ aView graphicsDevice eventPending:dType for:aView id
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2260
    ].
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2261
    ^ false
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2262
2144
c3bd3dfe592a another event pending query added
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2263
    "Modified: / 10.6.1998 / 17:34:51 / cg"
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2264
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2265
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2266
hasEvents 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2267
    "return true, if any mouse/keyboard events are pending"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2268
2441
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2269
    mouseAndKeyboard size ~~ 0 ifTrue:[^ true].
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2270
    ^ damage size ~~ 0
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2271
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2272
    "Modified: / 5.2.1999 / 22:30:23 / cg"
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2273
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2274
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2275
hasExposeEventFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2276
    "return true, if any exposure events are pending for aView"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2277
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2278
    damage size ~~ 0 ifTrue:[
1271
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2279
	damage do:[:aDamage |
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2280
	    aDamage notNil ifTrue:[
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2281
		aDamage isDamage ifTrue:[
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2282
		    (aView isNil
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2283
		     or:[aDamage view == aView]) ifTrue:[^ true].
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2284
		]
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2285
	    ].
d0a46bba43af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  2286
	]
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2287
    ].
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2288
    ^ false
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2289
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2290
    "Modified: 21.5.1996 / 17:13:09 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2291
    "Created: 1.11.1996 / 17:05:41 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2292
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2293
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2294
hasKeyEventFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2295
    "return true, if any key (press or release) events are pending.
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2296
     If the argument, aView is nil, the information is regarding any
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2297
     view (i.e. is there a key event for any of my views);
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2298
     otherwise, the information is regarding that specific view."
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2299
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2300
    (self hasKeyPressEventFor:aView) ifTrue:[^ true].
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2301
    ^ self hasKeyReleaseEventFor:aView
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2302
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2303
    "Created: 1.11.1996 / 17:08:03 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2304
    "Modified: 1.11.1996 / 17:11:55 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2305
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2306
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2307
hasKeyPressEventFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2308
    "return true, if any keyPress events are pending.
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2309
     If the argument, aView is nil, the information is regarding any
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2310
     view (i.e. is there a keyPress event for any of my views);
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2311
     otherwise, the information is regarding that specific view."
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2312
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2313
    ^ self hasEvent:#keyPress:x:y: orPendingDeviceEvent:#keyPress for:aView
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2314
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2315
    "Created: 1.11.1996 / 17:05:58 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2316
    "Modified: 1.11.1996 / 17:12:10 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2317
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2318
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2319
hasKeyReleaseEventFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2320
    "return true, if any keyRelease events are pending.
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2321
     If the argument, aView is nil, the information is regarding any
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2322
     view (i.e. is there a keyRelease event for any of my views);
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2323
     otherwise, the information is regarding that specific view."
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2324
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2325
    ^ self hasEvent:#keyRelease:x:y: orPendingDeviceEvent:#keyRelease for:aView
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2326
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2327
    "Created: 1.11.1996 / 17:06:34 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2328
    "Modified: 1.11.1996 / 17:12:15 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2329
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2330
2157
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2331
hasUserEvent:type for:aView
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2332
    "return true, if a specific event is pending in my user event queue.
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2333
     Type is the type of event, dType the corresponding device event.
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2334
     If the argument, aView is nil, the information is regarding any
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2335
     view (i.e. is there an event for any of my views);
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2336
     otherwise, the information is regarding to that specific view."
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2337
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2338
    mouseAndKeyboard size ~~ 0 ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2339
	mouseAndKeyboard do:[:anEvent |
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2340
	    anEvent notNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2341
		(aView isNil or:[anEvent view == aView]) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2342
		    (type isNil or:[anEvent type == type]) ifTrue:[^ true].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2343
		]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2344
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2345
	]
2157
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2346
    ].
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2347
    ^ false
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2348
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2349
    "Created: / 17.6.1998 / 12:55:54 / cg"
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2350
    "Modified: / 18.6.1998 / 08:57:00 / cg"
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2351
!
9572f0dd369d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2144
diff changeset
  2352
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2353
hasUserEventFor:aView 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2354
    "return true, if any user event (i.e. key or button events) are pending.
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2355
     If the argument, aView is nil, the information is regarding any
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2356
     view (i.e. is there a user event for any of my views);
1505
e9682a002469 checkin from browser
ca
parents: 1492
diff changeset
  2357
     otherwise, the information is regarding that specific view."
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2358
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2359
    (self hasKeyEventFor:aView) ifTrue:[^ true].
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2360
    ^ (self hasButtonEventFor:aView)
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2361
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2362
    "Created: 1.11.1996 / 17:08:50 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2363
    "Modified: 1.11.1996 / 17:12:21 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2364
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2365
2441
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2366
hasUserEvents 
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2367
    "return true, if any mouse/keyboard events are pending"
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2368
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2369
    ^ mouseAndKeyboard size ~~ 0
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2370
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2371
    "Created: / 5.2.1999 / 22:29:11 / cg"
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2372
!
6925d83b717e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2439
diff changeset
  2373
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2374
motionEventPending 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2375
    "return true, if any buttonMotion events are pending."
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2376
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2377
    ^ self hasButtonMotionEventFor:nil
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2378
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2379
    "Created: 24.3.1996 / 20:09:55 / cg"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2380
    "Modified: 1.11.1996 / 17:04:43 / cg"
2177
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
  2381
!
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
  2382
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
  2383
userEventCount 
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
  2384
    "return the number of pending user events"
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
  2385
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
  2386
    ^ mouseAndKeyboard size
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
  2387
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
  2388
    "Modified: / 21.7.1998 / 18:52:19 / cg"
22bc7dd353b4 added #userEventCount query
Claus Gittinger <cg@exept.de>
parents: 2163
diff changeset
  2389
    "Created: / 21.7.1998 / 19:36:04 / cg"
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2390
! !
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2391
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2392
!WindowSensor methodsFor:'queries - key & button state'!
140
claus
parents: 133
diff changeset
  2393
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2394
altDown
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2395
    "return true, if the meta key is currently pressed.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2396
     Notice, that some keyboards dont have an alt key;
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2397
     it is better to use 'sensor metaDown or:[sensor altDown]'."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2398
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2399
    ^ altDown
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2400
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2401
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2402
anyButtonPressed
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2403
    "ST-80 compatibility: return true, if any mouse button is pressed.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2404
     You should no use it in 'normal' applications.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2405
     Instead, keep track of the buttons state in your views or controllers
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2406
     button-event methods."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2407
1083
6e947cc67324 fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  2408
    ^ leftButtonDown or:[middleButtonDown or:[rightButtonDown]]
6e947cc67324 fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  2409
6e947cc67324 fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  2410
    "Modified: 21.10.1996 / 11:37:31 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2411
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2412
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2413
blueButtonPressed
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2414
    "ST-80 compatibility: return true, if the right mouse button is pressed.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2415
     You should no use it in 'normal' applications.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2416
     Instead, keep track of the buttons state in your views or controllers
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2417
     button-event methods."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2418
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2419
    ^ rightButtonDown
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2420
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2421
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2422
ctrlDown
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2423
    "return true, if any CTRL key is currently pressed."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2424
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2425
    ^ ctrlDown
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2426
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2427
157
claus
parents: 154
diff changeset
  2428
leftButtonPressed
claus
parents: 154
diff changeset
  2429
    "return true, if the left mouse button is pressed.
claus
parents: 154
diff changeset
  2430
     This has been added to support ST-80 style button polling;
claus
parents: 154
diff changeset
  2431
     however, you should no use it in 'normal' applications.
claus
parents: 154
diff changeset
  2432
     Instead, keep track of the buttons state in your views or controllers
claus
parents: 154
diff changeset
  2433
     button-event methods."
claus
parents: 154
diff changeset
  2434
claus
parents: 154
diff changeset
  2435
    ^ leftButtonDown
claus
parents: 154
diff changeset
  2436
!
claus
parents: 154
diff changeset
  2437
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2438
metaDown
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2439
    "return true, if the meta key is currently pressed.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2440
     Notice, that most keyboards dont have a meta key;
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2441
     it is better to use 'sensor metaDown or:[sensor altDown]'."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2442
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2443
    ^ metaDown
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2444
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2445
157
claus
parents: 154
diff changeset
  2446
middleButtonPressed
claus
parents: 154
diff changeset
  2447
    "return true, if the middle mouse button is pressed.
claus
parents: 154
diff changeset
  2448
     This has been added to support ST-80 style button polling;
claus
parents: 154
diff changeset
  2449
     however, you should no use it in 'normal' applications.
claus
parents: 154
diff changeset
  2450
     Instead, keep track of the buttons state in your views or controllers
claus
parents: 154
diff changeset
  2451
     button-event methods."
claus
parents: 154
diff changeset
  2452
claus
parents: 154
diff changeset
  2453
    ^ middleButtonDown
claus
parents: 154
diff changeset
  2454
!
claus
parents: 154
diff changeset
  2455
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2456
redButtonPressed
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2457
    "ST-80 compatibility: return true, if the left mouse button is pressed.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2458
     You should no use it in 'normal' applications.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2459
     Instead, keep track of the buttons state in your views or controllers
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2460
     button-event methods."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2461
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2462
    ^ leftButtonDown
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2463
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2464
157
claus
parents: 154
diff changeset
  2465
rightButtonPressed
claus
parents: 154
diff changeset
  2466
    "return true, if the right mouse button is pressed.
claus
parents: 154
diff changeset
  2467
     This has been added to support ST-80 style button polling;
claus
parents: 154
diff changeset
  2468
     however, you should no use it in 'normal' applications.
claus
parents: 154
diff changeset
  2469
     Instead, keep track of the buttons state in your views or controllers
claus
parents: 154
diff changeset
  2470
     button-event methods."
claus
parents: 154
diff changeset
  2471
claus
parents: 154
diff changeset
  2472
    ^ rightButtonDown
claus
parents: 154
diff changeset
  2473
!
claus
parents: 154
diff changeset
  2474
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2475
shiftDown
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2476
    "return true, if any shift key is currently pressed."
157
claus
parents: 154
diff changeset
  2477
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2478
    ^ shiftDown
157
claus
parents: 154
diff changeset
  2479
!
claus
parents: 154
diff changeset
  2480
claus
parents: 154
diff changeset
  2481
yellowButtonPressed
claus
parents: 154
diff changeset
  2482
    "ST-80 compatibility: return true, if the middle mouse button is pressed.
claus
parents: 154
diff changeset
  2483
     You should no use it in 'normal' applications.
claus
parents: 154
diff changeset
  2484
     Instead, keep track of the buttons state in your views or controllers
claus
parents: 154
diff changeset
  2485
     button-event methods."
claus
parents: 154
diff changeset
  2486
claus
parents: 154
diff changeset
  2487
    ^ middleButtonDown
140
claus
parents: 133
diff changeset
  2488
! !
claus
parents: 133
diff changeset
  2489
1100
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2490
!WindowSensor methodsFor:'queries - pointer'!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2491
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2492
cursorPoint
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2493
    "ST-80 compatibility: 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2494
     return the position of the mouse pointer on the current display
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2495
     (in screen coordinates)"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2496
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2497
     ^ self class cursorPoint
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2498
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2499
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2500
globalOrigin 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2501
    "ST-80 compatibility: 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2502
     dont know what we should return here ...
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2503
     ... at least the PD program which uses it works when we return 0@0."
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2504
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2505
     ^ 0@0
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2506
!
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2507
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2508
mousePoint
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2509
    "ST-80 compatibility: 
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2510
     return the position of the mouse pointer on the current display
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2511
     (in screen coordinates)"
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2512
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2513
     ^ self cursorPoint
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2514
! !
70e93fc002cb more event query methods;
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  2515
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
  2516
!WindowSensor methodsFor:'special'!
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
  2517
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  2518
catchExposeFor:aView
54
29a6b2f8e042 *** empty log message ***
claus
parents: 47
diff changeset
  2519
    "start catching noExpose events (must be done BEFORE a bitblt,
29a6b2f8e042 *** empty log message ***
claus
parents: 47
diff changeset
  2520
     to prepare for the exposeEventSemaphore to be signalled when 
29a6b2f8e042 *** empty log message ***
claus
parents: 47
diff changeset
  2521
     the noExpose event arrives)."
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
  2522
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2523
    "/ this is only needed for X ...
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2524
    aView device scrollsAsynchronous ifFalse:[
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2525
	^ self
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2526
    ].
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2527
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2528
    (catchExpose includes:aView) ifTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2529
	('WSensor [warning]: already catching (for ' , aView printString , ')') errorPrintCR.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2530
	Delay waitForMilliseconds:100.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2531
	(catchExpose includes:aView) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2532
	    ('WSensor [warning]: still catching (for ' , aView printString , ')') errorPrintCR.
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2533
	    "/ wake the other one
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2534
	    gotExpose add:aView.
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2535
	    exposeEventSemaphore signalForAll.
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2536
	    Delay waitForMilliseconds:100.
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2537
	].
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  2538
    ].
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  2539
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2540
    [
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2541
	gotOtherEvent remove:aView ifAbsent:nil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2542
	gotExpose remove:aView ifAbsent:nil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2543
	catchExpose add:aView.
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
  2544
    ] valueUninterruptably.
28
3879ff2138f1 *** empty log message ***
claus
parents: 27
diff changeset
  2545
!
3879ff2138f1 *** empty log message ***
claus
parents: 27
diff changeset
  2546
1320
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2547
pollForActivity
1529
cf81e3de53e0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  2548
    "ST-80 compatibility: wait for some activity (i.e. poll for an event) "
1320
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2549
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2550
    "/ should add a buttonStateChangeSemaphore and wait on this ...
1529
cf81e3de53e0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  2551
"/    Delay waitForSeconds:0.01.
cf81e3de53e0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  2552
    Processor yield.
cf81e3de53e0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  2553
cf81e3de53e0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  2554
    "Modified: 12.2.1997 / 12:46:09 / cg"
1320
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2555
!
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2556
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2557
waitButton
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2558
    "ST-80 compatibility: wait until any mouse button is pressed.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2559
     Do not use this in your applications; polling the sensor is
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2560
     bad style."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2561
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2562
    [self anyButtonPressed] whileFalse:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2563
	self pollForActivity
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2564
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2565
1320
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2566
    "Modified: 10.2.1997 / 13:30:38 / cg"
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2567
!
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2568
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2569
waitClickButton
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2570
    "ST-80 compatibility: wait until any mouse button is pressed & released again.
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2571
     Do not use this in your applications; polling the sensor is
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2572
     bad style."
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2573
1790
a7f42261ab45 need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents: 1734
diff changeset
  2574
    self waitButton.
1320
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2575
    ^self waitNoButton
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2576
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2577
    "Created: 10.2.1997 / 13:31:09 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2578
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2579
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
  2580
waitForExposeFor:aView
157
claus
parents: 154
diff changeset
  2581
    "wait until a graphicsExpose or a noExpose arrives (after a bitblt).
claus
parents: 154
diff changeset
  2582
     This may be too X-specific, and things may change in this area
claus
parents: 154
diff changeset
  2583
     in future versions. (or the new device may simulate the arrival of
claus
parents: 154
diff changeset
  2584
     such an event)"
54
29a6b2f8e042 *** empty log message ***
claus
parents: 47
diff changeset
  2585
2704
1698640c9da6 shortened wait for expose event under win32
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2586
    |blocked lostExpose device stopPoll endPollTime pollDelay pollDelay2|
1873
a67649816bc8 break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents: 1864
diff changeset
  2587
a67649816bc8 break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents: 1864
diff changeset
  2588
    device := aView graphicsDevice.
1359
ab88659a5000 Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents: 1340
diff changeset
  2589
1873
a67649816bc8 break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents: 1864
diff changeset
  2590
    device scrollsAsynchronous ifFalse:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2591
	gotExpose remove:aView ifAbsent:nil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2592
	catchExpose remove:aView ifAbsent:nil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2593
	^ self
1027
0ba82862ca8d fixes for synchronous scrolling (WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
  2594
    ].
0ba82862ca8d fixes for synchronous scrolling (WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
  2595
1359
ab88659a5000 Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents: 1340
diff changeset
  2596
    blocked := true.
1013
32d804ff472d cleanup when unwinding from a waitForExpose
Claus Gittinger <cg@exept.de>
parents: 1012
diff changeset
  2597
    [
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2598
	aView flush.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2599
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2600
	device platformName = 'WIN32' ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2601
	    "/ since this is definitely a local display,
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2602
	    "/ there is no need for a long timeOut
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2603
	    "/ (it should arrive fast)
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2604
	    pollDelay := 0.2.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2605
	    pollDelay2 := 0.1.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2606
	] ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2607
	    pollDelay := 3.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2608
	    pollDelay2 := 1.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2609
	].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2610
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2611
	Processor activeProcessIsSystemProcess ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2612
	    endPollTime := AbsoluteTime now addSeconds:pollDelay.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2613
	    stopPoll := false.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2614
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2615
	    "/
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2616
	    "/ cannot really suspend, if its a systemProcess
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2617
	    "/ must poll for the event
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2618
	    "/
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2619
	    [(gotExpose includes:aView) or:[stopPoll]] whileFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2620
		(device exposeEventPendingFor:aView id withSync:true) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2621
		    device dispatchExposeEventFor:aView id.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2622
		].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2623
		stopPoll := (AbsoluteTime now > endPollTime).
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2624
		Processor yield.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2625
	    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2626
	] ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2627
	    lostExpose := 1.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2628
	    "
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2629
	      block interrupt here, to resolve race between
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2630
	      testing gotExpose and the semaphore, which is woken up
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2631
	      with #signalForAll.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2632
	    "
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2633
	    blocked := OperatingSystem blockInterrupts.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2634
	    [ (gotExpose includes:aView) or:[lostExpose > 2] ] whileFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2635
		"
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2636
		 just in case we have a (network or software) problem ...
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2637
		 explanation: it may happen, that an expose event is totally
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2638
		 lost - for example, if the network breaks down.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2639
		 To not block forever, we wait with a timeout, to get out of here
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2640
		 if the event does not arrive after a few seconds.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2641
		"
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2642
		(exposeEventSemaphore waitWithTimeout:(pollDelay2 * lostExpose)) isNil ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2643
		    device flush.         "/ we are paranoid
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2644
		    lostExpose := lostExpose + 1.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2645
		].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2646
	    ].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2647
	    (gotExpose includes:aView) ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2648
		('WindowSensor [warning]: lost expose event (' , aView printString , ')') errorPrintCR.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2649
	    ] ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2650
		lostExpose > 1 ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2651
		    ('WindowSensor [info]: late expose event (' , aView printString , ')') infoPrintCR.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2652
		]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2653
	    ]
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2654
	].
1013
32d804ff472d cleanup when unwinding from a waitForExpose
Claus Gittinger <cg@exept.de>
parents: 1012
diff changeset
  2655
    ] valueNowOrOnUnwindDo:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2656
	gotExpose remove:aView ifAbsent:nil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2657
	catchExpose remove:aView ifAbsent:nil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2658
	blocked ifFalse:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2659
	    OperatingSystem unblockInterrupts.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2660
	].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2661
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2662
	"/
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2663
	"/ other incoming events have been ignored during the wait.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2664
	"/ Now handle those ...
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2665
	"/
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2666
	(gotOtherEvent includes:aView) ifTrue:[
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2667
	    gotOtherEvent remove:aView ifAbsent:nil.
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2668
	].
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2669
	eventSemaphore signalOnce
1013
32d804ff472d cleanup when unwinding from a waitForExpose
Claus Gittinger <cg@exept.de>
parents: 1012
diff changeset
  2670
    ].
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 19
diff changeset
  2671
2421
037f43af3b0e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2672
    "Modified: / 20.2.1997 / 09:24:31 / stefan"
2704
1698640c9da6 shortened wait for expose event under win32
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2673
    "Modified: / 21.5.1999 / 16:27:10 / cg"
47
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
  2674
!
209bc432e4e3 last version with separate queue
claus
parents: 46
diff changeset
  2675
157
claus
parents: 154
diff changeset
  2676
waitNoButton
claus
parents: 154
diff changeset
  2677
    "ST-80 compatibility: wait until no mouse button is pressed.
claus
parents: 154
diff changeset
  2678
     Do not use this in your applications; polling the sensor is
claus
parents: 154
diff changeset
  2679
     bad style."
claus
parents: 154
diff changeset
  2680
claus
parents: 154
diff changeset
  2681
    [self anyButtonPressed] whileTrue:[
2717
2b5a28c6585e added deltaTime to mouseWheel message
Claus Gittinger <cg@exept.de>
parents: 2708
diff changeset
  2682
	self pollForActivity
157
claus
parents: 154
diff changeset
  2683
    ].
1241
c65f1c9d8de4 use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
  2684
1320
478840db1666 more ST80 stuff
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
  2685
    "Modified: 10.2.1997 / 13:30:43 / cg"
157
claus
parents: 154
diff changeset
  2686
! !
claus
parents: 154
diff changeset
  2687
1082
44d671491f5e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
  2688
!WindowSensor class methodsFor:'documentation'!
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  2689
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  2690
version
2810
f2a85b827478 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2787
diff changeset
  2691
    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.162 1999-07-26 07:32:32 cg Exp $'
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  2692
! !
140
claus
parents: 133
diff changeset
  2693
WindowSensor initialize!