--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SynchronousWindowSensor.st Fri Nov 24 23:33:17 1995 +0100
@@ -0,0 +1,323 @@
+"
+ COPYRIGHT (c) 1995 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.
+"
+
+WindowSensor subclass:#SynchronousWindowSensor
+ instanceVariableNames:'device'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Interface-Support'
+!
+
+!SynchronousWindowSensor class methodsFor:'documentation'!
+
+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.
+"
+!
+
+documentation
+"
+ in contrast to a regular windowSensor, instances of SynchronousWindowSensor
+ do NOT put events into a queue and do NOT wakeup any windowGroup process.
+ These are used for only one single situation: when a modal debugger
+ (i.e. one that is debugging the scheduler or event-dispatcher) is open.
+ This debuggers windowGroup is augmented with a synchronous Sensor, in order
+ to prevent the event handling code from suspending any process
+ (you cannot suspend the scheduler).
+ This is pretty tricky and magic - you dont have to understand this.
+ (consider this system internal code)
+"
+! !
+
+!SynchronousWindowSensor methodsFor:'accessing'!
+
+device
+ "return device"
+
+ ^ device
+
+ "Created: 24.11.1995 / 19:28:25 / cg"
+!
+
+device:something
+ "set device"
+
+ device := something.
+
+ "Created: 24.11.1995 / 19:28:25 / cg"
+! !
+
+!SynchronousWindowSensor methodsFor:'event handling'!
+
+buttonMotion:button x:x y:y view:aView
+ "forward a button-motion for some view"
+
+ WindowEvent
+ sendEvent:#buttonMotion:x:y:
+ arguments:(Array with:button with:x with:y)
+ view:aView
+
+ "Created: 24.11.1995 / 19:14:02 / cg"
+!
+
+buttonMultiPress:button x:x y:y view:aView
+ "forward a button-multi-press event for some view"
+
+ WindowEvent
+ sendEvent:#buttonMultiPress:x:y:
+ arguments:(Array with:button with:x with:y)
+ view:aView
+
+ "Created: 24.11.1995 / 19:14:14 / cg"
+!
+
+buttonPress:button x:x y:y view:aView
+ "forward a button-press event for some view"
+
+ WindowEvent
+ sendEvent:#buttonPress:x:y:
+ arguments:(Array with:button with:x with:y)
+ view:aView
+
+ "Created: 24.11.1995 / 19:14:25 / cg"
+!
+
+buttonRelease:button x:x y:y view:aView
+ "forward a button-release event for some view"
+
+ WindowEvent
+ sendEvent:#buttonRelease:x:y:
+ arguments:(Array with:button with:x with:y)
+ view:aView
+
+ "Created: 24.11.1995 / 19:14:36 / cg"
+!
+
+buttonShiftPress:button x:x y:y view:aView
+ "forward a button-shift-press event for some view"
+
+ WindowEvent
+ sendEvent:#buttonShiftPress:x:y:
+ arguments:(Array with:button with:x with:y)
+ view:aView
+
+ "Created: 24.11.1995 / 19:14:49 / cg"
+!
+
+configureX:x y:y width:w height:h view:aView
+ "forward a configure for some view"
+
+ aView configureX:x y:y width:w height:h
+
+ "Created: 24.11.1995 / 19:14:59 / cg"
+!
+
+coveredBy:otherView view:aView
+ "forward a covered for some view"
+
+ aView coveredBy:otherView
+
+ "Created: 24.11.1995 / 19:15:11 / cg"
+!
+
+destroyedView:aView
+ "forward a destroyed event for some view"
+
+ aView destroyed
+
+ "Created: 24.11.1995 / 19:15:22 / cg"
+!
+
+exposeX:x y:y width:w height:h view:aView
+ "forward an expose for some view"
+
+ WindowEvent
+ sendEvent:#exposeX:y:width:height:
+ arguments:(Array with:x with:y with:w with:h)
+ view:aView
+
+ "Created: 24.11.1995 / 19:15:54 / cg"
+!
+
+focusInView:aView
+ "forward a focusIn event for some view"
+
+ WindowEvent
+ sendEvent:#focusIn
+ arguments:nil
+ view:aView
+
+ "Created: 24.11.1995 / 19:16:11 / cg"
+!
+
+focusOutView:aView
+ "forward a focusOut event for some view"
+
+ WindowEvent
+ sendEvent:#focusOut
+ arguments:nil
+ view:aView
+
+ "Created: 24.11.1995 / 19:16:24 / cg"
+!
+
+graphicExposeX:x y:y width:w height:h view:aView
+ "forward a graphic expose for some view"
+
+ WindowEvent
+ sendEvent:#graphicExposeX:y:width:height:
+ arguments:(Array with:x with:y with:w with:h)
+ view:aView
+
+ "Created: 24.11.1995 / 19:16:38 / cg"
+!
+
+keyPress:untranslatedKey x:x y:y view:aView
+ "forward a key-press event for some view"
+
+ |xlatedKey|
+
+ xlatedKey := device translateKey:untranslatedKey.
+ xlatedKey notNil ifTrue:[
+ WindowEvent
+ sendEvent:#keyPress:x:y:
+ arguments:(Array with:xlatedKey with:x with:y)
+ view:aView
+ ]
+
+ "Created: 24.11.1995 / 19:17:23 / cg"
+ "Modified: 24.11.1995 / 19:19:25 / cg"
+!
+
+keyRelease:untranslatedKey x:x y:y view:aView
+ "forward a key-release event for some view"
+
+ |xlatedKey|
+
+ xlatedKey := device translateKey:untranslatedKey.
+ xlatedKey notNil ifTrue:[
+ WindowEvent
+ sendEvent:#keyRelease:x:y:
+ arguments:(Array with:xlatedKey with:x with:y)
+ view:aView
+ ]
+
+ "Created: 24.11.1995 / 19:17:50 / cg"
+ "Modified: 24.11.1995 / 19:19:28 / cg"
+!
+
+mappedView:aView
+ "forward a mapped event for some view"
+
+ aView mapped
+
+ "Created: 24.11.1995 / 19:18:01 / cg"
+!
+
+noExposeView:aView
+ "forward a noExpose event for some view"
+
+ catchExpose := false.
+ gotExpose := true.
+ aView noExpose.
+
+ "Created: 24.11.1995 / 19:18:10 / cg"
+ "Modified: 24.11.1995 / 20:00:15 / cg"
+!
+
+pointerEnter:buttonState x:x y:y view:aView
+ "forward a pointer enter for some view"
+
+ WindowEvent
+ sendEvent:#pointerEnter:x:y:
+ arguments:(Array with:buttonState with:x with:y)
+ view:aView
+
+ "Created: 24.11.1995 / 19:18:20 / cg"
+!
+
+pointerLeave:buttonState view:aView
+ "forward a pointer leave for some view"
+
+ WindowEvent
+ sendEvent:#pointerLeave:
+ arguments:(Array with:buttonState)
+ view:aView
+
+ "Created: 24.11.1995 / 19:18:30 / cg"
+!
+
+saveAndTerminateView:aView
+ "forward a saveAndTerminate event for some view"
+
+ aView saveAndTerminate
+
+ "Created: 24.11.1995 / 19:18:38 / cg"
+!
+
+terminateView:aView
+ "forward a terminate event for some view"
+
+ aView terminate
+
+ "Created: 24.11.1995 / 19:18:48 / cg"
+!
+
+unmappedView:aView
+ "forward an unmapped event for some view"
+
+ aView unmapped
+
+ "Created: 24.11.1995 / 19:18:59 / cg"
+! !
+
+!SynchronousWindowSensor methodsFor:'specials'!
+
+catchExpose
+ "start catching noExpose events (must be done BEFORE a bitblt)."
+
+ gotExpose := false.
+ gotOtherEvent := false.
+ catchExpose := true.
+
+ "Created: 24.11.1995 / 20:02:16 / cg"
+!
+
+waitForExposeFor:aView
+ "wait until a graphicsExpose or a noExpose arrives (after a bitblt)."
+
+ "
+ cannot suspend, I am a synchronous-modal sensor
+ "
+ [gotExpose] whileFalse:[
+ aView device dispatchExposeEventFor:aView id.
+ Processor yield.
+ ].
+ catchExpose := false
+
+ "Created: 24.11.1995 / 20:03:07 / cg"
+! !
+
+!SynchronousWindowSensor class methodsFor:'documentation'!
+
+version
+ ^ '$Header: /cvs/stx/stx/libview/SynchronousWindowSensor.st,v 1.1 1995-11-24 22:32:48 cg Exp $'
+! !