eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'WindowSensor':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: WindowSensor


Inheritance:

   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

Description:


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

copyright

COPYRIGHT (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.

Class protocol:

accessing
o  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) **

o  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

o  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

o  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

o  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).

o  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.

o  deadKeyEatsSpace
return true if dead-key space should eat the space

Usage example(s):

     WindowSensor deadKeyEatsSpace

o  deadKeyEatsSpace: aBoolean
return true if dead-key space should eat the space

Usage example(s):

     WindowSensor deadKeyEatsSpace:false
     WindowSensor deadKeyEatsSpace:true

o  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'.

o  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'.

o  deadKeysEnabled
return the default for deadKey handling.

Usage example(s):

     WindowSensor deadKeysEnabled

o  deadKeysEnabled: aBoolean
set the default for deadKey handling.

Usage example(s):

     WindowSensor deadKeysEnabled:true.
     WindowSensor deadKeysEnabled:false.

o  eventListeners

o  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) **

o  removeSynchronousEventListener: aListener
remove a global eventListener (with new protocol - #handleEvent:)
- see documentation for what this can be used for

event processing
o  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).

o  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
o  initialize
initialize the classes constants

Usage example(s):

self initializeComposeKeyTable

Usage example(s):

     WindowSensor initialize

o  initializeComposeKeyTable
setup the composeKey table

Usage example(s):

     WindowSensor initializeComposeKeyTable              

o  mouseWheelScale
if set, mouse wheel motions are scaled by this number

o  mouseWheelScale: aNumber
if set, mouse wheel motions are scaled by this number

o  mouseWheelThreshold
if set, mouse wheel motions are only reported if the scaled amount is above this

instance creation
o  new
return a new initialized instance

queries
o  cursorPoint
ST-80 compatibility:
return the position of the cursor on the current display.

Usage example(s):

     WindowSensor cursorPoint


Instance protocol:

Compatibility-ST80
o  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.

o  eventQuit: event
ST-80 compatibility:
push an event for terminating the topViews application

o  mousePointForEvent: anEvent
( an extension from the stx:libcompat package )

o  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.

o  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
o  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) **

o  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

o  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)

o  deadKeysEnabled
return true if deadkeys are enabled (to combine diacriticals)

o  deadKeysEnabled: aBoolean
set to true to enable deadkeys (to combine diacriticals)

o  eventSemaphore
return the semaphore used to signal event arrival

o  eventSemaphore: aSemaphore
set the semaphore used to signal event arrival

o  ignoreExposeEvents: aBoolean
turn on/off expose event ignoring

o  ignoreUserInput
return true, if user events are currently ignored

o  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.

o  lastEvent

o  removeAllEventListeners
remove all local eventListeners

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  removeAllSynchronousEventListeners
remove all local eventListeners

o  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) **

o  removeSynchronousEventListener: aListener
remove a local eventListener (with new protocol - #processEvent:)
- see documentation for what this can be used for

accessing-private
o  criticalDamageEventQueueAccess: aBlock
perform some action which needs synchronized (exclusive)
access to the damage event queue.
(i.e. protected by a critical region)

o  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)

o  criticalUserEventQueueAccess: aBlock
perform some action which needs synchronized (exclusive)
access to the user event queue.
(i.e. protected by a critical region)

o  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.

o  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
o  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)

o  flushAllEvents

o  flushButtonEventsFor: aView
throw away all pending mouse button events for aView,
or any view, if the argument is nil.

o  flushEventsFor: aView
throw away all events for aView,
or any view, if the argument is nil.

o  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.

o  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.

o  flushEventsFor: aViewOrNil where: aBlock
throw away all events for aView, for which aBlock evaluates to true
or any view, if the argument is nil.

o  flushEventsFor: aViewOrNil withType: type
throw away all events for aView,
(or any view, if the argument is nil) which have a particular type.

o  flushExposeEvents
throw away all pending expose events; this
can be done after a full redraw (or in views, which are
doing full redraws anly)

o  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)

o  flushKeyboard
ST-80 compatibility: throw away all pending keyboard events

o  flushKeyboardFor: aView
throw away all pending keyboard events for aView,
or any view, if the argument is nil.

o  flushMotionEventsFor: aView
throw away all pending motion events for aView,
or for any view, if the argument is nil.

o  flushUserEvents
throw away all pending user events (i.e. key & button stuff)

o  flushUserEventsFor: aView
throw away all pending user events for aView (i.e. key & button stuff),
or for any view, if the argument is nil.

o  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.

o  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.

o  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.

o  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.

o  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
o  buttonMotion: buttonAndModifierState x: x y: y view: aView
mouse was moved - this is sent from the device (Display)

o  buttonMultiPress: button x: x y: y view: aView
mouse button was pressed - this is sent from the device (Display)

o  buttonPress: button x: x y: y view: aView
mouse button was pressed - this is sent from the device (Display)

o  buttonRelease: button x: x y: y view: aView
mouse button was released- this is sent from the device (Display)

o  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)

o  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)

o  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)

o  coveredBy: coveringSiblingView view: coveredView
aView was covered by one of its siblings - this is sent from the device (Display)

o  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

o  destroyedView: aView
view was destroyed (from window manager) - this is sent from the device (Display)

o  dropFiles: files view: view position: dropPositionOrNil handle: dropHandleOrNil

o  dropMessage: dropType data: dropValue view: targetView position: dropPositionOrNil handle: dropHandleOrNil

