--- a/WindowEvent.st Tue Oct 29 18:00:55 2002 +0100
+++ b/WindowEvent.st Thu Oct 31 21:20:59 2002 +0100
@@ -145,6 +145,20 @@
privateIn:WindowEvent
!
+WindowEvent subclass:#SelectionEvent
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:WindowEvent
+!
+
+WindowEvent::SelectionEvent subclass:#SelectionClearEvent
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:WindowEvent
+!
+
WindowEvent subclass:#WindowMapUnmapEvent
instanceVariableNames:''
classVariableNames:''
@@ -1408,5 +1422,7 @@
!WindowEvent class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.73 2002-08-02 18:59:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.74 2002-10-31 20:20:51 cg Exp $'
! !
+
+WindowEvent::InputEvent initialize!
--- a/WindowSensor.st Tue Oct 29 18:00:55 2002 +0100
+++ b/WindowSensor.st Thu Oct 31 21:20:59 2002 +0100
@@ -1704,6 +1704,15 @@
"Modified: 18.1.1997 / 14:17:37 / cg"
!
+selectionClear:selectionID time:time view:aView
+ "the selection owner has changed (someone else has the selection)"
+
+ self pushEvent:(WindowEvent::SelectionClearEvent new
+ for:aView
+ type:#selectionClear:
+ arguments:(Array with:selectionID))
+!
+
terminateView:aView
"view should terminate (from window manager) - this is sent from the device (Display)"
@@ -3086,6 +3095,7 @@
!WindowSensor class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.205 2002-09-18 09:55:42 penk Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.206 2002-10-31 20:20:59 cg Exp $'
! !
+
WindowSensor initialize!
--- a/XWorkstation.st Tue Oct 29 18:00:55 2002 +0100
+++ b/XWorkstation.st Thu Oct 31 21:20:59 2002 +0100
@@ -23,7 +23,8 @@
rootId eventBuffer altModifierMask metaModifierMask
multiClickTime deviceIOTimeoutErrorSignal activateOnClick
rawKeySymTranslation'
- classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength'
+ classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength
+ SelectionHandlers'
poolDictionaries:''
category:'Interface-Graphics'
!
@@ -4590,50 +4591,55 @@
"/
self setLastCopyBuffer:(self getCopyBuffer).
- self setCopyBuffer:nil
+ self setCopyBuffer:nil.
+
+ SelectionHandlers notNil ifTrue:[
+ SelectionHandlers do:[:eachHandler |
+ eachHandler selectionClear:selectionID
+ ]
+ ].
"/ noone is interested in that ...
"/ aView selectionClear:selectionID
-
-!
-
-selectionNotify:aView selection:selectionID target:targetID property:propertyID requestor:requestorID time:time
+!
+
+selectionNotify:aView selection:selectionID target:targetID property:propertyID requestor:requestorID time:time
"sent when the server returns an answer from a request for a selection.
This is a very X-specific mechanism."
|s sensor|
propertyID == 0 ifTrue:[
- "invalid olvwm behavior"
- s := self getLastCopyBuffer
+ "invalid olvwm behavior"
+ s := self getLastCopyBuffer
] ifFalse:[
- targetID == (self atomIDOf:#STRING) ifTrue:[
- "
- a returned string
- "
- s := self getTextProperty:propertyID from:requestorID.
- s notNil ifTrue:[
- (s endsWith:Character cr) ifTrue:[
- s := s asStringCollection copyWith:''
- ]
- ]
- ] ifFalse:[
- "
- a returned object
- "
- s := self getObjectProperty:propertyID from:requestorID.
- ].
+ targetID == (self atomIDOf:#STRING) ifTrue:[
+ "
+ a returned string
+ "
+ s := self getTextProperty:propertyID from:requestorID.
+ s notNil ifTrue:[
+ (s endsWith:Character cr) ifTrue:[
+ s := s asStringCollection copyWith:''
+ ]
+ ]
+ ] ifFalse:[
+ "
+ a returned object
+ "
+ s := self getObjectProperty:propertyID from:requestorID.
+ ].
].
s notNil ifTrue:[
- (sensor := aView sensor) notNil ifTrue:[
- sensor pasteFromClipBoard:s view:aView
- ] ifFalse:[
- "
- if there is no sensor ...
- "
- aView pasteFromClipBoard:s
- ]
+ (sensor := aView sensor) notNil ifTrue:[
+ sensor pasteFromClipBoard:s view:aView
+ ] ifFalse:[
+ "
+ if there is no sensor ...
+ "
+ aView pasteFromClipBoard:s
+ ]
]
!
@@ -6471,36 +6477,36 @@
|s sensor|
propertyID == 0 ifTrue:[
- "invalid olvwm behavior"
- s := self getLastCopyBuffer
+ "invalid olvwm behavior"
+ s := self getLastCopyBuffer
] ifFalse:[
- targetID == (self atomIDOf:#STRING) ifTrue:[
- "
- a returned string
- "
- s := self getTextProperty:propertyID from:requestorID.
- s notNil ifTrue:[
- (s endsWith:Character cr) ifTrue:[
- s := s asStringCollection copyWith:''
- ]
- ]
- ] ifFalse:[
- "
- a returned object
- "
- s := self getObjectProperty:propertyID from:requestorID.
- ].
+ targetID == (self atomIDOf:#STRING) ifTrue:[
+ "
+ a returned string
+ "
+ s := self getTextProperty:propertyID from:requestorID.
+ s notNil ifTrue:[
+ (s endsWith:Character cr) ifTrue:[
+ s := s asStringCollection copyWith:''
+ ]
+ ]
+ ] ifFalse:[
+ "
+ a returned object
+ "
+ s := self getObjectProperty:propertyID from:requestorID.
+ ].
].
s notNil ifTrue:[
- (sensor := aView sensor) notNil ifTrue:[
- sensor pasteFromClipBoard:s view:aView
- ] ifFalse:[
- "
- if there is no sensor ...
- "
- aView pasteFromClipBoard:s
- ]
+ (sensor := aView sensor) notNil ifTrue:[
+ sensor pasteFromClipBoard:s view:aView
+ ] ifFalse:[
+ "
+ if there is no sensor ...
+ "
+ aView pasteFromClipBoard:s
+ ]
]
!
@@ -10469,6 +10475,13 @@
!XWorkstation methodsFor:'selections'!
+addSelectionHandler:aHandler
+ SelectionHandlers isNil ifTrue:[
+ SelectionHandlers := IdentitySet new.
+ ].
+ SelectionHandlers add:aHandler
+!
+
getSelectionFor:drawableId
"get the object selection - either immediate, or asynchronous.
Returns nil, if async request is on its way"
@@ -10530,6 +10543,15 @@
"Modified: / 17.6.1998 / 17:12:05 / cg"
!
+removeSelectionHandler:aHandler
+ SelectionHandlers notNil ifTrue:[
+ SelectionHandlers remove:aHandler ifAbsent:nil.
+ SelectionHandlers isEmpty ifTrue:[
+ SelectionHandlers := nil
+ ]
+ ].
+!
+
requestSelection:selectionID property:propertyID type:typeID for:aWindowId
"ask the server to send us the selection - the view with id aWindowID
will later receive a SelectionNotify event for it (once the Xserver replies
@@ -10539,24 +10561,30 @@
Atom sel_prop;
char *cp;
- if (__isExternalAddress(aWindowId)
+ if ((__isExternalAddress(aWindowId) || (aWindowId == nil))
&& ISCONNECTED
&& __isSmallInteger(typeID)
&& __isAtomID(selectionID)) {
- Display *dpy = myDpy;
-
- if (XGetSelectionOwner(dpy, __AtomVal(selectionID)) == None) {
- /*
- * no owner of primary selection
- */
- RETURN (false);
- }
- /*
- * PRIMARY selection
- */
- XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
- __AtomVal(propertyID), __WindowVal(aWindowId), CurrentTime);
- RETURN (true);
+ Display *dpy = myDpy;
+ Window w;
+
+ if (__isExternalAddress(aWindowId)) {
+ w = __WindowVal(aWindowId);
+ } else {
+ w = (Window)0;
+ }
+ if (XGetSelectionOwner(dpy, __AtomVal(selectionID)) == None) {
+ /*
+ * no owner of primary selection
+ */
+ RETURN (false);
+ }
+ /*
+ * PRIMARY selection
+ */
+ XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
+ __AtomVal(propertyID), w, CurrentTime);
+ RETURN (true);
}
%}.
self primitiveFailedOrClosedConnection.
@@ -10564,8 +10592,8 @@
"
Display requestSelection:(Display atomIDOf:'PRIMARY')
- property:(Display atomIDOf:'VT_SELECTION')
- for:0
+ property:(Display atomIDOf:'VT_SELECTION')
+ for:0
"
!
@@ -11761,6 +11789,7 @@
!XWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.413 2002-09-25 16:13:57 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.414 2002-10-31 20:20:17 cg Exp $'
! !
+
XWorkstation initialize!