--- a/SimpleView.st Sun May 25 14:31:30 1997 +0200
+++ b/SimpleView.st Tue May 27 11:36:34 1997 +0200
@@ -4791,13 +4791,35 @@
"grab the pointer - that is: report all motion events relative to
myself, even if moved out of myself."
- device grabPointerIn:drawableId
+ |sensor|
+
+ (sensor := self sensor) notNil ifTrue:[
+ "/ make certain all X events have been received
+ device sync.
+ "/ now all events have been received.
+ "/ now, flush all pointer events
+ sensor flushMotionEventsFor:nil
+ ].
+
+ device grabPointerIn:drawableId.
+
!
ungrabPointer
"ungrab the pointer"
- device ungrabPointer
+ |sensor|
+
+ (sensor := self sensor) notNil ifTrue:[
+ "/ make certain all X events have been received
+ device sync.
+ "/ now all events have been received.
+ "/ now, flush all pointer events
+ sensor flushMotionEventsFor:self
+ ].
+
+ device ungrabPointer.
+
! !
!SimpleView methodsFor:'private'!
@@ -6879,102 +6901,105 @@
|tops mainView mainViewID|
- ModalBox usingTransientViews ifTrue:[
- mainGroup notNil ifTrue:[
- mainGroup topViews notNil ifTrue:[
- mainView := mainGroup topViews first.
- ].
- mainView notNil ifTrue:[
- mainViewID := mainView id.
- ]
- ].
-
- mainViewID isNil ifTrue:[
- self origin:(device center - (self extent//2))
- ].
-
- self create.
- device setTransient:drawableId for:mainViewID.
+ self isPopUpView ifFalse:[
+ ModalBox usingTransientViews ifTrue:[
+ mainGroup notNil ifTrue:[
+ mainGroup topViews notNil ifTrue:[
+ mainView := mainGroup topViews first.
+ ].
+ mainView notNil ifTrue:[
+ mainViewID := mainView id.
+ ]
+ ].
+
+ mainViewID isNil ifTrue:[
+ self origin:(device center - (self extent//2))
+ ].
+
+ self create.
+ device setTransient:drawableId for:mainViewID.
+ ].
].
self raise.
Processor activeProcessIsSystemProcess ifTrue:[
- "
- put myself into the modal group, let it handle events for
- me as well. This is only a half way solution, since the view
- is not modal at all ... however, the only situation
- where this happens is with modal boxes popped while in a
- modal browser. You will forgive me for that inconvenience.
- "
- windowGroup := mainGroup.
- mainGroup notNil ifTrue:[mainGroup addTopView:self].
- self realize
+ "
+ put myself into the modal group, let it handle events for
+ me as well. This is only a half way solution, since the view
+ is not modal at all ... however, the only situation
+ where this happens is with modal boxes popped while in a
+ modal browser. You will forgive me for that inconvenience.
+ "
+ windowGroup := mainGroup.
+ mainGroup notNil ifTrue:[mainGroup addTopView:self].
+ self realize
] ifFalse:[
- "
- show a stop-cursor in the main group
- "
- mainGroup notNil ifTrue:[
- self isPopUpView ifFalse:[
- mainGroup showCursor:(Cursor stop).
- ]
- ].
-
- "
- create a new window group and put myself into it
- "
- windowGroup := WindowGroup new.
- windowGroup addTopView:self.
-
- superView notNil ifTrue:[
- "/
- "/ special: this is a modal subview,
- "/ prevent the view to reassign its windowGroup when realized
- "/ (subviews normally place themself into the superviews group)
- "/
- windowGroup isForModalSubview:true.
- ].
-
- "
- go dispatch events in this new group
- (thus current windowgroup is blocked from interaction)
- "
- AbortSignal handle:[:ex |
- self hide.
- ex return.
- ] do:[
- [
- [
- windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup
- ] valueOnUnwindDo:[
- self hide
- ]
- ] valueNowOrOnUnwindDo:[
- mainGroup notNil ifTrue:[
- ReturnFocusWhenClosingModalBoxes ifTrue:[
- "
- return input focus to previously active groups top.
- This helps with windowmanagers which need an explicit click
- on the view for the focus.
- "
- tops := mainGroup topViews.
- (tops notNil and:[tops notEmpty]) ifTrue:[
- tops first getKeyboardFocus
- ]
- ].
-
- "
- restore cursors in the main group & flush its buffered key & mouse events
- "
- mainGroup restoreCursors.
+ "
+ show a stop-cursor in the main group
+ "
+ mainGroup notNil ifTrue:[
+ self isPopUpView ifFalse:[
+ mainGroup showCursor:(Cursor stop).
+ ]
+ ].
+
+ "
+ create a new window group and put myself into it
+ "
+ windowGroup := WindowGroup new.
+ windowGroup addTopView:self.
+
+ superView notNil ifTrue:[
+ "/
+ "/ special: this is a modal subview,
+ "/ prevent the view to reassign its windowGroup when realized
+ "/ (subviews normally place themself into the superviews group)
+ "/
+ windowGroup isForModalSubview:true.
+ ].
+
+ "
+ go dispatch events in this new group
+ (thus current windowgroup is blocked from interaction)
+ "
+ AbortSignal handle:[:ex |
+ self hide.
+ ex return.
+ ] do:[
+ [
+ [
+ windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup
+ ] valueOnUnwindDo:[
+ self hide
+ ]
+ ] valueNowOrOnUnwindDo:[
+ mainGroup notNil ifTrue:[
+ ReturnFocusWhenClosingModalBoxes ifTrue:[
+ "
+ return input focus to previously active groups top.
+ This helps with windowmanagers which need an explicit click
+ on the view for the focus.
+ "
+ tops := mainGroup topViews.
+ (tops notNil and:[tops notEmpty]) ifTrue:[
+ tops first getKeyboardFocus
+ ]
+ ].
+
+ "
+ restore cursors in the main group & flush its buffered key & mouse events
+ "
+ mainGroup restoreCursors.
"/ mainGroup sensor flushUserEvents.
- ]
- ]
- ].
+ ]
+ ]
+ ].
]
"Created: 10.12.1995 / 14:06:14 / cg"
"Modified: 28.2.1997 / 22:29:56 / cg"
+
!
openModalAt:aPoint
@@ -7147,6 +7172,6 @@
!SimpleView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.210 1997-05-12 17:33:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.211 1997-05-27 09:36:34 ca Exp $'
! !
SimpleView initialize!