--- a/WSensor.st Thu Oct 31 01:00:07 1996 +0100
+++ b/WSensor.st Fri Nov 01 17:32:17 1996 +0100
@@ -584,39 +584,44 @@
|args|
+ "/ update my idea of shift/alt/ctrl pressed information
+ self updateModifierStateFrom:state device:(aView graphicsDevice).
+
EventListener notNil ifTrue:[
- (EventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self]
+ (EventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self]
].
eventListener notNil ifTrue:[
- (eventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self]
+ (eventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self]
].
ignoreUserInput == true ifTrue:[
- ^ self
+ ^ self
].
args := Array with:state with:x with:y.
compressMotionEvents ifTrue:[
- "
- merge with last motion
- "
- mouseAndKeyboard reverseDo:[:ev |
- ev notNil ifTrue:[
- ((ev type == #buttonMotion:x:y:)
- and:[(ev view == aView)
- and:[(ev arguments at:1) == state]]) ifTrue:[
- ev arguments:args.
- ^ self
- ]
- ]
- ]
+ "
+ merge with last motion
+ "
+ mouseAndKeyboard reverseDo:[:ev |
+ ev notNil ifTrue:[
+ ((ev type == #buttonMotion:x:y:)
+ and:[(ev view == aView)
+ and:[(ev arguments at:1) == state]]) ifTrue:[
+ ev arguments:args.
+ ^ self
+ ]
+ ]
+ ]
].
mouseAndKeyboard
- addLast:(WindowEvent
- for:aView
- type:#buttonMotion:x:y:
- arguments:args).
+ addLast:(WindowEvent
+ for:aView
+ type:#buttonMotion:x:y:
+ arguments:args).
self notifyEventArrival
+
+ "Modified: 1.11.1996 / 16:49:53 / cg"
!
buttonMultiPress:button x:x y:y view:aView
@@ -925,7 +930,6 @@
"mouse cursor was moved into the view - this is sent from the device (Display)"
"/ update my idea of shift/alt/ctrl pressed information
-
self updateModifierStateFrom:state device:(aView graphicsDevice).
EventListener notNil ifTrue:[
@@ -942,25 +946,30 @@
arguments:(Array with:state with:x with:y)).
self notifyEventArrival
- "Modified: 28.5.1996 / 20:27:52 / cg"
+ "Modified: 1.11.1996 / 16:49:36 / cg"
!
pointerLeave:state view:aView
"mouse cursor was moved out of the view - this is sent from the device (Display)"
+ "/ update my idea of shift/alt/ctrl pressed information
+ self updateModifierStateFrom:state device:(aView graphicsDevice).
+
EventListener notNil ifTrue:[
- (EventListener pointerLeave:state view:aView) ifTrue:[^ self]
+ (EventListener pointerLeave:state view:aView) ifTrue:[^ self]
].
eventListener notNil ifTrue:[
- (eventListener pointerLeave:state view:aView) ifTrue:[^ self]
+ (eventListener pointerLeave:state view:aView) ifTrue:[^ self]
].
mouseAndKeyboard
- addLast:(WindowEvent
- for:aView
- type:#pointerLeave:
- arguments:(Array with:state)).
+ addLast:(WindowEvent
+ for:aView
+ type:#pointerLeave:
+ arguments:(Array with:state)).
self notifyEventArrival
+
+ "Modified: 1.11.1996 / 16:49:42 / cg"
!
saveAndTerminateView:aView
@@ -1112,7 +1121,6 @@
"this refetches the modifier key-states.
Called privately when pointer enters a view."
-
"/ Prevents wrong behavior in the following scenario:
"/ ctrl is pressed in a view
"/ pointer is moved out of view
@@ -1120,14 +1128,17 @@
"/ pointer moved back into view
"/ popup-menu still thinks that ctrl is pressed"
- "/ could do it from state - but I am lazy
- shiftDown := aDevice shiftDown.
- ctrlDown := aDevice ctrlDown.
- metaDown := aDevice metaDown.
- altDown := aDevice altDown.
+ shiftDown := "state bitAnd:(aDevice shiftMask) " aDevice shiftDown.
+ ctrlDown := "state bitAnd:(aDevice controlMask) " aDevice ctrlDown.
+ metaDown := "state bitAnd:(aDevice metaModifierMask) " aDevice metaDown.
+ altDown := "state bitAnd:(aDevice altModifierMask) " aDevice altDown.
+
+ leftButtonDown := "state bitAnd:(aDevice leftButtonStateMask) " aDevice leftButtonPressed.
+ middleButtonDown := "state bitAnd:(aDevice middleButtonStateMask)" aDevice middleButtonPressed.
+ rightButtonDown := "state bitAnd:(aDevice rightButtonStateMask)" aDevice rightButtonPressed.
"Created: 27.2.1996 / 14:54:38 / cg"
- "Modified: 22.4.1996 / 16:22:40 / cg"
+ "Modified: 1.11.1996 / 16:51:47 / cg"
! !
!WindowSensor methodsFor:'event queue'!
@@ -1503,7 +1514,217 @@
leftButtonDown := middleButtonDown := rightButtonDown := false.
! !
-!WindowSensor methodsFor:'queries '!
+!WindowSensor methodsFor:'queries - event queue'!
+
+eventPending
+ "return true, if either damage or events are pending"
+
+ mouseAndKeyboard size ~~ 0 ifTrue:[^ true].
+ ^ damage size ~~ 0
+!
+
+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 regrding that specific view."
+
+ (self hasButtonMotionEventFor:aView) ifTrue:[^ true].
+ (self hasButtonPressEventFor:aView) ifTrue:[^ true].
+ ^ (self hasButtonReleaseEventFor:aView)
+
+ "Created: 1.11.1996 / 17:02:23 / cg"
+ "Modified: 1.11.1996 / 17:12:03 / cg"
+!
+
+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 regrding that specific view."
+
+ ^ self hasEvent:#buttonMotion:x:y: orPendingDeviceEvent:#buttonMotion for:aView
+
+ "Created: 1.11.1996 / 17:04:01 / cg"
+!
+
+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 regrding that specific view."
+
+ ^ self hasEvent:#buttonPress:x:y: orPendingDeviceEvent:#buttonPress for:aView
+
+ "Created: 1.11.1996 / 17:05:10 / cg"
+ "Modified: 1.11.1996 / 17:11:09 / cg"
+!
+
+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 regrding that specific view."
+
+ ^ self hasEvent:#buttonRelease:x:y: orPendingDeviceEvent:#buttonRelease for:aView
+
+ "Created: 1.11.1996 / 17:05:26 / cg"
+ "Modified: 1.11.1996 / 17:11:18 / cg"
+!
+
+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 regrding that specific view."
+
+ ^ self hasEvent:#configureX:y:width:height: orPendingDeviceEvent:#structureNotify for:aView
+
+ "Modified: 1.11.1996 / 17:11:27 / cg"
+!
+
+hasDamage
+ "return true, if any damage events (i.e. expose or resize) are pending"
+
+ ^ damage size ~~ 0
+
+ "Modified: 21.5.1996 / 17:20:31 / cg"
+!
+
+hasDamageFor:aView
+ "return true, if any damage events (i.e. expose or resize)
+ are pending for aView"
+
+ damage size ~~ 0 ifTrue:[
+ damage do:[:aDamage |
+ aDamage notNil ifTrue:[
+ aDamage view == aView ifTrue:[^ true].
+ ].
+ ]
+ ].
+ ^ false
+
+ "Modified: 21.5.1996 / 17:15:09 / cg"
+!
+
+hasEvent:type orPendingDeviceEvent:dType for:aView
+ "return true, if a specific event is pending.
+ 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."
+
+ mouseAndKeyboard size ~~ 0 ifTrue:[
+ mouseAndKeyboard do:[:anEvent |
+ anEvent notNil ifTrue:[
+ (aView isNil or:[anEvent view == aView]) ifTrue:[
+ anEvent type == type ifTrue:[^ true].
+ ]
+ ].
+ ]
+ ].
+ damage size ~~ 0 ifTrue:[
+ damage do:[:anEvent |
+ anEvent notNil ifTrue:[
+ (aView isNil or:[anEvent view == aView]) ifTrue:[
+ anEvent type == type ifTrue:[^ true].
+ ]
+ ].
+ ]
+ ].
+ aView notNil ifTrue:[
+ ^ aView graphicsDevice eventPending:dType for:aView id
+ ].
+ ^ false
+
+ "Modified: 1.11.1996 / 17:11:47 / cg"
+!
+
+hasEvents
+ "return true, if any mouse/keyboard events are pending"
+
+ ^ mouseAndKeyboard size ~~ 0
+!
+
+hasExposeEventFor:aView
+ "return true, if any exposure events are pending for aView"
+
+ damage size ~~ 0 ifTrue:[
+ damage do:[:aDamage |
+ aDamage notNil ifTrue:[
+ aDamage isDamage ifTrue:[
+ (aView isNil
+ or:[aDamage view == aView]) ifTrue:[^ true].
+ ]
+ ].
+ ]
+ ].
+ ^ false
+
+ "Modified: 21.5.1996 / 17:13:09 / cg"
+ "Created: 1.11.1996 / 17:05:41 / cg"
+!
+
+hasKeyEventFor:aView
+ "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 regrding that specific view."
+
+ (self hasKeyPressEventFor:aView) ifTrue:[^ true].
+ ^ self hasKeyReleaseEventFor:aView
+
+ "Created: 1.11.1996 / 17:08:03 / cg"
+ "Modified: 1.11.1996 / 17:11:55 / cg"
+!
+
+hasKeyPressEventFor:aView
+ "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 regrding that specific view."
+
+ ^ self hasEvent:#keyPress:x:y: orPendingDeviceEvent:#keyPress for:aView
+
+ "Created: 1.11.1996 / 17:05:58 / cg"
+ "Modified: 1.11.1996 / 17:12:10 / cg"
+!
+
+hasKeyReleaseEventFor:aView
+ "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 regrding that specific view."
+
+ ^ self hasEvent:#keyRelease:x:y: orPendingDeviceEvent:#keyRelease for:aView
+
+ "Created: 1.11.1996 / 17:06:34 / cg"
+ "Modified: 1.11.1996 / 17:12:15 / cg"
+!
+
+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 regrding that specific view."
+
+ (self hasKeyEventFor:aView) ifTrue:[^ true].
+ ^ (self hasButtonEventFor:aView)
+
+ "Created: 1.11.1996 / 17:08:50 / cg"
+ "Modified: 1.11.1996 / 17:12:21 / cg"
+!
+
+motionEventPending
+ "return true, if any buttonMotion events are pending."
+
+ ^ self hasButtonMotionEventFor:nil
+
+ "Created: 24.3.1996 / 20:09:55 / cg"
+ "Modified: 1.11.1996 / 17:04:43 / cg"
+! !
+
+!WindowSensor methodsFor:'queries - key & button state'!
altDown
"return true, if the meta key is currently pressed.
@@ -1539,158 +1760,6 @@
^ ctrlDown
!
-cursorPoint
- "ST-80 compatibility:
- return the position of the mouse pointer on the current display
- (in screen coordinates)"
-
- ^ self class cursorPoint
-!
-
-eventPending
- "return true, if either damage or events are pending"
-
- mouseAndKeyboard size ~~ 0 ifTrue:[^ true].
- ^ damage size ~~ 0
-!
-
-globalOrigin
- "ST-80 compatibility:
- dont know what we should return here ...
- ... at least the PD program which uses it works when we return 0@0."
-
- ^ 0@0
-!
-
-hasButtonMotionEventsFor: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 regrding that specific view."
-
- ^ self hasEvent:#buttonMotion:x:y: orPendingDeviceEvent:#buttonMotion for:aView
-!
-
-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 motion event for any of my views);
- otherwise, the information is regrding that specific view."
-
- ^ self hasEvent:#buttonPress:x:y: orPendingDeviceEvent:#buttonPress for:aView
-!
-
-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 motion event for any of my views);
- otherwise, the information is regrding that specific view."
-
- ^ self hasEvent:#buttonRelease:x:y: orPendingDeviceEvent:#buttonRelease for:aView
-!
-
-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 motion event for any of my views);
- otherwise, the information is regrding that specific view."
-
- ^ self hasEvent:#configureX:y:width:height: orPendingDeviceEvent:#structureNotify for:aView
-!
-
-hasDamage
- "return true, if any damage events (i.e. expose or resize) are pending"
-
- ^ damage size ~~ 0
-
- "Modified: 21.5.1996 / 17:20:31 / cg"
-!
-
-hasDamageFor:aView
- "return true, if any damage events (i.e. expose or resize)
- are pending for aView"
-
- damage size ~~ 0 ifTrue:[
- damage do:[:aDamage |
- aDamage notNil ifTrue:[
- aDamage view == aView ifTrue:[^ true].
- ].
- ]
- ].
- ^ false
-
- "Modified: 21.5.1996 / 17:15:09 / cg"
-!
-
-hasEvent:type orPendingDeviceEvent:dType for:aView
- "return true, if a specific event is pending.
- 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 a motion event for any of my views);
- otherwise, the information is regrding that specific view."
-
- mouseAndKeyboard size ~~ 0 ifTrue:[
- mouseAndKeyboard do:[:anEvent |
- anEvent notNil ifTrue:[
- (aView isNil or:[anEvent view == aView]) ifTrue:[
- anEvent type == type ifTrue:[^ true].
- ]
- ].
- ]
- ].
- damage size ~~ 0 ifTrue:[
- damage do:[:anEvent |
- anEvent notNil ifTrue:[
- (aView isNil or:[anEvent view == aView]) ifTrue:[
- anEvent type == type ifTrue:[^ true].
- ]
- ].
- ]
- ].
- aView notNil ifTrue:[
- ^ aView graphicsDevice eventPending:dType for:aView id
- ].
- ^ false
-
- "Modified: 28.5.1996 / 20:27:37 / cg"
-!
-
-hasEvents
- "return true, if any mouse/keyboard events are pending"
-
- ^ mouseAndKeyboard size ~~ 0
-!
-
-hasExposeEventsFor:aView
- "return true, if any exposure events are pending for aView"
-
- damage size ~~ 0 ifTrue:[
- damage do:[:aDamage |
- aDamage notNil ifTrue:[
- aDamage isDamage ifTrue:[
- (aView isNil
- or:[aDamage view == aView]) ifTrue:[^ true].
- ]
- ].
- ]
- ].
- ^ false
-
- "Modified: 21.5.1996 / 17:13:09 / cg"
- "Created: 21.5.1996 / 17:19:14 / cg"
-!
-
-hasKeyPressEventsFor:aView
- "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 motion event for any of my views);
- otherwise, the information is regrding that specific view."
-
- ^ self hasEvent:#keyPress:x:y: orPendingDeviceEvent:#keyPress for:aView
-
- "Created: 23.3.1996 / 14:16:50 / cg"
-!
-
leftButtonPressed
"return true, if the left mouse button is pressed.
This has been added to support ST-80 style button polling;
@@ -1719,22 +1788,6 @@
^ middleButtonDown
!
-motionEventPending
- "return true, if any buttonMotion events are pending."
-
- ^ self hasButtonMotionEventsFor:nil
-
- "Created: 24.3.1996 / 20:09:55 / cg"
-!
-
-mousePoint
- "ST-80 compatibility:
- return the position of the mouse pointer on the current display
- (in screen coordinates)"
-
- ^ self cursorPoint
-!
-
redButtonPressed
"ST-80 compatibility: return true, if the left mouse button is pressed.
You should no use it in 'normal' applications.
@@ -1769,6 +1822,32 @@
^ middleButtonDown
! !
+!WindowSensor methodsFor:'queries - pointer'!
+
+cursorPoint
+ "ST-80 compatibility:
+ return the position of the mouse pointer on the current display
+ (in screen coordinates)"
+
+ ^ self class cursorPoint
+!
+
+globalOrigin
+ "ST-80 compatibility:
+ dont know what we should return here ...
+ ... at least the PD program which uses it works when we return 0@0."
+
+ ^ 0@0
+!
+
+mousePoint
+ "ST-80 compatibility:
+ return the position of the mouse pointer on the current display
+ (in screen coordinates)"
+
+ ^ self cursorPoint
+! !
+
!WindowSensor methodsFor:'special'!
catchExpose
@@ -1886,6 +1965,6 @@
!WindowSensor class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Attic/WSensor.st,v 1.66 1996-10-28 12:26:48 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Attic/WSensor.st,v 1.67 1996-11-01 16:32:17 cg Exp $'
! !
WindowSensor initialize!
--- a/WindowSensor.st Thu Oct 31 01:00:07 1996 +0100
+++ b/WindowSensor.st Fri Nov 01 17:32:17 1996 +0100
@@ -584,39 +584,44 @@
|args|
+ "/ update my idea of shift/alt/ctrl pressed information
+ self updateModifierStateFrom:state device:(aView graphicsDevice).
+
EventListener notNil ifTrue:[
- (EventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self]
+ (EventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self]
].
eventListener notNil ifTrue:[
- (eventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self]
+ (eventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self]
].
ignoreUserInput == true ifTrue:[
- ^ self
+ ^ self
].
args := Array with:state with:x with:y.
compressMotionEvents ifTrue:[
- "
- merge with last motion
- "
- mouseAndKeyboard reverseDo:[:ev |
- ev notNil ifTrue:[
- ((ev type == #buttonMotion:x:y:)
- and:[(ev view == aView)
- and:[(ev arguments at:1) == state]]) ifTrue:[
- ev arguments:args.
- ^ self
- ]
- ]
- ]
+ "
+ merge with last motion
+ "
+ mouseAndKeyboard reverseDo:[:ev |
+ ev notNil ifTrue:[
+ ((ev type == #buttonMotion:x:y:)
+ and:[(ev view == aView)
+ and:[(ev arguments at:1) == state]]) ifTrue:[
+ ev arguments:args.
+ ^ self
+ ]
+ ]
+ ]
].
mouseAndKeyboard
- addLast:(WindowEvent
- for:aView
- type:#buttonMotion:x:y:
- arguments:args).
+ addLast:(WindowEvent
+ for:aView
+ type:#buttonMotion:x:y:
+ arguments:args).
self notifyEventArrival
+
+ "Modified: 1.11.1996 / 16:49:53 / cg"
!
buttonMultiPress:button x:x y:y view:aView
@@ -925,7 +930,6 @@
"mouse cursor was moved into the view - this is sent from the device (Display)"
"/ update my idea of shift/alt/ctrl pressed information
-
self updateModifierStateFrom:state device:(aView graphicsDevice).
EventListener notNil ifTrue:[
@@ -942,25 +946,30 @@
arguments:(Array with:state with:x with:y)).
self notifyEventArrival
- "Modified: 28.5.1996 / 20:27:52 / cg"
+ "Modified: 1.11.1996 / 16:49:36 / cg"
!
pointerLeave:state view:aView
"mouse cursor was moved out of the view - this is sent from the device (Display)"
+ "/ update my idea of shift/alt/ctrl pressed information
+ self updateModifierStateFrom:state device:(aView graphicsDevice).
+
EventListener notNil ifTrue:[
- (EventListener pointerLeave:state view:aView) ifTrue:[^ self]
+ (EventListener pointerLeave:state view:aView) ifTrue:[^ self]
].
eventListener notNil ifTrue:[
- (eventListener pointerLeave:state view:aView) ifTrue:[^ self]
+ (eventListener pointerLeave:state view:aView) ifTrue:[^ self]
].
mouseAndKeyboard
- addLast:(WindowEvent
- for:aView
- type:#pointerLeave:
- arguments:(Array with:state)).
+ addLast:(WindowEvent
+ for:aView
+ type:#pointerLeave:
+ arguments:(Array with:state)).
self notifyEventArrival
+
+ "Modified: 1.11.1996 / 16:49:42 / cg"
!
saveAndTerminateView:aView
@@ -1112,7 +1121,6 @@
"this refetches the modifier key-states.
Called privately when pointer enters a view."
-
"/ Prevents wrong behavior in the following scenario:
"/ ctrl is pressed in a view
"/ pointer is moved out of view
@@ -1120,14 +1128,17 @@
"/ pointer moved back into view
"/ popup-menu still thinks that ctrl is pressed"
- "/ could do it from state - but I am lazy
- shiftDown := aDevice shiftDown.
- ctrlDown := aDevice ctrlDown.
- metaDown := aDevice metaDown.
- altDown := aDevice altDown.
+ shiftDown := "state bitAnd:(aDevice shiftMask) " aDevice shiftDown.
+ ctrlDown := "state bitAnd:(aDevice controlMask) " aDevice ctrlDown.
+ metaDown := "state bitAnd:(aDevice metaModifierMask) " aDevice metaDown.
+ altDown := "state bitAnd:(aDevice altModifierMask) " aDevice altDown.
+
+ leftButtonDown := "state bitAnd:(aDevice leftButtonStateMask) " aDevice leftButtonPressed.
+ middleButtonDown := "state bitAnd:(aDevice middleButtonStateMask)" aDevice middleButtonPressed.
+ rightButtonDown := "state bitAnd:(aDevice rightButtonStateMask)" aDevice rightButtonPressed.
"Created: 27.2.1996 / 14:54:38 / cg"
- "Modified: 22.4.1996 / 16:22:40 / cg"
+ "Modified: 1.11.1996 / 16:51:47 / cg"
! !
!WindowSensor methodsFor:'event queue'!
@@ -1503,7 +1514,217 @@
leftButtonDown := middleButtonDown := rightButtonDown := false.
! !
-!WindowSensor methodsFor:'queries '!
+!WindowSensor methodsFor:'queries - event queue'!
+
+eventPending
+ "return true, if either damage or events are pending"
+
+ mouseAndKeyboard size ~~ 0 ifTrue:[^ true].
+ ^ damage size ~~ 0
+!
+
+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 regrding that specific view."
+
+ (self hasButtonMotionEventFor:aView) ifTrue:[^ true].
+ (self hasButtonPressEventFor:aView) ifTrue:[^ true].
+ ^ (self hasButtonReleaseEventFor:aView)
+
+ "Created: 1.11.1996 / 17:02:23 / cg"
+ "Modified: 1.11.1996 / 17:12:03 / cg"
+!
+
+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 regrding that specific view."
+
+ ^ self hasEvent:#buttonMotion:x:y: orPendingDeviceEvent:#buttonMotion for:aView
+
+ "Created: 1.11.1996 / 17:04:01 / cg"
+!
+
+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 regrding that specific view."
+
+ ^ self hasEvent:#buttonPress:x:y: orPendingDeviceEvent:#buttonPress for:aView
+
+ "Created: 1.11.1996 / 17:05:10 / cg"
+ "Modified: 1.11.1996 / 17:11:09 / cg"
+!
+
+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 regrding that specific view."
+
+ ^ self hasEvent:#buttonRelease:x:y: orPendingDeviceEvent:#buttonRelease for:aView
+
+ "Created: 1.11.1996 / 17:05:26 / cg"
+ "Modified: 1.11.1996 / 17:11:18 / cg"
+!
+
+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 regrding that specific view."
+
+ ^ self hasEvent:#configureX:y:width:height: orPendingDeviceEvent:#structureNotify for:aView
+
+ "Modified: 1.11.1996 / 17:11:27 / cg"
+!
+
+hasDamage
+ "return true, if any damage events (i.e. expose or resize) are pending"
+
+ ^ damage size ~~ 0
+
+ "Modified: 21.5.1996 / 17:20:31 / cg"
+!
+
+hasDamageFor:aView
+ "return true, if any damage events (i.e. expose or resize)
+ are pending for aView"
+
+ damage size ~~ 0 ifTrue:[
+ damage do:[:aDamage |
+ aDamage notNil ifTrue:[
+ aDamage view == aView ifTrue:[^ true].
+ ].
+ ]
+ ].
+ ^ false
+
+ "Modified: 21.5.1996 / 17:15:09 / cg"
+!
+
+hasEvent:type orPendingDeviceEvent:dType for:aView
+ "return true, if a specific event is pending.
+ 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."
+
+ mouseAndKeyboard size ~~ 0 ifTrue:[
+ mouseAndKeyboard do:[:anEvent |
+ anEvent notNil ifTrue:[
+ (aView isNil or:[anEvent view == aView]) ifTrue:[
+ anEvent type == type ifTrue:[^ true].
+ ]
+ ].
+ ]
+ ].
+ damage size ~~ 0 ifTrue:[
+ damage do:[:anEvent |
+ anEvent notNil ifTrue:[
+ (aView isNil or:[anEvent view == aView]) ifTrue:[
+ anEvent type == type ifTrue:[^ true].
+ ]
+ ].
+ ]
+ ].
+ aView notNil ifTrue:[
+ ^ aView graphicsDevice eventPending:dType for:aView id
+ ].
+ ^ false
+
+ "Modified: 1.11.1996 / 17:11:47 / cg"
+!
+
+hasEvents
+ "return true, if any mouse/keyboard events are pending"
+
+ ^ mouseAndKeyboard size ~~ 0
+!
+
+hasExposeEventFor:aView
+ "return true, if any exposure events are pending for aView"
+
+ damage size ~~ 0 ifTrue:[
+ damage do:[:aDamage |
+ aDamage notNil ifTrue:[
+ aDamage isDamage ifTrue:[
+ (aView isNil
+ or:[aDamage view == aView]) ifTrue:[^ true].
+ ]
+ ].
+ ]
+ ].
+ ^ false
+
+ "Modified: 21.5.1996 / 17:13:09 / cg"
+ "Created: 1.11.1996 / 17:05:41 / cg"
+!
+
+hasKeyEventFor:aView
+ "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 regrding that specific view."
+
+ (self hasKeyPressEventFor:aView) ifTrue:[^ true].
+ ^ self hasKeyReleaseEventFor:aView
+
+ "Created: 1.11.1996 / 17:08:03 / cg"
+ "Modified: 1.11.1996 / 17:11:55 / cg"
+!
+
+hasKeyPressEventFor:aView
+ "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 regrding that specific view."
+
+ ^ self hasEvent:#keyPress:x:y: orPendingDeviceEvent:#keyPress for:aView
+
+ "Created: 1.11.1996 / 17:05:58 / cg"
+ "Modified: 1.11.1996 / 17:12:10 / cg"
+!
+
+hasKeyReleaseEventFor:aView
+ "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 regrding that specific view."
+
+ ^ self hasEvent:#keyRelease:x:y: orPendingDeviceEvent:#keyRelease for:aView
+
+ "Created: 1.11.1996 / 17:06:34 / cg"
+ "Modified: 1.11.1996 / 17:12:15 / cg"
+!
+
+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 regrding that specific view."
+
+ (self hasKeyEventFor:aView) ifTrue:[^ true].
+ ^ (self hasButtonEventFor:aView)
+
+ "Created: 1.11.1996 / 17:08:50 / cg"
+ "Modified: 1.11.1996 / 17:12:21 / cg"
+!
+
+motionEventPending
+ "return true, if any buttonMotion events are pending."
+
+ ^ self hasButtonMotionEventFor:nil
+
+ "Created: 24.3.1996 / 20:09:55 / cg"
+ "Modified: 1.11.1996 / 17:04:43 / cg"
+! !
+
+!WindowSensor methodsFor:'queries - key & button state'!
altDown
"return true, if the meta key is currently pressed.
@@ -1539,158 +1760,6 @@
^ ctrlDown
!
-cursorPoint
- "ST-80 compatibility:
- return the position of the mouse pointer on the current display
- (in screen coordinates)"
-
- ^ self class cursorPoint
-!
-
-eventPending
- "return true, if either damage or events are pending"
-
- mouseAndKeyboard size ~~ 0 ifTrue:[^ true].
- ^ damage size ~~ 0
-!
-
-globalOrigin
- "ST-80 compatibility:
- dont know what we should return here ...
- ... at least the PD program which uses it works when we return 0@0."
-
- ^ 0@0
-!
-
-hasButtonMotionEventsFor: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 regrding that specific view."
-
- ^ self hasEvent:#buttonMotion:x:y: orPendingDeviceEvent:#buttonMotion for:aView
-!
-
-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 motion event for any of my views);
- otherwise, the information is regrding that specific view."
-
- ^ self hasEvent:#buttonPress:x:y: orPendingDeviceEvent:#buttonPress for:aView
-!
-
-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 motion event for any of my views);
- otherwise, the information is regrding that specific view."
-
- ^ self hasEvent:#buttonRelease:x:y: orPendingDeviceEvent:#buttonRelease for:aView
-!
-
-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 motion event for any of my views);
- otherwise, the information is regrding that specific view."
-
- ^ self hasEvent:#configureX:y:width:height: orPendingDeviceEvent:#structureNotify for:aView
-!
-
-hasDamage
- "return true, if any damage events (i.e. expose or resize) are pending"
-
- ^ damage size ~~ 0
-
- "Modified: 21.5.1996 / 17:20:31 / cg"
-!
-
-hasDamageFor:aView
- "return true, if any damage events (i.e. expose or resize)
- are pending for aView"
-
- damage size ~~ 0 ifTrue:[
- damage do:[:aDamage |
- aDamage notNil ifTrue:[
- aDamage view == aView ifTrue:[^ true].
- ].
- ]
- ].
- ^ false
-
- "Modified: 21.5.1996 / 17:15:09 / cg"
-!
-
-hasEvent:type orPendingDeviceEvent:dType for:aView
- "return true, if a specific event is pending.
- 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 a motion event for any of my views);
- otherwise, the information is regrding that specific view."
-
- mouseAndKeyboard size ~~ 0 ifTrue:[
- mouseAndKeyboard do:[:anEvent |
- anEvent notNil ifTrue:[
- (aView isNil or:[anEvent view == aView]) ifTrue:[
- anEvent type == type ifTrue:[^ true].
- ]
- ].
- ]
- ].
- damage size ~~ 0 ifTrue:[
- damage do:[:anEvent |
- anEvent notNil ifTrue:[
- (aView isNil or:[anEvent view == aView]) ifTrue:[
- anEvent type == type ifTrue:[^ true].
- ]
- ].
- ]
- ].
- aView notNil ifTrue:[
- ^ aView graphicsDevice eventPending:dType for:aView id
- ].
- ^ false
-
- "Modified: 28.5.1996 / 20:27:37 / cg"
-!
-
-hasEvents
- "return true, if any mouse/keyboard events are pending"
-
- ^ mouseAndKeyboard size ~~ 0
-!
-
-hasExposeEventsFor:aView
- "return true, if any exposure events are pending for aView"
-
- damage size ~~ 0 ifTrue:[
- damage do:[:aDamage |
- aDamage notNil ifTrue:[
- aDamage isDamage ifTrue:[
- (aView isNil
- or:[aDamage view == aView]) ifTrue:[^ true].
- ]
- ].
- ]
- ].
- ^ false
-
- "Modified: 21.5.1996 / 17:13:09 / cg"
- "Created: 21.5.1996 / 17:19:14 / cg"
-!
-
-hasKeyPressEventsFor:aView
- "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 motion event for any of my views);
- otherwise, the information is regrding that specific view."
-
- ^ self hasEvent:#keyPress:x:y: orPendingDeviceEvent:#keyPress for:aView
-
- "Created: 23.3.1996 / 14:16:50 / cg"
-!
-
leftButtonPressed
"return true, if the left mouse button is pressed.
This has been added to support ST-80 style button polling;
@@ -1719,22 +1788,6 @@
^ middleButtonDown
!
-motionEventPending
- "return true, if any buttonMotion events are pending."
-
- ^ self hasButtonMotionEventsFor:nil
-
- "Created: 24.3.1996 / 20:09:55 / cg"
-!
-
-mousePoint
- "ST-80 compatibility:
- return the position of the mouse pointer on the current display
- (in screen coordinates)"
-
- ^ self cursorPoint
-!
-
redButtonPressed
"ST-80 compatibility: return true, if the left mouse button is pressed.
You should no use it in 'normal' applications.
@@ -1769,6 +1822,32 @@
^ middleButtonDown
! !
+!WindowSensor methodsFor:'queries - pointer'!
+
+cursorPoint
+ "ST-80 compatibility:
+ return the position of the mouse pointer on the current display
+ (in screen coordinates)"
+
+ ^ self class cursorPoint
+!
+
+globalOrigin
+ "ST-80 compatibility:
+ dont know what we should return here ...
+ ... at least the PD program which uses it works when we return 0@0."
+
+ ^ 0@0
+!
+
+mousePoint
+ "ST-80 compatibility:
+ return the position of the mouse pointer on the current display
+ (in screen coordinates)"
+
+ ^ self cursorPoint
+! !
+
!WindowSensor methodsFor:'special'!
catchExpose
@@ -1886,6 +1965,6 @@
!WindowSensor class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.66 1996-10-28 12:26:48 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.67 1996-11-01 16:32:17 cg Exp $'
! !
WindowSensor initialize!