o  exposeX: left y: top width: width height: height view: aView
an expose event arrived - this is sent from the device (Display)

o  focusInView: aView
view got input focus - this is sent from the device (Display)

o  focusOutView: aView
view lost input focus - this is sent from the device (Display)

o  graphicsExposeX: left y: top width: width height: height final: final view: aView
a graphic expose event arrived - this is sent from the device (Display)

o  hotkeyWithId: aHotkeyId key: aKey view: aView
hotkey was pressed - this is sent from the device (Display).

o  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.

o  keyRelease: keyIn x: x y: y view: aView
key was released - this is sent from the device (Display).

o  mappedView: aView
view was mapped (from window manager) - this is sent from the device (Display)

o  mouseWheelMotion: state x: x y: y amount: amount deltaTime: dTime view: aView
mouse-wheel was turned - this is sent from the device (Display)

o  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

o  noExposeView: aView
an noexpose event arrived - this is sent from the device (Display)

o  pasteFromClipBoard: something view: aView
a clipboard paste - this is handled like a user event

o  pointerEnter: state x: x y: y view: aView
mouse cursor was moved into the view - this is sent from the device (Display)

o  pointerLeave: state view: aView
mouse cursor was moved out of the view - this is sent from the device (Display)

o  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).

o  propertyChange: aView property: propertyId state: aSymbol time: time
A window has been created in a view

o  saveAndTerminateView: aView
view should save & terminate (from window manager) - this is sent from the device (Display)

o  selectionClear: selectionID time: time view: aView
the selection owner has changed (someone else has the selection)

o  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.

o  trayAction: command arguments: argVector view: aView
native widget action - this is sent from the device (Display)

o  unmappedView: aView
view was unmapped (from window manager) - this is sent from the device (Display)

o  visibilityOf: aView changedTo: how
view was mapped (from window manager) - this is sent from the device (Display)

event processing-private
o  button: button inView: aView state: onOrOff
update the state of the xxxButtonDown flags

o  compose: key1 with: key2
compose a 2-character sequence into a composed key

o  deadKeyMap

WindowSensor deadKeyMap

o  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:$'.   

o  isModifierKey: key
return true if key is a modifier (Alt, Shift, Ctrl or Meta)

o  key: key state: onOrOff
update the state of the shiftDown/metaDown and ctrlDown
flags

o  notifyEventArrival: anEventOrNil
an event arrived - if there is an eventSemaphore,
signal it, to wake up any windowGroup process

o  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.

o  setAltDown: aBoolean
simulate that the ALT key is pressed;
(only used when simluating replay events)

o  setCtrlDown: aBoolean
simulate that the CTRL key is pressed;
(only used when simluating replay events)

o  setMetaDown: aBoolean
simulate that the META key is pressed;
(only used when simluating replay events)

o  setShiftDown: aBoolean
simulate that the SHIFT key is pressed;
(only used when simluating replay events)

o  updateModifierStateFrom: stateIn device: aDevice
this updates the modifier key-states.
Called privately when pointer enters a view.

o  updateModifierStatesFrom: anotherSensor
update the state of the shiftDown, metaDown and ctrlDown flags
from another window sensor

o  withDeadKey: deadKeyBefore expandKey: key2 do: aBlock
handle diacritic chars via dead key

event queue
o  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.

o  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.

o  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

o  basicPushEvent: anEvent
internal basic event queuing

o  nextDamage
retrieve the next damage (either expose or resize event)
or nil, if there is none. Remove it from the queue.

o  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.

o  nextEvent
retrieve the next event or nil, if there is none.
Remove it from the queue.

o  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.

o  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.

o  pushDamageEvent: anEvent
put an event into the damage queue
- this is not meant for public use

o  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
o  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.

o  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.

o  forwardKeyEventsTo: aView
remove all keyboard events and send them to aView's sensor instead

o  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

o  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).

o  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).

o  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:#().

o  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
o  initialize
initialize the event queues to empty

o  initializeState
initialize the event queues to empty

o  reinitialize
called when an image is restarted;
reinitialize the event queues to empty; leave other setup as-is

queries-event queue
o  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.

o  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.

o  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.

o  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.

o  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.

o  hasDamage
return true, if any damage events (i.e. expose or resize) might be pending

o  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.

o  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.

o  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.

o  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.

o  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.

o  hasEvents
return true, if any mouse/keyboard events might be pending

o  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

o  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.

o  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.

o  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.

o  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.

o  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.

o  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.

o  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.

o  hasUserEvents
return true, if any mouse/keyboard events might be pending

o  motionEventPending
return true, if any buttonMotion events are pending.

o  userEventCount
return the number of pending user events

queries-key & button state
o  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]'.

o  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.

o  anyModifierKeyDown
return true, if any modifier key is currently pressed.

o  ctrlDown
return true, if any CTRL key is currently pressed.

o  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.

o  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]'.

o  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.

o  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)

o  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.

o  shiftDown
return true, if any shift key is currently pressed.

queries-pointer
o  cursorPoint
ST-80 compatibility:
return the position of the mouse pointer on the current display
(in screen coordinates)

o  cursorPointIn: aView
return the position of the mouse in coordinates of aView

o  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.

o  mousePoint
ST-80 compatibility:
return the position of the mouse pointer on the current display
(in screen coordinates)

special
o  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).

o  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) **

o  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) **

o  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) **

o  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)

o  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) **



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:12:19 GMT