|
Class: WindowSensor
Object
|
+--WindowSensor
|
+--SynchronousWindowSensor
- Package:
- stx:libview
- Category:
- Interface-Support-UI
- Version:
- rev:
1.388
date: 2024/04/28 08:09:53
- user: cg
- file: WindowSensor.st directory: libview
- module: stx stc-classLibrary: libview
Instances of this class keep track of events and damage areas for a group of
views. All incoming expose rectangles and events (from Workstation) are
collected here, until someone (usually the windowGroup process)
gets a chance to handle them.
In contrast to ST-80 (which has one windowSensor per window), ST/X usually
only assigns one sensor per windowGroup.
(however, you could manually arrange for per view private sensors - at least, theoretically)
When adding an expose rectangle, WindowSensor tries to merge the rectangle
with the list of existing damages to minimize redrawing.
Processing of compose key sequences is done here; if a Compose
key event arrives, the following 2 characters are used to search an
entry in the composeTable, and are replaced by the character found there.
For example, pressing Compose-a-` gives the french a-accent-grave character;
pressing Compose-a-e gives the ae ligature.
Beside the above, windowSensors provide facilities (hooks) to allow
so-called 'eventListeners' to get the event before it is entered into
the queue. There are 4 possible listening hooks available:
global EventListener - get keybd/mouse/focus/enter-leave events for all views and all displays
per-display eventListener - gets only keybd/mouse/focus/enter-leave events for one display (see GraphicsDevice)
per-sensor eventListener - gets only keybd/mouse/focus/enter-leave events for this sensor's windowGroup
per-sensor keyboardListener - only gets keyboard events for this sensor's windowGroup
(actually, there are two more mechanisms, event delegation which allows
delegation of key- and buttonEvents of a specific view,
and per-windowGroup eventHooks)
Global eventListeners are installed via a class method (addEventListener:) to
the WindowSensor class; local listeners are installed via instance methods.
A listener may return true to signal that it has handled the event and that the
event should NOT be enqueued.
Likewise, if it returns false, the event is processed as usual
(i.e. enqueued and forwarded to the view's controller).
If there are multiple listeners, all of them get a chance to process the event,
but it will not be enqueued, if any returned true.
The global listeners are called before any local listener, which are called
before any keyboard listeners.
If any listener-group has eaten the event, later (local) listeners wont get the event.
EventListeners have been added to allow the implementation of event recorders,
screen savers or other spy functionality.
They also allow hooking up views which otherwise insist on doing things themself.
Notice, that beside event listening, you can also define a delegate for
a view's keyboard and button events.
Read the documentation in WindowEvent for more info.
NOTICE: in previous releases, only one listener was allowed, which was notified
via #buttonPress/#buttonRelease ... invocations.
We have changed this to allow multiple handlers, and also to pass the event to a single
#handleEvent method.
[instance variables:]
eventSemaphore <Semaphore> the semaphore to be signalled when an event
(or damage) arrives
damage <Collection> collection of damage events
mouseAndKeyboard <Collection> collection of user events
compressMotionEvents <Boolean> if true, multiple motion events are
compressed to one event. If false, each
event is handled individual.
(should be set to false when doing free-hand drawing)
ignoreUserInput <Boolean> if true, key & button events are ignored
(usually set to true by WindowGroup, while a
modalbox covers a view)
shiftDown <Boolean> true while shift/meta/control-key is pressed
metaDown (to support ST-80 style query: sensor shiftDown)
ctrlDown
altDown (notice, that on most systems, alt and meta key is
the same, both reported as #Alt)
exposeEventSemaphore <Semaphore> X-special: semaphore to be signalled when
expose event arrives after a copyArea.
catchExpose <SetOfView> if nonEMpty, the drawables which wait for
an expose/noExpose event. (after a copyArea)
gotExpose <SetOfView> the set of drawables which got an expose/noExpose
event. (after a copyarea)
gotOtherEvent <SetOfView> set of drawables which received if other events,
while waiting for expose (after a copyarea).
translateKeyboardEvents <Boolean> if true, keyboard events are translated via
the devices leyboardMap; if false, they
are reported as raw-keys. Default is true.
eventListeners <Collection> Collection of new event listeners.
Each will be sent a #handleEvent: message.
The event will not be enqueued, if any returns
true.
accessLock <Semaphore> controls access to the event queues
[class variables:]
ControlCEnabled <Boolean> if true (which is the default) Control-C
will interrupt the process handling the
view.
For secure stand-alone applications,
this can be set to false, in which case
Control-C does NOT interrupt the process.
(actually, Control-C is wrong here; the actual
key is #UserInterrupt, which may be mapped onto
any key)
ControlYEnabled <Boolean> if true (which is the default) Control-Y
will raise the abortSignal in the process
handling the view.
This can be used to abort a long operation
(such as a long fileRead in the fileBrowser)
without entering the debugger.
(actually, Control-Y is wrong here; the actual
key is #UserAbort, which may be mapped onto
any key)
EventListeners <Collection> Collection of new event listeners.
Each will be sent a #handleEvent: message.
The event will not be enqueued, if any returns
true.
ComposeTable <Array> compose-key translation table
copyrightCOPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
accessing
-
addEventListener: aListener
-
add a global eventListener (with new protocol - #handleEvent:)
This one gets a chance to intercept all events for ANY sensor
(i.e. any view on any device).
Warning: the listener gets invoked synchronously, directly from the
display event dispatcher. It shall not terminate or block the system for long.
See documentation for what this can be used for
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
addSynchronousEventListener: aListener
-
add a global eventListener (with new protocol - #handleEvent:)
This one gets a chance to intercept all events for ANY sensor
(i.e. any view on any device).
Warning: the listener gets invoked synchronously, directly from the
display event dispatcher. It shall not terminate or block the system for long.
See documentation for what this can be used for
-
composeTable
-
return the compose-key table.
Entries consist of 3-element arrays each, where
the first two entries (of each entry) are the raw characters,
and the third is the resulting composed-key
-
composeTable: aTable
-
set the compose-key table.
Entries consist of 3-element arrays each, where
the first two entries (of each entry) are the raw characters,
and the third is the resulting composed-key
-
controlCEnabled: aBoolean
-
enable/disable Control-C processing.
If enabled, pressing CNTL-C in a view will interrupt it and bring
its process into the debugger (actually raising a UserInterrupt signal).
Otherwise, CNTL-C is sent to the view like any other key.
The default is true (enabled).
Be very careful - only disable CNTL-C handling for well-debugged
applications ... however, even if disabled, there still is the CNTL-C
key on the startup (x)-terminal window (which can also be disabled).
-
controlPeriodEnabled: aBoolean
-
enable/disable Control-. processing.
If enabled, pressing CNTL-. is handled like UserInterrupt and will usually interrupt it.
Notice, that this flag only controls the translation of CTRL-. to CTRL-C;
UserInterrupts may still be disabled by other flags.
-
deadKeyEatsSpace
-
return true if dead-key space should eat the space
Usage example(s):
WindowSensor deadKeyEatsSpace
|
-
deadKeyEatsSpace: aBoolean
-
return true if dead-key space should eat the space
Usage example(s):
WindowSensor deadKeyEatsSpace:false
WindowSensor deadKeyEatsSpace:true
|
-
deadKeyLanguage
-
return the per language default for deadKey handling.
(see CharacterArray)
Usage example(s):
WindowSensor deadKeyLanguage
WindowSensor deadKeyLanguage:'de'.
WindowSensor deadKeyLanguage:nil.
WindowSensor deadKeyLanguage:'fr'.
|
-
deadKeyLanguage: aLanguageString
-
set to only use per-language dead keys
(see CharacterArray).
If set to nil, you all dead keys will be recognized;
if set to a language ('de', 'fr', 'es', 'nl', etc),
only deadkeys relevant for that language are recognized.
This is work in progress.
Usage example(s):
WindowSensor deadKeyLanguage:nil.
WindowSensor deadKeyLanguage:'de'.
WindowSensor deadKeyLanguage:'fr'.
|
-
deadKeysEnabled
-
return the default for deadKey handling.
Usage example(s):
WindowSensor deadKeysEnabled
|
-
deadKeysEnabled: aBoolean
-
set the default for deadKey handling.
Usage example(s):
WindowSensor deadKeysEnabled:true.
WindowSensor deadKeysEnabled:false.
|
-
eventListeners
-
-
removeEventListener: aListener
-
remove a global eventListener (with new protocol - #handleEvent:)
- see documentation for what this can be used for
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
removeSynchronousEventListener: aListener
-
remove a global eventListener (with new protocol - #handleEvent:)
- see documentation for what this can be used for
event processing
-
postViewCreateNotification: aView
-
invoked right before a new view is created.
Notify listeners and allow for the origin/extent to be
changed. (For example, recorder/playback applications may
want to make certain that the playback view is at the same
position - or record any origin changes to translate later
synthetic events).
-
preViewCreateNotification: aView
-
invoked right before a new view is created.
Notify listeners and allow for the origin/extent to be
changed. (For example, recorder/playback applications may
want to make certain that the playback view is at the same
position - or record any origin changes to translate later
synthetic events).
initialization
-
initialize
-
initialize the classes constants
Usage example(s):
self initializeComposeKeyTable
|
Usage example(s):
-
initializeComposeKeyTable
-
setup the composeKey table
Usage example(s):
WindowSensor initializeComposeKeyTable
|
-
mouseWheelScale
-
if set, mouse wheel motions are scaled by this number
-
mouseWheelScale: aNumber
-
if set, mouse wheel motions are scaled by this number
-
mouseWheelThreshold
-
if set, mouse wheel motions are only reported if the scaled amount is above this
instance creation
-
new
-
return a new initialized instance
queries
-
cursorPoint
-
ST-80 compatibility:
return the position of the cursor on the current display.
Usage example(s):
Compatibility-ST80
-
blueButtonPressed
-
ST-80 compatibility: return true, if the right mouse button is pressed.
You should no use it in 'normal' applications.
Instead, keep track of the buttons state in your views or controllers
button-event methods.
-
eventQuit: event
-
ST-80 compatibility:
push an event for terminating the topViews application
-
mousePointForEvent: anEvent
( an extension from the stx:libcompat package )
-
-
redButtonPressed
-
ST-80 compatibility: return true, if the left mouse button is pressed.
You should no use it in 'normal' applications.
Instead, keep track of the buttons state in your views or controllers
button-event methods.
-
yellowButtonPressed
-
ST-80 compatibility: return true, if the middle mouse button is pressed.
You should no use it in 'normal' applications.
Instead, keep track of the buttons state in your views or controllers
button-event methods.
accessing
-
addEventListener: aListener
-
add a local eventListener (with new protocol - #processEvent:)
This one gets a chance to intercept all events for this sensor
(i.e. for this windowGroup).
Warning: the listener gets invoked synchronously, directly from the
display event dispatcher. It shall not terminate or block the system for long.
See documentation for what this can be used for
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
addSynchronousEventListener: aListener
-
add a local eventListener (with new protocol - #processEvent:)
This one gets a chance to intercept all events for this sensor
(i.e. for this windowGroup).
Warning: the listener gets invoked synchronously, directly from the
display event dispatcher. It shall not terminate or block the system for long.
See documentation for what this can be used for
-
compressMotionEvents: aBoolean
-
turn on/off motion event compression.
Normally, motion event compression is enabled; however,
applications which want to follow every motion
(i.e. paint-like applications) may want to get them all)
-
deadKeysEnabled
-
return true if deadkeys are enabled (to combine diacriticals)
-
deadKeysEnabled: aBoolean
-
set to true to enable deadkeys (to combine diacriticals)
-
eventSemaphore
-
return the semaphore used to signal event arrival
-
eventSemaphore: aSemaphore
-
set the semaphore used to signal event arrival
-
ignoreExposeEvents: aBoolean
-
turn on/off expose event ignoring
-
ignoreUserInput
-
return true, if user events are currently ignored
-
ignoreUserInput: aBoolean
-
turn on/off ignoring of user events processing.
This can be used to avoid having events queued for a master-view,
while a modal dialog is open for it.
-
lastEvent
-
-
removeAllEventListeners
-
remove all local eventListeners
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
removeAllSynchronousEventListeners
-
remove all local eventListeners
-
removeEventListener: aListener
-
remove a local eventListener (with new protocol - #processEvent:)
- see documentation for what this can be used for
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
removeSynchronousEventListener: aListener
-
remove a local eventListener (with new protocol - #processEvent:)
- see documentation for what this can be used for
accessing-private
-
criticalDamageEventQueueAccess: aBlock
-
perform some action which needs synchronized (exclusive)
access to the damage event queue.
(i.e. protected by a critical region)
-
criticalEventQueueAccess: whichLock do: aBlock
-
perform some action which needs synchronized (exclusive)
access to one of the event queues.
(i.e. protected by a critical region)
-
criticalUserEventQueueAccess: aBlock
-
perform some action which needs synchronized (exclusive)
access to the user event queue.
(i.e. protected by a critical region)
-
damageEventAccessLock
-
return the semaphore which controls access to the damage event queue.
This should probably not be exposed to the public,
so be prepared that this method may vanish.
-
userEventAccessLock
-
return the semaphore which controls access to the mouse and keyboard event queue.
This should probably not be exposed to the public,
so be prepared that this method may vanish.
event flushing
-
compressKeyPressEventsWithKey: aKey
-
count and remove multiple pending keyPress events for the
same key, aKey. This is currently used in TextViews to compress
multiple cursorUp/cursorDown events and do the scroll in one
operation. (to avoid run-after-cursor on slow displays)
-
flushAllEvents
-
-
flushButtonEventsFor: aView
-
throw away all pending mouse button events for aView,
or any view, if the argument is nil.
-
flushEventsFor: aView
-
throw away all events for aView,
or any view, if the argument is nil.
-
flushEventsFor: aViewOrNil inQueue: anEventQueue where: aCondition
-
throw away all pending events in anEventQueue for aView,
for which aCondition returns true.
Or any view for which aCondition returns true, if the argument is nil.
A helper for the various flush entries.
Returns the last flushed event or nil.
-
flushEventsFor: aViewOrNil inQueue: anEventQueue withType: eventType
-
throw away all pending events in anEventQueue for aView,
which have a type of eventType.
A helper for the various flush entries.
Returns the last flushed event or nil.
-
flushEventsFor: aViewOrNil where: aBlock
-
throw away all events for aView, for which aBlock evaluates to true
or any view, if the argument is nil.
-
flushEventsFor: aViewOrNil withType: type
-
throw away all events for aView,
(or any view, if the argument is nil) which have a particular type.
-
flushExposeEvents
-
throw away all pending expose events; this
can be done after a full redraw (or in views, which are
doing full redraws anly)
-
flushExposeEventsFor: aView
-
throw away all pending expose events for aView,
or any view, if the argument is nil.
This can be done after a full redraw
(or in views, which are always doing full redraws -
instead of drawing the clip-area only)
-
flushKeyboard
-
ST-80 compatibility: throw away all pending keyboard events
-
flushKeyboardFor: aView
-
throw away all pending keyboard events for aView,
or any view, if the argument is nil.
-
flushMotionEventsFor: aView
-
throw away all pending motion events for aView,
or for any view, if the argument is nil.
-
flushUserEvents
-
throw away all pending user events (i.e. key & button stuff)
-
flushUserEventsFor: aView
-
throw away all pending user events for aView (i.e. key & button stuff),
or for any view, if the argument is nil.
-
flushUserEventsFor: aView where: aBlock
-
throw away all pending user events (i.e. key & button stuff)
for which aBlock returns true.
For aView or for any view, if the argument is nil.
-
flushUserEventsFor: aView withType: type
-
throw away all pending user events with specified type for aView (i.e. key & button stuff),
or for any view, if the argument is nil.
-
flushUserEventsFor: aView withType: type andArgument: arg
-
throw away all pending user events with specified type for aView (i.e. key & button stuff),
or for any view, if the argument is nil.
-
flushUserEventsFor: aView withType: type withArguments: args
-
throw away all pending user events with specified type for aView (i.e. key & button stuff),
or for any view, if the argument is nil.
-
lastMotionEventFor: aView
-
throw away all pending motion events for aView,
or for any view, if the argument is nil.
Returns the very last (valid) motion event.
event processing
-
buttonMotion: buttonAndModifierState x: x y: y view: aView
-
mouse was moved - this is sent from the device (Display)
-
buttonMultiPress: button x: x y: y view: aView
-
mouse button was pressed - this is sent from the device (Display)
-
buttonPress: button x: x y: y view: aView
-
mouse button was pressed - this is sent from the device (Display)
-
buttonRelease: button x: x y: y view: aView
-
mouse button was released- this is sent from the device (Display)
-
clientMessage: type format: format eventData: data view: aView
-
some other process has sent data to a view.
This is an X-specific event. (see copyDataEvent for win32 variant)
-
configureX: x y: y width: w height: h view: aView
-
a view's size or position has changed - this is sent from the device (Display)
-
copyDataEvent: parameter eventData: data view: aView
-
some other process has sent data to a view.
This is a Win32-specific event. (see clientMessage for x-windows variant)
-
coveredBy: coveringSiblingView view: coveredView
-
aView was covered by one of its siblings - this is sent from the device (Display)
-
createWindow: view x: x y: y width: w height: h
-
A window has been created in a view.
This is a synthetic event, useful for some event recorders
-
destroyedView: aView
-
view was destroyed (from window manager) - this is sent from the device (Display)
-
dropFiles: files view: view position: dropPositionOrNil handle: dropHandleOrNil
-
-
dropMessage: dropType data: dropValue view: targetView position: dropPositionOrNil handle: dropHandleOrNil
-
-
exposeX: left y: top width: width height: height view: aView
-
an expose event arrived - this is sent from the device (Display)
-
focusInView: aView
-
view got input focus - this is sent from the device (Display)
-
focusOutView: aView
-
view lost input focus - this is sent from the device (Display)
-
graphicsExposeX: left y: top width: width height: height final: final view: aView
-
a graphic expose event arrived - this is sent from the device (Display)
-
hotkeyWithId: aHotkeyId key: aKey view: aView
-
hotkey was pressed - this is sent from the device (Display).
-
keyPress: keyIn x: x y: y view: aView
-
key was pressed - this is sent from the device (Display).
beside the keyboard translation, CntlC processing is done here.
-
keyRelease: keyIn x: x y: y view: aView
-
key was released - this is sent from the device (Display).
-
mappedView: aView
-
view was mapped (from window manager) - this is sent from the device (Display)
-
mouseWheelMotion: state x: x y: y amount: amount deltaTime: dTime view: aView
-
mouse-wheel was turned - this is sent from the device (Display)
-
nativeWidgetCommand: command arguments: argVector view: aView
-
native widget action - this is sent from the device (Display).
These are only delivered if native widgets are enabled under win32
-
noExposeView: aView
-
an noexpose event arrived - this is sent from the device (Display)
-
pasteFromClipBoard: something view: aView
-
a clipboard paste - this is handled like a user event
-
pointerEnter: state x: x y: y view: aView
-
mouse cursor was moved into the view - this is sent from the device (Display)
-
pointerLeave: state view: aView
-
mouse cursor was moved out of the view - this is sent from the device (Display)
-
preViewCreateNotification: aView
-
invoked right before a new view is created.
Notify listeners and allow for the origin/extent to be
changed. (For example, recorder/playback applications may
want to make certain that the playback view is at the same
position - or record any origin changes to translate later
synthetic events).
-
propertyChange: aView property: propertyId state: aSymbol time: time
-
A window has been created in a view
-
saveAndTerminateView: aView
-
view should save & terminate (from window manager) - this is sent from the device (Display)
-
selectionClear: selectionID time: time view: aView
-
the selection owner has changed (someone else has the selection)
-
terminateView: aView
-
view should terminate (from window manager) - this is sent from the device (Display)
Usage example(s):
Logger info:'sensor terminateView: %1' with:aView.
|
-
trayAction: command arguments: argVector view: aView
-
native widget action - this is sent from the device (Display)
-
unmappedView: aView
-
view was unmapped (from window manager) - this is sent from the device (Display)
-
visibilityOf: aView changedTo: how
-
view was mapped (from window manager) - this is sent from the device (Display)
event processing-private
-
button: button inView: aView state: onOrOff
-
update the state of the xxxButtonDown flags
-
compose: key1 with: key2
-
compose a 2-character sequence into a composed key
-
deadKeyMap
-
WindowSensor deadKeyMap
-
isDeadKey: key
-
return true if key is a deadKey (tilde, tick, backtick, colon or comma)
Usage example(s):
self deadKeyLanguage:nil.
self basicNew
deadKeysEnabled:true;
isDeadKey:$'.
self deadKeyLanguage:'de'.
self basicNew
deadKeysEnabled:true;
isDeadKey:$'.
self deadKeyLanguage:'fr'.
self basicNew
deadKeysEnabled:true;
isDeadKey:$'.
|
-
isModifierKey: key
-
return true if key is a modifier (Alt, Shift, Ctrl or Meta)
-
key: key state: onOrOff
-
update the state of the shiftDown/metaDown and ctrlDown
flags
-
notifyEventArrival: anEventOrNil
-
an event arrived - if there is an eventSemaphore,
signal it, to wake up any windowGroup process
-
notifySynchronousEventListenersAbout: anEvent
-
notify all synchronous eventHandlers about an incoming event.
If any returns true, it is assumed to be eaten by the handler and not
enqueued (i.e. not passed to the windowGroup process)
Warning: synchronous listeners are called by the display's event loop,
and should not terminate or block for long.
-
setAltDown: aBoolean
-
simulate that the ALT key is pressed;
(only used when simluating replay events)
-
setCtrlDown: aBoolean
-
simulate that the CTRL key is pressed;
(only used when simluating replay events)
-
setMetaDown: aBoolean
-
simulate that the META key is pressed;
(only used when simluating replay events)
-
setShiftDown: aBoolean
-
simulate that the SHIFT key is pressed;
(only used when simluating replay events)
-
updateModifierStateFrom: stateIn device: aDevice
-
this updates the modifier key-states.
Called privately when pointer enters a view.
-
updateModifierStatesFrom: anotherSensor
-
update the state of the shiftDown, metaDown and ctrlDown flags
from another window sensor
-
withDeadKey: deadKeyBefore expandKey: key2 do: aBlock
-
handle diacritic chars via dead key
event queue
-
addDamage: aRectangle view: aView
-
Add aRectangle to the damage list.
Try to merge incoming rectangles with the existing damage rectangles.
Incoming rectangles which are completely contained in any existing damage rect are ignored,
any existing damage rectangle which is completely contained in the incoming rectangle
is replaced.
-
addDamage: aRectangle view: aView wakeup: doWakeup
-
Add aRectangle to the damage list.
Try to merge incoming rectangles with the existing damage rectangles.
Incoming rectangles which are completely contained in any existing damage rect are ignored,
any existing damage rectangle which is completely contained in the incoming rectangle
is replaced.
-
basicAddDamage: newRectangle view: aView
-
Add newRectangle to the view's update region.
Answer true, if there are new damaged pixels, false otherwise.
Must be careful, if the damage queue contains an event pattern such as:
damage map
in this case, a new damage event is required to be added AFTER the map event,
otherwise, the newRectangle will be processed in a state where the map has not yet been
processed and the view thinks it can be ignored.
In this case, the damage event is re-added at the end of the queue.
Attention: this method MUST be called in a critical region, controlling the damage queue access
-
basicPushEvent: anEvent
-
internal basic event queuing
-
nextDamage
-
retrieve the next damage (either expose or resize event)
or nil, if there is none. Remove it from the queue.
-
nextDamageEventFor: aViewOrNil
-
retrieve the next damage event for aView (or any view if nil).
Return if there are no damage events.
Remove it from the queue.
-
nextEvent
-
retrieve the next event or nil, if there is none.
Remove it from the queue.
-
nextExposeEventFor: aViewOrNil
-
retrieve the next expose event for aView (or any view if nil).
Return nil if there are no expose events.
Remove it from the queue.
-
pendingEvent
-
retrieve the next pending user (i.e. non-damage) event.
Return nil, if there is none pending.
Do not remove it from the queue.
-
pushDamageEvent: anEvent
-
put an event into the damage queue
- this is not meant for public use
-
pushEvent: anEvent
-
put an event into the queue - this can also be sent by
applications and allows simulation of events
(implementation of recorders & playback)
or asynchronous communication between view applications
(by sending arbitrary events, which leads to a message send,
when the target windowGroup's process is rescheduled).
Usage example(s):
|b|
b := Button label:'test'.
b action:[Transcript showCR:'hallo'].
b open.
(Delay forSeconds:5) wait.
b sensor pushEvent:(WindowEvent pointerEnter:0 x:1 y:1 view:b).
(Delay forSeconds:1) wait.
b sensor pushEvent:(WindowEvent buttonPress:1 x:1 y:1 view:b).
(Delay forSeconds:2) wait.
b sensor pushEvent:(WindowEvent buttonRelease:1 x:1 y:1 view:b).
(Delay forSeconds:1) wait.
b sensor pushEvent:(WindowEvent pointerLeave:0 view:b).
|
event simulation
-
enqueueMessage: selector for: someone
-
if such a message is already in the queue, ignore it.
Otherwise push it as an event, to be handled when my thread is
back in the event loop.
-
enqueueMessage: selector for: someone arguments: argList
-
if such a message is already in the queue, ignore it.
Otherwise push it as an event, to be handled when my thread is
back in the event loop.
-
forwardKeyEventsTo: aView
-
remove all keyboard events and send them to aView's sensor instead
-
pushAction: aBlock
-
enqueue an action into my event queue.
The underlying window process will evaluate aBlock in its event loop
(i.e. synchronously). Use this to present the result of an asynchronous background
computation
-
pushUserEvent: aSelector for: anyObject
-
manually put an event into the queue - this allows
simulation of events (implementation of recorders & playback)
or asynchronous communication between view applications.
The view will perform a method as specified by aSelector,
when it performs event processing; this is different than sending
this message directly, since the execution is done by the view's process,
not by the current process (which is especially worthwhile, if that method
shows a modal box or similar).
-
pushUserEvent: aSelector for: anyObject withArgument: argument
-
manually put an event into the queue - this allows
simulation of events (implementation of recorders & playback)
or asynchronous communication between view applications.
anyObject will perform a method as specified by aSelector,
when the windowgroup dispatches this event.
This is different from sending this message directly,
since the execution is done by the view's process,
not by the current process
(which is especially worthwhile, if that method shows a modal box or similar).
-
pushUserEvent: aSelector for: anyObject withArguments: arguments
-
manually put an event into the queue - this allows
simulation of events (implementation of recorders & playback)
or asynchronous communication between view applications.
anyObject will perform a method as specified by aSelector,
when the windowgroup dispatches this event.
This is different from sending this message directly,
since the execution is done by the view's process,
not by the current process
(which is especially worthwhile, if that method shows a modal box or similar).
Usage example(s):
|b|
b := Button label:'test'.
b open.
(Delay forSeconds:5) wait.
b sensor pushUserEvent:#fooBar for:b withArguments:#().
|
Usage example(s):
|b|
b := Button label:'test'.
b open.
(Delay forSeconds:3) wait.
b sensor pushUserEvent:#disable for:b withArguments:#().
|
-
reEnqueueMessage: selector for: someone arguments: argList
-
if such a message is already in the queue, remove it.
Then push it as a new event, to be handled when my thread is
back in the event loop.
Use this if any previous such event should be ignored
(eg. a full invalidate)
initialization
-
initialize
-
initialize the event queues to empty
-
initializeState
-
initialize the event queues to empty
-
reinitialize
-
called when an image is restarted;
reinitialize the event queues to empty; leave other setup as-is
queries-event queue
-
hasButtonEventFor: aView
-
return true, if any button events are pending.
If the argument, aView is nil, the information is regarding any
view (i.e. is there a button event for any of my views);
otherwise, the information is regarding that specific view.
-
hasButtonMotionEventFor: aView
-
return true, if any buttonMotion events are pending.
If the argument, aView is nil, the information is regarding any
view (i.e. is there a motion event for any of my views);
otherwise, the information is regarding that specific view.
-
hasButtonPressEventFor: aView
-
return true, if any buttonPress events are pending.
If the argument, aView is nil, the information is regarding any
view (i.e. is there a buttonPress event for any of my views);
otherwise, the information is regarding that specific view.
-
hasButtonReleaseEventFor: aView
-
return true, if any buttonRelease events are pending.
If the argument, aView is nil, the information is regarding any
view (i.e. is there a buttonrelease event for any of my views);
otherwise, the information is regarding that specific view.
-
hasConfigureEventFor: aView
-
return true, if any resize/position events are pending.
If the argument, aView is nil, the information is regarding any
view (i.e. is there a configure event for any of my views);
otherwise, the information is regarding that specific view.
-
hasDamage
-
return true, if any damage events (i.e. expose or resize) might be pending
-
hasDamageFor: aViewOrNil
-
return true, if any damage events (i.e. expose or resize)
are pending for aViewOrNil. If nil, returns true if any damage is
pending for this windowGroup.
-
hasEvent: type for: aReceiverOrNil
-
return true, if a specific event is pending in my queues.
Type is the type of event, dType the corresponding device event.
If the argument, aReceiverOrNil is nil, the information is regarding any
view (i.e. is there an event for any of my views);
otherwise, the information is regarding to that specific view.
-
hasEvent: type for: aView withArguments: argsOrNil
-
return true, if a specific event is pending in my queues.
Type is the type of event, args are the arguments.
If the argument, aView is nil, the information is regarding any
view (i.e. is there an event for any of my views);
otherwise, the information is regarding to that specific view.
-
hasEvent: type for: aReceiverOrNil withMatchingArguments: argMatchBlock
-
return true, if a matching event is pending in my queues.
Type is the type of event, matchBlock is a block which gets the event args
and should return true.
If the argument, aReceiverOrNil is nil, the information is regarding any
view (i.e. is there an event for any of my views);
otherwise, the information is regarding to that specific view.
If the type-argument is nil, any event matches, otherwise only events with
that type are matched.
-
hasEvent: type orPendingDeviceEvent: dType for: aView
-
return true, if a specific event is pending in a queue
or in the devices event queue.
Type is the type of event, dType the corresponding device event.
If the argument, aView is nil, the information is regarding any
view (i.e. is there an event for any of my views);
otherwise, the information is regarding to that specific view.
-
hasEvents
-
return true, if any mouse/keyboard events might be pending
-
hasExposeEventFor: aViewOrNil
-
return true, if any exposure events are pending for aView.
If aViewOrNil is nil, return true if any exposure event for any view
in my windowGroup is pending
-
hasKeyEventFor: aViewOrNil
-
return true, if any key (press or release) events are pending.
If the argument, aView is nil, the information is regarding any
view (i.e. is there a key event for any of my views);
otherwise, the information is regarding that specific view.
-
hasKeyPressEventFor: aViewOrNil
-
return true, if any keyPress events are pending.
If the argument, aView is nil, the information is regarding any
view (i.e. is there a keyPress event for any of my views);
otherwise, the information is regarding that specific view.
-
hasKeyReleaseEventFor: aViewOrNil
-
return true, if any keyRelease events are pending.
If the argument, aView is nil, the information is regarding any
view (i.e. is there a keyRelease event for any of my views);
otherwise, the information is regarding that specific view.
-
hasUserEvent: type for: aReceiverOrNil
-
return true, if a specific event is pending in my user event queue.
Type is the type of event, dType the corresponding device event.
If the argument, aReceiverOrNil is nil, the information is regarding any
view (i.e. is there an event for any of my views);
otherwise, the information is regarding to that specific view.
-
hasUserEvent: type for: aView withArguments: argsOrNil
-
return true, if a specific user event (non damage) is pending in my queues.
Type is the type of event, args are the arguments.
If the argument, aView is nil, the information is regarding any
view (i.e. is there an event for any of my views);
otherwise, the information is regarding to that specific view.
-
hasUserEvent: type for: aReceiverOrNil withMatchingArguments: argMatchBlock
-
return true, if a specific event is pending in my user event queue.
Type is the type of event, dType the corresponding device event.
If the argument, aReceiverOrNil is nil, the information is regarding any
view (i.e. is there an event for any of my views);
otherwise, the information is regarding to that specific view.
-
hasUserEventFor: aView
-
return true, if any user event (i.e. key or button events) are pending.
If the argument, aView is nil, the information is regarding any
view (i.e. is there a user event for any of my views);
otherwise, the information is regarding that specific view.
-
hasUserEvents
-
return true, if any mouse/keyboard events might be pending
-
motionEventPending
-
return true, if any buttonMotion events are pending.
-
userEventCount
-
return the number of pending user events
queries-key & button state
-
altDown
-
return true, if the alt key is currently pressed.
Notice, that some keyboards don't have an alt key;
it is sometimes better to use 'sensor metaDown or:[sensor altDown]'.
-
anyButtonPressed
-
ST-80 compatibility: return true, if any mouse button is pressed.
You should not use it in 'normal' applications.
Instead, keep track of the buttons state in your view's or controller's
button-event methods.
-
anyModifierKeyDown
-
return true, if any modifier key is currently pressed.
-
ctrlDown
-
return true, if any CTRL key is currently pressed.
-
leftButtonPressed
-
return true, if the left mouse button is pressed.
This has been added to support ST-80 style button polling;
however, you should no use it in 'normal' applications.
Instead, keep track of the buttons state in your views or controllers
button-event methods.
-
metaDown
-
return true, if the meta key is currently pressed.
Notice, that some keyboards don't have a meta key;
it is sometimes better to use 'sensor metaDown or:[sensor altDown]'.
-
middleButtonPressed
-
return true, if the middle mouse button is pressed.
This has been added to support ST-80 style button polling;
however, you should no use it in 'normal' applications.
Instead, keep track of the buttons state in your views or controllers
button-event methods.
-
modeSwitchDown
-
return true, if the modeSwitch key is currently pressed.
Notice, that some keyboards don't have a modeSwitch key,
or it is named alt (OSX)
-
rightButtonPressed
-
return true, if the right mouse button is pressed.
This has been added to support ST-80 style button polling;
however, you should no use it in 'normal' applications.
Instead, keep track of the buttons state in your views or controllers
button-event methods.
-
shiftDown
-
return true, if any shift key is currently pressed.
queries-pointer
-
cursorPoint
-
ST-80 compatibility:
return the position of the mouse pointer on the current display
(in screen coordinates)
-
cursorPointIn: aView
-
return the position of the mouse in coordinates of aView
-
globalOrigin
-
ST-80 compatibility:
don't know what we should return here ...
... at least the PD program which uses it works when we return 0@0.
-
mousePoint
-
ST-80 compatibility:
return the position of the mouse pointer on the current display
(in screen coordinates)
special
-
catchExposeFor: aView
-
start catching noExpose events (must be done BEFORE a bitblt,
to prepare for the exposeEventSemaphore to be signalled when
the noExpose event arrives).
-
pollForActivity
-
ST-80 compatibility: wait for some activity (i.e. poll for an event)
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
waitButton
-
ST-80 compatibility: wait until any mouse button is pressed.
Do not use this in your applications; polling the sensor is
bad style.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
waitClickButton
-
ST-80 compatibility: wait until any mouse button is pressed & released again.
Do not use this in your applications; polling the sensor is
bad style.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
waitForExposeFor: aView
-
wait until a graphicsExpose or a noExpose arrives (after a bitblt).
This may be too X-specific, and things may change in this area
in future versions. (or the new device may simulate the arrival of
such an event)
-
waitNoButton
-
ST-80 compatibility: wait until no mouse button is pressed.
Do not use this in your applications; polling the sensor is
bad style.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
|