--- a/WindowGroup.st Fri Jan 09 22:28:21 1998 +0100
+++ b/WindowGroup.st Mon Jan 12 14:27:28 1998 +0100
@@ -82,11 +82,11 @@
and all of its subviews. However, this is not strictly required;
it is possible to create extra windowgroups for subviews, which will let them
run in parallel
- (for example, the FileBrowsers kill-Button is created that
- way, to allow a kill of an executing unix command, while the browser
- itself reads the pipeStream for incoming text.
- Even if the fileBrowser is busy reading the pipe, the killButton is still
- working and allows terminating the pipe-read action).
+ (for example, the FileBrowsers kill-Button is created that
+ way, to allow a kill of an executing unix command, while the browser
+ itself reads the pipeStream for incoming text.
+ Even if the fileBrowser is busy reading the pipe, the killButton is still
+ working and allows terminating the pipe-read action).
On the other hand, multiple topviews can be placed into the same windowGroup;
which allows for multiview applications, of which only one communicates with
@@ -114,70 +114,70 @@
events etc.
Dont get confused:
- You dont have to care for details in the normal case, a windowgroup is
- created for you automatically, when a view is opened.
- All of the internals are not required to be known for most applications.
+ You dont have to care for details in the normal case, a windowgroup is
+ created for you automatically, when a view is opened.
+ All of the internals are not required to be known for most applications.
[instance variables:]
- views collection of views of this group
+ views collection of views of this group
- topViews collection of topviews of this group
+ topViews collection of topviews of this group
- myProcess the process executing the events
+ myProcess the process executing the events
- mySensor my input sensor
+ mySensor my input sensor
- isModal true if this is for a modal box
+ isModal true if this is for a modal box
- previousGroup if modal, the group that started this one
+ previousGroup if modal, the group that started this one
- focusView the one that has the focus (or nil)
+ focusView the one that has the focus (or nil)
- focusSequence defines the focus sequence
+ focusSequence defines the focus sequence
[class variables:]
- LeaveSignal if raised, a modal box leaves (closes)
+ LeaveSignal if raised, a modal box leaves (closes)
- WindowGroupQuerySignal to ask for the current windowGroup,
- anywhere in the program, simply raise this
- signal. The raise returns nil, for processes,
- which are not under control of a windowGroup.
- (i.e. wg := WindowGroup windowGroupQuerySignal raise)
+ WindowGroupQuerySignal to ask for the current windowGroup,
+ anywhere in the program, simply raise this
+ signal. The raise returns nil, for processes,
+ which are not under control of a windowGroup.
+ (i.e. wg := WindowGroup windowGroupQuerySignal raise)
- LastEventQuerySignal to ask for the event which was responsible
- for being where you are (whereever that is).
- The raise returns nil, if you did not arrive
- there due to an event.
- (i.e. ev := WindowGroup lastEventQuerySignal raise)
- The event can be asked for the view, the type
- of event, x/y position etc.
+ LastEventQuerySignal to ask for the event which was responsible
+ for being where you are (whereever that is).
+ The raise returns nil, if you did not arrive
+ there due to an event.
+ (i.e. ev := WindowGroup lastEventQuerySignal raise)
+ The event can be asked for the view, the type
+ of event, x/y position etc.
(*)
- due to historic reasons, many views have the controller functionality
- integrated, and handle events themself. The windowSensor takes care
- of this, by checking if a view has a controller, and, if so, forwarding
- the events to it. Otherwise, events are sent directly to the view.
+ due to historic reasons, many views have the controller functionality
+ integrated, and handle events themself. The windowSensor takes care
+ of this, by checking if a view has a controller, and, if so, forwarding
+ the events to it. Otherwise, events are sent directly to the view.
- In the future, all views will be rewritten to actually use a controller.
- Currently (being in the middle of this migration), only some views
- (buttons, toggles and subclasses) do so.
+ In the future, all views will be rewritten to actually use a controller.
+ Currently (being in the middle of this migration), only some views
+ (buttons, toggles and subclasses) do so.
For more information, read 'introduction to view programming' in the
doc/online directory.
[author:]
- Claus Gittinger
+ Claus Gittinger
[see also:]
- WindowSensor WindowEvent EventListener KeyboardForwarder
- DeviceWorkstation
- View StandardSystemView
- ApplicationModel
- Process ProcessorScheduler
- (``Working with processes (programmers manual)'': programming/processes.html#VIEWSNPROCS)
+ WindowSensor WindowEvent EventListener KeyboardForwarder
+ DeviceWorkstation
+ View StandardSystemView
+ ApplicationModel
+ Process ProcessorScheduler
+ (``Working with processes (programmers manual)'': programming/processes.html#VIEWSNPROCS)
"
! !
@@ -185,17 +185,17 @@
initialize
LeaveSignal isNil ifTrue:[
- LeaveSignal := (Signal new) mayProceed:true.
- LeaveSignal nameClass:self message:#leaveSignal.
- LeaveSignal notifierString:'unhandled leave signal'.
+ LeaveSignal := (Signal new) mayProceed:true.
+ LeaveSignal nameClass:self message:#leaveSignal.
+ LeaveSignal notifierString:'unhandled leave signal'.
- WindowGroupQuerySignal := QuerySignal new.
- WindowGroupQuerySignal nameClass:self message:#windowGroupQuerySignal.
- WindowGroupQuerySignal notifierString:'query for windowgroup'.
+ WindowGroupQuerySignal := QuerySignal new.
+ WindowGroupQuerySignal nameClass:self message:#windowGroupQuerySignal.
+ WindowGroupQuerySignal notifierString:'query for windowgroup'.
- LastEventQuerySignal := QuerySignal new.
- LastEventQuerySignal nameClass:self message:#lastEventQuerySignal.
- LastEventQuerySignal notifierString:'query for last event'.
+ LastEventQuerySignal := QuerySignal new.
+ LastEventQuerySignal nameClass:self message:#lastEventQuerySignal.
+ LastEventQuerySignal notifierString:'query for last event'.
].
"WindowGroup initialize"
@@ -263,31 +263,31 @@
activeProcess := Processor activeProcess.
" caching the last value ..."
activeProcess == LastActiveProcess ifTrue:[
- LastActiveGroup process == LastActiveProcess ifTrue:[
- ^ LastActiveGroup
- ]
+ LastActiveGroup process == LastActiveProcess ifTrue:[
+ ^ LastActiveGroup
+ ]
].
wg := WindowGroupQuerySignal raise.
wg isNil ifTrue:[
- "/ mhmh - noone willing to answer that question ...
- "/ (how can ths happen ?)
- groups := self scheduledWindowGroups
- select:[:wg | wg process == activeProcess].
- groups size == 1 ifTrue:[
- wg := groups anElement
- ] ifFalse:[
- wg := groups detect:[:wg | wg isModal] ifNone:nil.
- wg isNil ifTrue:[
- wg := groups anElement
- ]
- ].
+ "/ mhmh - noone willing to answer that question ...
+ "/ (how can ths happen ?)
+ groups := self scheduledWindowGroups
+ select:[:wg | wg process == activeProcess].
+ groups size == 1 ifTrue:[
+ wg := groups anElement
+ ] ifFalse:[
+ wg := groups detect:[:wg | wg isModal] ifNone:nil.
+ wg isNil ifTrue:[
+ wg := groups anElement
+ ]
+ ].
].
wg notNil ifTrue:[
- LastActiveProcess := activeProcess.
- LastActiveGroup := wg.
+ LastActiveProcess := activeProcess.
+ LastActiveGroup := wg.
].
^ wg
@@ -311,15 +311,15 @@
set := IdentitySet new.
screens do:[:aDevice |
- aDevice allViewsDo:[:aView |
- |wg|
+ aDevice allViewsDo:[:aView |
+ |wg|
- (wg := aView windowGroup) notNil ifTrue:[
- wg process notNil ifTrue:[
- set add:wg
- ]
- ].
- ].
+ (wg := aView windowGroup) notNil ifTrue:[
+ wg process notNil ifTrue:[
+ set add:wg
+ ]
+ ].
+ ].
].
^ set asArray
@@ -356,29 +356,29 @@
|dev|
topViews notNil ifTrue:[
- topViews do:[:v |
- |app|
+ topViews do:[:v |
+ |app|
- (app := v application) notNil ifTrue:[
- "/
- "/ ok, it has an application;
- "/ ask it for preferences.
- "/
- (dev := app graphicsDevice) notNil ifTrue:[
- ^ dev
- ]
- ].
- (dev := v graphicsDevice) notNil ifTrue:[
- ^ dev
- ]
- ]
+ (app := v application) notNil ifTrue:[
+ "/
+ "/ ok, it has an application;
+ "/ ask it for preferences.
+ "/
+ (dev := app graphicsDevice) notNil ifTrue:[
+ ^ dev
+ ]
+ ].
+ (dev := v graphicsDevice) notNil ifTrue:[
+ ^ dev
+ ]
+ ]
].
views notNil ifTrue:[
- views do:[:v |
- (dev := v graphicsDevice) notNil ifTrue:[
- ^ dev
- ]
- ]
+ views do:[:v |
+ (dev := v graphicsDevice) notNil ifTrue:[
+ ^ dev
+ ]
+ ]
].
^ nil
@@ -406,7 +406,7 @@
g := self.
[g notNil and:[g isModal and:[(prev := g previousGroup) notNil]]] whileTrue:[
- g := prev
+ g := prev
].
^ g
@@ -496,10 +496,10 @@
"add a topview to the group"
topViews isNil ifTrue:[
- topViews := OrderedCollection new.
+ topViews := OrderedCollection new.
].
(topViews includesIdentical:aView) ifFalse:[
- topViews add:aView
+ topViews add:aView
]
"Modified: 6.3.1996 / 15:35:15 / cg"
@@ -509,10 +509,10 @@
"add aView to the windowGroup"
views isNil ifTrue:[
- views := OrderedCollection new.
+ views := OrderedCollection new.
].
(views includesIdentical:aView) ifFalse:[
- views add:aView
+ views add:aView
]
"Modified: 6.3.1996 / 15:35:41 / cg"
@@ -528,25 +528,25 @@
|sema|
views notNil ifTrue:[
- views removeIdentical:aView ifAbsent:[].
- views isEmpty ifTrue:[
- views := nil
- ]
+ views removeIdentical:aView ifAbsent:[].
+ views isEmpty ifTrue:[
+ views := nil
+ ]
].
topViews notNil ifTrue:[
- topViews removeIdentical:aView ifAbsent:[].
- topViews isEmpty ifTrue:[
- topViews := nil
- ]
+ topViews removeIdentical:aView ifAbsent:[].
+ topViews isEmpty ifTrue:[
+ topViews := nil
+ ]
].
"
wakeup my process to look if last view has been
removed (modalBoxes terminate their modalLoop if so)
"
mySensor notNil ifTrue:[
- (sema := mySensor eventSemaphore) notNil ifTrue:[
- sema signal
- ]
+ (sema := mySensor eventSemaphore) notNil ifTrue:[
+ sema signal
+ ]
]
"Modified: 1.2.1997 / 12:13:26 / cg"
@@ -581,9 +581,9 @@
"realize all topViews associated to this windowGroup."
topViews notNil ifTrue:[
- topViews do:[:aView |
- aView realize.
- ].
+ topViews do:[:aView |
+ aView realize.
+ ].
].
"Created: 24.7.1997 / 12:56:09 / cg"
@@ -594,14 +594,14 @@
and tell topViews about it."
topViews notNil ifTrue:[
- topViews do:[:aView |
- aView isPopUpView
- ifFalse:
- [
- aView realize.
- aView restarted
- ].
- ].
+ topViews do:[:aView |
+ aView isPopUpView
+ ifFalse:
+ [
+ aView realize.
+ aView restarted
+ ].
+ ].
].
!
@@ -610,14 +610,14 @@
This reopens all views in this group."
topViews notNil ifTrue:[
- "
- need a new semaphore, since obsolete processes
- (from our previous live) may still sit on the current semaphore
- "
- mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema').
- isModal ifFalse:[
- self startupWith:[self rerealizeTopViews].
- ]
+ "
+ need a new semaphore, since obsolete processes
+ (from our previous live) may still sit on the current semaphore
+ "
+ mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema').
+ isModal ifFalse:[
+ self startupWith:[self rerealizeTopViews].
+ ]
]
"Modified: 24.7.1997 / 13:00:12 / cg"
@@ -631,9 +631,9 @@
self closeDownViews.
myProcess notNil ifTrue:[
- p := myProcess.
- myProcess := nil.
- p terminate.
+ p := myProcess.
+ myProcess := nil.
+ p terminate.
]
"Created: 22.4.1996 / 17:58:37 / cg"
@@ -666,23 +666,23 @@
isModal := true.
WindowGroupQuerySignal handle:[:ex |
- ex proceedWith:self
+ ex proceedWith:self
] do:[
- self realizeTopViews.
+ self realizeTopViews.
- self
- eventLoopWhile:checkBlock
- onLeave:[
- "
- cleanup, in case of a terminate
- "
- previousGroup := nil.
- topViews := nil.
- views := nil.
- "
- the following is rubbish;
- the views could be reused ..
- "
+ self
+ eventLoopWhile:checkBlock
+ onLeave:[
+ "
+ cleanup, in case of a terminate
+ "
+ previousGroup := nil.
+ topViews := nil.
+ views := nil.
+ "
+ the following is rubbish;
+ the views could be reused ..
+ "
"/ topViews notNil ifTrue:[
"/ topViews do:[:aView |
@@ -697,8 +697,8 @@
"/ views := nil.
"/ ].
- ]
- ]
+ ]
+ ]
"Created: 10.12.1995 / 14:14:26 / cg"
"Modified: 20.8.1997 / 18:12:20 / cg"
@@ -718,61 +718,61 @@
previousGroup := nil.
myProcess isNil ifTrue:[
- isModal := false.
+ isModal := false.
- "/
- "/ this is the windowGroup process;
- "/ realize all views, then handle events forever
- "/ (well, not really forever ... ;-)
+ "/
+ "/ this is the windowGroup process;
+ "/ realize all views, then handle events forever
+ "/ (well, not really forever ... ;-)
- myProcess := [
- WindowGroupQuerySignal handle:[:ex |
- ex proceedWith:self
- ] do:[
- [
- startupAction value.
- self eventLoopWhile:[true] onLeave:[]
- ] valueNowOrOnUnwindDo:[
- self closeDownViews
- ]
- ]
- ] forkAt:(Processor userSchedulingPriority).
+ myProcess := [
+ WindowGroupQuerySignal handle:[:ex |
+ ex proceedWith:self
+ ] do:[
+ [
+ startupAction value.
+ self eventLoopWhile:[true] onLeave:[]
+ ] valueNowOrOnUnwindDo:[
+ self closeDownViews
+ ]
+ ]
+ ] forkAt:(Processor userSchedulingPriority).
- (topViews size > 0) ifTrue:[
- "/
- "/ give the windowGroup process a user friendly name
- "/ ask its topView for the processName, and
- "/ optionally append the displayName (if its not the default)
- "/
- top := topViews first.
- nm := top processName.
+ (topViews size > 0) ifTrue:[
+ "/
+ "/ give the windowGroup process a user friendly name
+ "/ ask its topView for the processName, and
+ "/ optionally append the displayName (if its not the default)
+ "/
+ top := topViews first.
+ nm := top processName.
- (dev := top graphicsDevice) notNil ifTrue:[
- devNm := dev displayName.
- (devNm notNil and:[devNm ~= Display displayName]) ifTrue:[
- nm := nm , ' (' , devNm , ')'
- ]
- ]
- ] ifFalse:[
- nm := 'window handler'.
- ].
- myProcess name:nm.
- myProcess beGroupLeader.
+ (dev := top graphicsDevice) notNil ifTrue:[
+ devNm := dev displayName.
+ (devNm notNil and:[devNm ~= Display displayName]) ifTrue:[
+ nm := nm , ' (' , devNm , ')'
+ ]
+ ]
+ ] ifFalse:[
+ nm := 'window handler'.
+ ].
+ myProcess name:nm.
+ myProcess beGroupLeader.
- "/
- "/ when the process gets suspended,
- "/ there maybe still buffered draw requests.
- "/ Arrange for them to be flushed then.
- "/ (otherwise, you would not see the output of a process,
- "/ which suspends and waits - or we had to add buffer flushes
- "/ all over the place)
- "/
- myProcess addSuspendAction:[
- |dev|
+ "/
+ "/ when the process gets suspended,
+ "/ there maybe still buffered draw requests.
+ "/ Arrange for them to be flushed then.
+ "/ (otherwise, you would not see the output of a process,
+ "/ which suspends and waits - or we had to add buffer flushes
+ "/ all over the place)
+ "/
+ myProcess addSuspendAction:[
+ |dev|
- dev := self graphicsDevice.
- dev notNil ifTrue:[dev flush].
- ].
+ dev := self graphicsDevice.
+ dev notNil ifTrue:[dev flush].
+ ].
]
"Modified: / 13.12.1995 / 14:04:53 / stefan"
@@ -788,7 +788,7 @@
destroy and other collection changing operations to be performed in the loop."
views notNil ifTrue:[
- views copy nonNilElementsDo:aBlock
+ views copy nonNilElementsDo:aBlock
]
"Modified: 12.2.1997 / 12:20:25 / cg"
@@ -800,7 +800,7 @@
destroy and other collection changing operations to be performed in the loop."
topViews notNil ifTrue:[
- topViews copy nonNilElementsDo:aBlock
+ topViews copy nonNilElementsDo:aBlock
]
"Modified: 12.2.1997 / 12:20:30 / cg"
@@ -812,7 +812,7 @@
destroy and other collection changing operations to be performed in the loop."
self allTopViewsDo:[:v |
- v ~~ aView ifTrue:[aBlock value:v]
+ v ~~ aView ifTrue:[aBlock value:v]
].
"Modified: 12.2.1997 / 12:22:10 / cg"
@@ -835,7 +835,7 @@
destroy and other collection changing operations to be performed in the loop."
self allTopViewsDo:[:v |
- (v type == #partner) ifTrue:[aBlock value:v].
+ (v type == #partner) ifTrue:[aBlock value:v].
].
"Modified: 12.2.1997 / 12:21:41 / cg"
@@ -847,7 +847,7 @@
destroy and other collection changing operations to be performed in the loop."
self allTopViewsDo:[:v |
- (v type == #slave) ifTrue:[aBlock value:v].
+ (v type == #slave) ifTrue:[aBlock value:v].
].
"Modified: 12.2.1997 / 12:21:46 / cg"
@@ -859,21 +859,21 @@
|hook|
trueOrFalse ifFalse:[
- "/
- "/ remove any eventHook on the receiver
- "/
- self preEventHook:nil.
- "/ Transcript showCR:'removed eventHook'.
+ "/
+ "/ remove any eventHook on the receiver
+ "/
+ self preEventHook:nil.
+ "/ Transcript showCR:'removed eventHook'.
] ifTrue:[
- "/
- "/ set an eventHook on its windowGroup
- "/
- hook := Plug new.
- hook respondTo:#processEvent:
- with:[:ev | ev displayString printCR. false].
+ "/
+ "/ set an eventHook on its windowGroup
+ "/
+ hook := Plug new.
+ hook respondTo:#processEvent:
+ with:[:ev | ev displayString printCR. false].
- self preEventHook:hook.
- "/ Transcript showCR:'set eventHook for tracing'.
+ self preEventHook:hook.
+ "/ Transcript showCR:'set eventHook for tracing'.
]
"Created: 24.4.1996 / 10:25:21 / cg"
@@ -895,138 +895,138 @@
and aBlock evaluates to true.
Some signals are caught & handled:
- LeaveSignal forces an exit from the eventLoop;
- AbortSignal brings us back into the loop, processing the next event;
- ActivityNotifications send a #showActivity: if nonModal,
- otherwise they are ignored."
+ LeaveSignal forces an exit from the eventLoop;
+ AbortSignal brings us back into the loop, processing the next event;
+ ActivityNotifications send a #showActivity: if nonModal,
+ otherwise they are ignored."
|thisProcess sigs otherSema|
thisProcess := Processor activeProcess.
sigs := SignalSet
- with:AbortSignal
- with:LeaveSignal
- with:ActivityNotificationSignal.
+ with:AbortSignal
+ with:LeaveSignal
+ with:ActivityNotificationSignal.
[
- |p g mainGroup mySema waitSema|
+ |p g mainGroup mySema waitSema|
- waitSema := mySema := mySensor eventSemaphore.
+ waitSema := mySema := mySensor eventSemaphore.
- isModal ifTrue:[
- mainGroup := self mainGroup.
- mainGroup == self ifTrue:[
- mainGroup := nil
- ].
- ] ifFalse:[
- mainGroup := previousGroup
- ].
+ isModal ifTrue:[
+ mainGroup := self mainGroup.
+ mainGroup == self ifTrue:[
+ mainGroup := nil
+ ].
+ ] ifFalse:[
+ mainGroup := previousGroup
+ ].
- mainGroup notNil ifTrue:[
- otherSema := mainGroup sensor eventSemaphore.
- waitSema := SemaphoreSet with:mySema with:otherSema.
- ].
+ mainGroup notNil ifTrue:[
+ otherSema := mainGroup sensor eventSemaphore.
+ waitSema := SemaphoreSet with:mySema with:otherSema.
+ ].
- [aBlock value] whileTrue:[
- LastActiveGroup := self.
- LastActiveProcess := thisProcess.
+ [aBlock value] whileTrue:[
+ LastActiveGroup := self.
+ LastActiveProcess := thisProcess.
- (views isNil and:[topViews isNil]) ifTrue:[
- myProcess notNil ifTrue:[
- p := myProcess.
- myProcess := nil.
- p terminate.
- "not reached - there is no life after death"
- ].
- "
- this is the end of a modal loop
- (not having a private process ...)
- "
- ^ self
- ].
+ (views isNil and:[topViews isNil]) ifTrue:[
+ myProcess notNil ifTrue:[
+ p := myProcess.
+ myProcess := nil.
+ p terminate.
+ "not reached - there is no life after death"
+ ].
+ "
+ this is the end of a modal loop
+ (not having a private process ...)
+ "
+ ^ self
+ ].
- sigs handle:[:ex |
- |theSig|
+ sigs handle:[:ex |
+ |theSig|
- (theSig := ex signal) == AbortSignal ifTrue:[
- "/
- "/ on abort, stay in loop
- "/
- ex return
- ].
- theSig == LeaveSignal ifTrue:[
- "/
- "/ on leave, exit the event loop
- "/
- ^ self
- ].
+ (theSig := ex signal) == AbortSignal ifTrue:[
+ "/
+ "/ on abort, stay in loop
+ "/
+ ex return
+ ].
+ theSig == LeaveSignal ifTrue:[
+ "/
+ "/ on leave, exit the event loop
+ "/
+ ^ self
+ ].
- "/ ActivityNotification
- "/
- "/ if I am a modal-group, let it be handled
- "/ by the outer main-groups handler
- "/ otherwise show the activityMessage and continue.
- "/
- isModal ifTrue:[
- ex reject
- "never reached"
- ].
- self showActivity:(ex errorString).
- ex proceed.
- ] do:[
- |dev gotSema mainView|
+ "/ ActivityNotification
+ "/
+ "/ if I am a modal-group, let it be handled
+ "/ by the outer main-groups handler
+ "/ otherwise show the activityMessage and continue.
+ "/
+ isModal ifTrue:[
+ ex reject
+ "never reached"
+ ].
+ self showActivity:(ex errorString).
+ ex proceed.
+ ] do:[
+ |dev gotSema mainView|
- "/ Flush device output before going to sleep.
- "/ This may produce more events to arrive.
- "/ Q: is this still needed (see suspendAction) ?
+ "/ Flush device output before going to sleep.
+ "/ This may produce more events to arrive.
+ "/ Q: is this still needed (see suspendAction) ?
- dev := self graphicsDevice.
- dev notNil ifTrue:[dev flush].
+"/ dev := self graphicsDevice.
+"/ dev notNil ifTrue:[dev flush].
- "/ now, wait for an event to arrive
- thisProcess setStateTo:#eventWait if:#active.
- gotSema := waitSema wait.
- LastActiveGroup := self.
- LastActiveProcess := thisProcess.
+ "/ now, wait for an event to arrive
+ thisProcess setStateTo:#eventWait if:#active.
+ gotSema := waitSema wait.
+ LastActiveGroup := self.
+ LastActiveProcess := thisProcess.
- gotSema == mySema ifTrue:[
- "/
- "/ an event for me
- "/
- self processEventsWithModalGroup:nil
- ] ifFalse:[
- "/
- "/ an event for my mainGroup
- "/
- mainGroup topViews notNil ifTrue:[
- mainView := mainGroup topViews first
- ].
- mainView notNil ifTrue:[
- "/
- "/ if anything happened to the mainGroup
- "/ bring my own topView back to the front
- "/ This keeps modalBoxes visible
- "/
- (mainGroup sensor hasConfigureEventFor:mainView) ifTrue:[
- topViews size > 0 ifTrue:[
- topViews first raiseDeiconified
- ]
- ]
- ].
- "
- if modal, also check for redraw events in my maingroup
- (we arrive here after we woke up on maingroup sensor eventSemaphore)
- "
- mainGroup processEventsWithModalGroup:self.
- ]
- ].
- ].
+ gotSema == mySema ifTrue:[
+ "/
+ "/ an event for me
+ "/
+ self processEventsWithModalGroup:nil
+ ] ifFalse:[
+ "/
+ "/ an event for my mainGroup
+ "/
+ mainGroup topViews notNil ifTrue:[
+ mainView := mainGroup topViews first
+ ].
+ mainView notNil ifTrue:[
+ "/
+ "/ if anything happened to the mainGroup
+ "/ bring my own topView back to the front
+ "/ This keeps modalBoxes visible
+ "/
+ (mainGroup sensor hasConfigureEventFor:mainView) ifTrue:[
+ topViews size > 0 ifTrue:[
+ topViews first raiseDeiconified
+ ]
+ ]
+ ].
+ "
+ if modal, also check for redraw events in my maingroup
+ (we arrive here after we woke up on maingroup sensor eventSemaphore)
+ "
+ mainGroup processEventsWithModalGroup:self.
+ ]
+ ].
+ ].
] valueNowOrOnUnwindDo:[
- "/
- "/ perform any cleanupActions
- "/
- cleanupActions notNil ifTrue:[cleanupActions value]
+ "/
+ "/ perform any cleanupActions
+ "/
+ cleanupActions notNil ifTrue:[cleanupActions value]
]
"Modified: 14.12.1995 / 11:12:24 / stefan"
@@ -1061,41 +1061,41 @@
self processExposeEvents.
[mySensor hasEvents] whileTrue:[
- event := mySensor nextEvent.
- event notNil ifTrue:[
- ignore := false.
- focus := focusView.
- modalDelegate := false.
+ event := mySensor nextEvent.
+ event notNil ifTrue:[
+ ignore := false.
+ focus := focusView.
+ modalDelegate := false.
- modalGroup notNil ifTrue:[
- "/ an incoming event for a masterView,
- "/ while being blocked by some other modalView.
+ modalGroup notNil ifTrue:[
+ "/ an incoming event for a masterView,
+ "/ while being blocked by some other modalView.
- modalTops := modalGroup topViews.
- modalTops size > 0 ifTrue:[
- modalTop := modalTops first.
- ].
+ modalTops := modalGroup topViews.
+ modalTops size > 0 ifTrue:[
+ modalTop := modalTops first.
+ ].
- event isKeyEvent ifTrue:[
- "/ forward keyboard events to my modal
- "/ groups first topView ...
- modalTop notNil ifTrue:[
- focus := modalTop.
- modalDelegate := true.
- ]
- ] ifFalse:[
- event isFocusEvent ifTrue:[
- event isFocusInEvent ifTrue:[
- "/ focusIn is forwarded to the modalGroup
- "/ (since keyboard is forwarded)
- event view:modalTop.
- focus := modalTop.
- ] ifFalse:[
- "/ focusOut goes to both the modal and
- "/ the blocked main-group
- "/ (actually, only the very first focusOut
- "/ is needed in the mainGroup (to turn off the cursor)
- "/ all others are only needed in the modalGroup)
+ event isKeyEvent ifTrue:[
+ "/ forward keyboard events to my modal
+ "/ groups first topView ...
+ modalTop notNil ifTrue:[
+ focus := modalTop.
+ modalDelegate := true.
+ ]
+ ] ifFalse:[
+ event isFocusEvent ifTrue:[
+ event isFocusInEvent ifTrue:[
+ "/ focusIn is forwarded to the modalGroup
+ "/ (since keyboard is forwarded)
+ event view:modalTop.
+ focus := modalTop.
+ ] ifFalse:[
+ "/ focusOut goes to both the modal and
+ "/ the blocked main-group
+ "/ (actually, only the very first focusOut
+ "/ is needed in the mainGroup (to turn off the cursor)
+ "/ all others are only needed in the modalGroup)
"/ syntheticEvent := event copy.
"/ syntheticEvent view:modalTop.
"/ LastEventQuerySignal handle:[:ex |
@@ -1103,89 +1103,89 @@
"/ ] do:[
"/ syntheticEvent sendEventWithFocusOn:nil.
"/ ].
- event view:modalTop.
- ].
- modalDelegate := true.
- ] ifFalse:[
- event isPointerLeaveEvent ifTrue:[
- ] ifFalse:[
- event isUserEvent ifTrue:[
- ignore := true
- ]
- ]
- ]
- ]
- ].
+ event view:modalTop.
+ ].
+ modalDelegate := true.
+ ] ifFalse:[
+ event isPointerLeaveEvent ifTrue:[
+ ] ifFalse:[
+ event isUserEvent ifTrue:[
+ ignore := true
+ ]
+ ]
+ ]
+ ]
+ ].
- ignore ifFalse:[
- (views notNil or:[topViews notNil]) ifTrue:[
- LastEventQuerySignal handle:[:ex |
- ex proceedWith:event
- ] do:[
- (preEventHook notNil
- and:[preEventHook processEvent:event]) ifTrue:[
- ignore := true.
- ].
+ ignore ifFalse:[
+ (views notNil or:[topViews notNil]) ifTrue:[
+ LastEventQuerySignal handle:[:ex |
+ ex proceedWith:event
+ ] do:[
+ (preEventHook notNil
+ and:[preEventHook processEvent:event]) ifTrue:[
+ ignore := true.
+ ].
- ignore ifFalse:[
- event isKeyPressEvent ifTrue:[
- key := event key.
+ ignore ifFalse:[
+ event isKeyPressEvent ifTrue:[
+ key := event key.
- key == #Escape ifTrue:[
- modalDelegate ifTrue:[
- modalTop hideRequest
- ] ifFalse:[
- isModal ifTrue:[
- topViews first hideRequest
- ]
- ]
- ]
- ].
- event isPointerEnterEvent ifTrue:[
- pointerView := event view
- ].
- event isPointerLeaveEvent ifTrue:[
- pointerView := nil
- ].
+ key == #Escape ifTrue:[
+ modalDelegate ifTrue:[
+ modalTop hideRequest
+ ] ifFalse:[
+ isModal ifTrue:[
+ topViews first hideRequest
+ ]
+ ]
+ ]
+ ].
+ event isPointerEnterEvent ifTrue:[
+ pointerView := event view
+ ].
+ event isPointerLeaveEvent ifTrue:[
+ pointerView := nil
+ ].
- ignore ifFalse:[
- "/
- "/ buttonPress events turn off explicit focus, and revert
- "/ to implicit focus control
- "/
- (focusView notNil
- and:[event isButtonPressEvent]) ifTrue:[
- self focusView:nil
- ].
- "/
- "/ let the event forward itself
- "/
- LastActiveGroup := self.
- LastActiveProcess := Processor activeProcess.
+ ignore ifFalse:[
+ "/
+ "/ buttonPress events turn off explicit focus, and revert
+ "/ to implicit focus control
+ "/
+ (focusView notNil
+ and:[event isButtonPressEvent]) ifTrue:[
+ self focusView:nil
+ ].
+ "/
+ "/ let the event forward itself
+ "/
+ LastActiveGroup := self.
+ LastActiveProcess := Processor activeProcess.
- "
- if there is no view information in the event,
- it must have been sent directly to the sensor.
- Send it to the first topView.
- "
- event view isNil ifTrue:[
- topViews first notNil ifTrue:[
- topViews first perform:event type withArguments:event arguments
- ]
- ] ifFalse:[
- event sendEventWithFocusOn:focus.
- ]
- ]
- ].
+ "
+ if there is no view information in the event,
+ it must have been sent directly to the sensor.
+ Send it to the first topView.
+ "
+ event view isNil ifTrue:[
+ topViews first notNil ifTrue:[
+ topViews first perform:event type withArguments:event arguments
+ ]
+ ] ifFalse:[
+ event sendEventWithFocusOn:focus.
+ ]
+ ]
+ ].
- postEventHook notNil ifTrue:[
- postEventHook processEvent:event
- ].
- ]
- ]
- ].
- event := nil.
- ].
+ postEventHook notNil ifTrue:[
+ postEventHook processEvent:event
+ ].
+ ]
+ ]
+ ].
+ event := nil.
+ ].
]
"Created: 5.3.1997 / 11:33:11 / cg"
@@ -1202,26 +1202,26 @@
thisProcess := Processor activeProcess.
[sensor hasDamage] whileTrue:[
- LastActiveGroup := self.
- LastActiveProcess := thisProcess.
+ LastActiveGroup := self.
+ LastActiveProcess := thisProcess.
- event := sensor nextDamage.
- event notNil ifTrue:[
- (views notNil or:[topViews notNil]) ifTrue:[
- LastEventQuerySignal handle:[:ex |
- ex proceedWith:event
- ] do:[
- (preEventHook notNil
- and:[preEventHook processEvent:event]) ifFalse:[
- event isDamage ifTrue:[
- view := event view.
- "/
- "/ if the view is no longer shown (iconified or closed),
- "/ this is a leftover event and ignored.
- "/
- view shown ifTrue:[
- LastActiveGroup := self.
- LastActiveProcess := thisProcess.
+ event := sensor nextDamage.
+ event notNil ifTrue:[
+ (views notNil or:[topViews notNil]) ifTrue:[
+ LastEventQuerySignal handle:[:ex |
+ ex proceedWith:event
+ ] do:[
+ (preEventHook notNil
+ and:[preEventHook processEvent:event]) ifFalse:[
+ event isDamage ifTrue:[
+ view := event view.
+ "/
+ "/ if the view is no longer shown (iconified or closed),
+ "/ this is a leftover event and ignored.
+ "/
+ view shown ifTrue:[
+ LastActiveGroup := self.
+ LastActiveProcess := thisProcess.
"/ rect := event rectangle.
"/ x := rect left.
@@ -1235,26 +1235,26 @@
"/ view exposeX:x y:y width:w height:h
"/ ]
- event sendEventWithFocusOn:nil.
+ event sendEventWithFocusOn:nil.
- ] ifFalse:[
+ ] ifFalse:[
"/ ('WGROUP: damage for ' , view displayString , ' ignored') infoPrintCR.
- ]
- ] ifFalse:[
- "
- mhmh - could we possibly arrive here ?
- "
- LastActiveGroup := self.
- LastActiveProcess := thisProcess.
- event sendEventWithFocusOn:nil.
- ]
- ].
- postEventHook notNil ifTrue:[
- postEventHook processEvent:event
- ]
- ]
- ]
- ]
+ ]
+ ] ifFalse:[
+ "
+ mhmh - could we possibly arrive here ?
+ "
+ LastActiveGroup := self.
+ LastActiveProcess := thisProcess.
+ event sendEventWithFocusOn:nil.
+ ]
+ ].
+ postEventHook notNil ifTrue:[
+ postEventHook processEvent:event
+ ]
+ ]
+ ]
+ ]
]
"Modified: 18.8.1997 / 15:53:08 / cg"
@@ -1274,44 +1274,44 @@
thisProcess := Processor activeProcess.
[true] whileTrue:[
- LastActiveGroup := self.
- LastActiveProcess := thisProcess.
+ LastActiveGroup := self.
+ LastActiveProcess := thisProcess.
- "/ event := aView nextDamage.
- event := sensor nextExposeEventFor:nil.
- event isNil ifTrue:[^ self].
+ "/ event := aView nextDamage.
+ event := sensor nextExposeEventFor:nil.
+ event isNil ifTrue:[^ self].
- (views notNil or:[topViews notNil]) ifTrue:[
- LastEventQuerySignal handle:[:ex |
- ex proceedWith:event
- ] do:[
- (preEventHook notNil
- and:[preEventHook processEvent:event]) ifFalse:[
- view := event view.
- "/
- "/ if the view is no longer shown (iconified or closed),
- "/ this is a leftover event and ignored.
- "/
- view shown ifTrue:[
- rect := event rectangle.
- x := rect left.
- y := rect top.
- w := rect width.
- h := rect height.
- LastActiveGroup := self.
- LastActiveProcess := thisProcess.
- view transformation notNil ifTrue:[
- view deviceExposeX:x y:y width:w height:h
- ] ifFalse:[
- view exposeX:x y:y width:w height:h
- ]
- ]
- ].
- postEventHook notNil ifTrue:[
- postEventHook processEvent:event
- ]
- ]
- ]
+ (views notNil or:[topViews notNil]) ifTrue:[
+ LastEventQuerySignal handle:[:ex |
+ ex proceedWith:event
+ ] do:[
+ (preEventHook notNil
+ and:[preEventHook processEvent:event]) ifFalse:[
+ view := event view.
+ "/
+ "/ if the view is no longer shown (iconified or closed),
+ "/ this is a leftover event and ignored.
+ "/
+ view shown ifTrue:[
+ rect := event rectangle.
+ x := rect left.
+ y := rect top.
+ w := rect width.
+ h := rect height.
+ LastActiveGroup := self.
+ LastActiveProcess := thisProcess.
+ view transformation notNil ifTrue:[
+ view deviceExposeX:x y:y width:w height:h
+ ] ifFalse:[
+ view exposeX:x y:y width:w height:h
+ ]
+ ]
+ ].
+ postEventHook notNil ifTrue:[
+ postEventHook processEvent:event
+ ]
+ ]
+ ]
]
"Created: 2.7.1997 / 14:32:19 / cg"
@@ -1332,48 +1332,48 @@
thisProcess := Processor activeProcess.
[true] whileTrue:[
- LastActiveGroup := self.
- LastActiveProcess := thisProcess.
+ LastActiveGroup := self.
+ LastActiveProcess := thisProcess.
- "/ event := aView nextDamage.
- event := sensor nextExposeEventFor:aViewOrNil.
- event isNil ifTrue:[^ self].
+ "/ event := aView nextDamage.
+ event := sensor nextExposeEventFor:aViewOrNil.
+ event isNil ifTrue:[^ self].
- (views notNil or:[topViews notNil]) ifTrue:[
- LastEventQuerySignal handle:[:ex |
- ex proceedWith:event
- ] do:[
- (preEventHook notNil
- and:[preEventHook processEvent:event]) ifFalse:[
- view := event view.
- "/
- "/ if the view is no longer shown (iconified or closed),
- "/ this is a leftover event and ignored.
- "/
- event isDamage ifFalse:[
+ (views notNil or:[topViews notNil]) ifTrue:[
+ LastEventQuerySignal handle:[:ex |
+ ex proceedWith:event
+ ] do:[
+ (preEventHook notNil
+ and:[preEventHook processEvent:event]) ifFalse:[
+ view := event view.
+ "/
+ "/ if the view is no longer shown (iconified or closed),
+ "/ this is a leftover event and ignored.
+ "/
+ event isDamage ifFalse:[
'OOPS2 - noDamage' printCR.
- ].
+ ].
- view shown ifTrue:[
- rect := event rectangle.
- x := rect left.
- y := rect top.
- w := rect width.
- h := rect height.
- LastActiveGroup := self.
- LastActiveProcess := thisProcess.
- view transformation notNil ifTrue:[
- view deviceExposeX:x y:y width:w height:h
- ] ifFalse:[
- view exposeX:x y:y width:w height:h
- ]
- ]
- ].
- postEventHook notNil ifTrue:[
- postEventHook processEvent:event
- ]
- ]
- ]
+ view shown ifTrue:[
+ rect := event rectangle.
+ x := rect left.
+ y := rect top.
+ w := rect width.
+ h := rect height.
+ LastActiveGroup := self.
+ LastActiveProcess := thisProcess.
+ view transformation notNil ifTrue:[
+ view deviceExposeX:x y:y width:w height:h
+ ] ifFalse:[
+ view exposeX:x y:y width:w height:h
+ ]
+ ]
+ ].
+ postEventHook notNil ifTrue:[
+ postEventHook processEvent:event
+ ]
+ ]
+ ]
]
"Created: 2.7.1997 / 14:32:19 / cg"
@@ -1388,7 +1388,7 @@
mySensor waitForExposeFor:aView.
AbortSignal catch:[
- self processRealExposeEventsFor:aView
+ self processRealExposeEventsFor:aView
]
"Modified: 6.8.1997 / 19:50:24 / cg"
@@ -1408,27 +1408,27 @@
(lastIndex := sequence size) == 0 ifTrue:[^ self].
focusView notNil ifTrue:[
- index := index0 := (sequence identityIndexOf:focusView).
+ index := index0 := (sequence identityIndexOf:focusView).
] ifFalse:[
- index := 0.
+ index := 0.
].
[next isNil] whileTrue:[
- index := index + 1.
- index > lastIndex ifTrue:[
- index := 1.
- index0 isNil ifTrue:[^ self].
- ].
- index == index0 ifTrue:[^ self].
+ index := index + 1.
+ index > lastIndex ifTrue:[
+ index := 1.
+ index0 isNil ifTrue:[^ self].
+ ].
+ index == index0 ifTrue:[^ self].
- next := (sequence at:index).
- next realized not ifTrue:[
- next := nil
- ] ifFalse:[
- next enabled ifFalse:[
- next := nil
- ]
- ]
+ next := (sequence at:index).
+ next realized not ifTrue:[
+ next := nil
+ ] ifFalse:[
+ next enabled ifFalse:[
+ next := nil
+ ]
+ ]
].
self focusView:next
@@ -1460,27 +1460,27 @@
(lastIndex := sequence size) == 0 ifTrue:[^ self].
focusView notNil ifTrue:[
- index := index0 := (sequence identityIndexOf:focusView).
+ index := index0 := (sequence identityIndexOf:focusView).
] ifFalse:[
- index := lastIndex + 1.
+ index := lastIndex + 1.
].
[prev isNil] whileTrue:[
- index := index - 1.
- index < 1 ifTrue:[
- index := lastIndex.
- index0 isNil ifTrue:[^ self].
- ].
- index == index0 ifTrue:[^ self].
+ index := index - 1.
+ index < 1 ifTrue:[
+ index := lastIndex.
+ index0 isNil ifTrue:[^ self].
+ ].
+ index == index0 ifTrue:[^ self].
- prev := (sequence at:index).
- prev realized not ifTrue:[
- prev := nil
- ] ifFalse:[
- prev enabled ifFalse:[
- prev := nil
- ]
- ].
+ prev := (sequence at:index).
+ prev realized not ifTrue:[
+ prev := nil
+ ] ifFalse:[
+ prev enabled ifFalse:[
+ prev := nil
+ ]
+ ].
].
self focusView:prev
@@ -1499,8 +1499,8 @@
focusSequence notNil ifTrue:[^ focusSequence].
topViews do:[:top |
- sequence := top focusSequence.
- sequence notNil ifTrue:[^ sequence].
+ sequence := top focusSequence.
+ sequence notNil ifTrue:[^ sequence].
].
^ nil
@@ -1530,22 +1530,22 @@
focusView == aViewOrNil ifTrue:[^ self].
focusView notNil ifTrue:[
- "/ lost explicit focus
- focusView == aViewOrNil ifTrue:[^ self].
- focusView showNoFocus:true.
+ "/ lost explicit focus
+ focusView == aViewOrNil ifTrue:[^ self].
+ focusView showNoFocus:true.
] ifFalse:[
- pointerView notNil ifTrue:[
- pointerView ~~ aViewOrNil ifTrue:[
- "/ lost implicit focus
- pointerView showNoFocus:false
- ]
- ].
+ pointerView notNil ifTrue:[
+ pointerView ~~ aViewOrNil ifTrue:[
+ "/ lost implicit focus
+ pointerView showNoFocus:false
+ ]
+ ].
].
focusView := aViewOrNil.
focusView notNil ifTrue:[
- "/ got explicit focus
- focusView showFocus:true.
+ "/ got explicit focus
+ focusView showFocus:true.
].
"
@@ -1580,13 +1580,13 @@
"throw away old (zombie) process"
myProcess notNil ifTrue:[
- "/ careful: the old processes exit-actions must be cleared.
- "/ otherwise, it might do destroy or other actions when it
- "/ gets finalized ...
+ "/ careful: the old processes exit-actions must be cleared.
+ "/ otherwise, it might do destroy or other actions when it
+ "/ gets finalized ...
"/ myProcess removeAllExitActions.
- myProcess removeAllSuspendActions.
- myProcess := nil.
+ myProcess removeAllSuspendActions.
+ myProcess := nil.
].
"throw away old events"
@@ -1618,17 +1618,17 @@
"restore the original cursors in all of my views"
self allViewsDo:[:aView |
- |c dev id cid|
+ |c dev id cid|
- dev := aView graphicsDevice.
- dev notNil ifTrue:[
- (id := aView id) notNil ifTrue:[
- c := aView cursor onDevice:dev.
- (cid := c id) notNil ifTrue:[
- dev setCursor:cid in:id.
- ]
- ]
- ]
+ dev := aView graphicsDevice.
+ dev notNil ifTrue:[
+ (id := aView id) notNil ifTrue:[
+ c := aView cursor onDevice:dev.
+ (cid := c id) notNil ifTrue:[
+ dev setCursor:cid in:id.
+ ]
+ ]
+ ]
].
"Modified: 28.3.1997 / 13:48:51 / cg"
@@ -1641,7 +1641,7 @@
(that one should know how to deal with it)"
topViews notNil ifTrue:[
- topViews first showActivity:someMessage
+ topViews first showActivity:someMessage
]
"Created: 16.12.1995 / 18:39:40 / cg"
@@ -1655,13 +1655,13 @@
c := aCursor.
self allViewsDo:[:aView |
- dev := aView graphicsDevice.
- dev notNil ifTrue:[
- c := c onDevice:dev.
- (id := c id) notNil ifTrue:[
- dev setCursor:id in:aView id.
- ]
- ]
+ dev := aView graphicsDevice.
+ dev notNil ifTrue:[
+ c := c onDevice:dev.
+ (id := c id) notNil ifTrue:[
+ dev setCursor:id in:aView id.
+ ]
+ ]
].
"Modified: 28.3.1997 / 13:49:34 / cg"
@@ -1676,7 +1676,7 @@
dev := self graphicsDevice.
dev isNil ifTrue:[
- ^ aBlock value
+ ^ aBlock value
].
deviceCursor := aCursor onDevice:dev.
@@ -1686,17 +1686,17 @@
"
oldCursors := IdentityDictionary new.
self allViewsDo:[:aView |
- |old|
+ |old|
- old := aView cursor.
- old ~~ aCursor ifTrue:[
- oldCursors at:aView put:old.
- aView cursor:deviceCursor now:false
- ]
+ old := aView cursor.
+ old ~~ aCursor ifTrue:[
+ oldCursors at:aView put:old.
+ aView cursor:deviceCursor now:false
+ ]
].
oldCursors size == 0 ifTrue:[
- ^ aBlock value
+ ^ aBlock value
].
"/
@@ -1708,13 +1708,13 @@
dev sync.
^ aBlock valueNowOrOnUnwindDo:[
- "
- restore cursors from the mapping
- "
- oldCursors keysAndValuesDo:[:view :cursor |
- view cursor:cursor now:false.
- ].
- dev flush "/ sync.
+ "
+ restore cursors from the mapping
+ "
+ oldCursors keysAndValuesDo:[:view :cursor |
+ view cursor:cursor now:false.
+ ].
+ dev flush "/ sync.
]
"Modified: 24.4.1997 / 13:29:01 / cg"
@@ -1781,6 +1781,6 @@
!WindowGroup class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.124 1997-12-04 14:53:19 tz Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.125 1998-01-12 13:27:28 cg Exp $'
! !
WindowGroup initialize!