--- a/DevWorkst.st Sat Jan 11 21:48:17 1997 +0100
+++ b/DevWorkst.st Sun Jan 12 00:28:49 1997 +0100
@@ -2848,104 +2848,75 @@
|inputSema fd p nm|
- "
- only allow one dispatcher process per display
- "
+ "/
+ "/ only allow one dispatcher process per display
+ "/
dispatching ifTrue:[^ self].
dispatching := true.
AllScreens isNil ifTrue:[
- AllScreens := Set new:1
+ AllScreens := Set new:1
].
AllScreens add:self.
fd := self displayFileDescriptor.
-"/ non-thread operation is no longer supported
-"/ "
-"/ The code below (still) handles the situation where ST/X was built
-"/ without lightweight process support. Since there are many other places
-"/ in the system whic depend on lightweight processes to function, this
-"/ may be a stupid thing to do ... expect it to vanish sooner or later.
-"/ "
-"/
-"/ ProcessorScheduler isPureEventDriven ifTrue:[
-"/ "
-"/ no threads built in;
-"/ handle all events by having processor call a block when something
-"/ arrives on my filedescriptor. Dispatch the event in that block.
-"/ "
-"/ Processor enableIOAction:[
-"/ dispatching ifTrue:[
-"/ [self eventPending] whileTrue:[
-"/ self dispatchPendingEvents.
-"/ "/ self checkForEndOfDispatch.
-"/ ].
-"/ dispatching ifFalse:[
-"/ Processor disableFd:fd.
-"/ AllScreens remove:self.
-"/ ]
-"/ ]
-"/ ]
-"/ onInput:fd.
-"/
-"/ ^ self.
-"/ ]
- "
- handle stuff as a process - sitting on a semaphore.
- Tell Processor to trigger this semaphore when something arrives
- on my filedescriptor. Since a select alone is not enough to
- know if events are pending (Xlib reads out event-queue while
- doing output), we also have to install a poll-check block.
- "
+ "/ handle all incoming events from the device, sitting on a semaphore.
+ "/ Tell Processor to trigger this semaphore when something arrives
+ "/ on my filedescriptor. Since a select alone is not enough to
+ "/ know if events are pending (Xlib reads out event-queue while
+ "/ doing output), we also have to install a poll-check block.
+
OperatingSystem supportsSelect ifTrue:[
- inputSema := Semaphore new.
+ inputSema := Semaphore new.
].
p := [
- [dispatching] whileTrue:[
- AbortSignal handle:[:ex |
- ex return
- ] do:[
- self eventPending ifFalse:[
- Processor activeProcess setStateTo:#ioWait if:#active.
- inputSema notNil ifTrue:[
- inputSema wait.
- ] ifFalse:[
- Delay waitForMilliseconds:50
- ]
- ].
-
- self dispatchPendingEvents.
- "/ self checkForEndOfDispatch.
- ]
- ].
- inputSema notNil ifTrue:[
- Processor disableSemaphore:inputSema.
- inputSema := nil.
- ].
- AllScreens remove:self.
- dispatchProcess := nil
+ [dispatching] whileTrue:[
+ AbortSignal handle:[:ex |
+ ex return
+ ] do:[
+ self eventPending ifFalse:[
+ Processor activeProcess setStateTo:#ioWait if:#active.
+ inputSema notNil ifTrue:[
+ inputSema wait.
+ ] ifFalse:[
+ Delay waitForMilliseconds:50
+ ]
+ ].
+
+ self dispatchPendingEvents.
+ ]
+ ].
+ inputSema notNil ifTrue:[
+ Processor disableSemaphore:inputSema.
+ inputSema := nil.
+ ].
+ AllScreens remove:self.
+ dispatchProcess := nil
] newProcess.
- "
- give the process a nice name (for the processMonitor)
- "
+
+ "/
+ "/ give the process a nice name (for the processMonitor)
+ "/
(nm := self displayName) notNil ifTrue:[
- nm := 'event dispatcher (' , nm , ')'.
+ nm := 'event dispatcher (' , nm , ')'.
] ifFalse:[
- nm := 'event dispatcher'.
+ nm := 'event dispatcher'.
].
p name:nm.
p priority:(Processor userInterruptPriority).
dispatchProcess := p.
p resume.
+ "/ finally, arrange for the processor to signal that semaphore on input
+
inputSema notNil ifTrue:[
- Processor signal:inputSema onInput:fd orCheck:[self eventPending].
+ Processor signal:inputSema onInput:fd orCheck:[self eventPending].
]
"Modified: 12.12.1995 / 20:52:57 / stefan"
- "Modified: 18.7.1996 / 17:12:50 / cg"
+ "Modified: 12.1.1997 / 00:27:50 / cg"
! !
!DeviceWorkstation methodsFor:'font helpers'!
@@ -4823,6 +4794,6 @@
!DeviceWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Attic/DevWorkst.st,v 1.148 1997-01-10 18:02:52 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Attic/DevWorkst.st,v 1.149 1997-01-11 23:28:49 cg Exp $'
! !
DeviceWorkstation initialize!