--- a/XWorkstation.st Tue Feb 11 20:40:39 2003 +0100
+++ b/XWorkstation.st Tue Feb 11 20:41:55 2003 +0100
@@ -9204,22 +9204,22 @@
atomSymbol := aStringOrSymbol asSymbol.
(atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[
- ^ atom.
+ ^ atom.
].
atom := self primAtomIDOf:atomSymbol create:create.
atom notNil ifTrue:[
- atoms isNil ifTrue:[
- atoms := IdentityDictionary new.
- ].
- atoms at:atomSymbol put:atom.
+ atoms isNil ifTrue:[
+ atoms := IdentityDictionary new.
+ ].
+ atoms at:atomSymbol put:atom.
].
^ atom
"
Display atomIDOf:#'VT_SELECTION' create:false
- Display atomIDOf:#'CUT_BUFFER0' create:false
+ Display atomIDOf:#CLIPBOARD create:false
Display atomIDOf:'STRING' create:false
Display atomIDOf:'PRIMARY' create:false
"
@@ -9541,6 +9541,17 @@
Smalltalk puts ST_OBJECT only into the CLIPBOARD"
+ |selectionOwnerWindowId|
+
+ selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom.
+ selectionOwnerWindowId isNil ifTrue:[
+ ^ nil "no selection"
+ ].
+"/ selectionOwnerWindowId == selectionOwner ifTrue:[
+"/ "I still hold the selection, so return it"
+"/ ^ copyBuffer
+"/ ].
+
self requestSelection:clipboardAtom
property:(self atomIDOf:#'ST_SELECTION')
type:(self atomIDOf:#'ST_OBJECT')
@@ -9554,7 +9565,7 @@
"get the text selection - either immediate, or asynchronous.
Returns nil, if async request is on its way"
- |selectionId|
+ |selectionId selectionOwnerWindowId|
selectionBufferSymbol == #selection ifTrue:[
selectionId := primaryAtom.
@@ -9562,6 +9573,16 @@
selectionId := clipboardAtom.
].
+ selectionOwnerWindowId := self getSelectionOwnerOf:selectionId.
+ selectionOwnerWindowId isNil ifTrue:[
+ ^ nil "no selection"
+ ].
+
+"/ selectionOwnerWindowId == selectionOwner ifTrue:[
+"/ "I still hold the selection, so return it"
+"/ ^ copyBuffer
+"/ ].
+
self requestSelection:selectionId
property:(self atomIDOf:#'VT_SELECTION')
type:stringAtom
@@ -9584,14 +9605,6 @@
|stream|
- aTargetAtom == (self atomIDOf:#LENGTH) ifTrue:[
- "the other one wants to know the size of our selection.
- LENGTH is deprecated, since we do not know how the selection is
- going to be converted. The client must not rely on the length returned"
-
- ^ self selectionAsString size
- ].
-
(aTargetAtom == (self atomIDOf:#STRING)) ifTrue:[
"the other view wants the selection as string"
^ self selectionAsString.
@@ -9609,6 +9622,14 @@
^ stream contents.
].
+ aTargetAtom == (self atomIDOf:#LENGTH) ifTrue:[
+ "the other one wants to know the size of our selection.
+ LENGTH is deprecated, since we do not know how the selection is
+ going to be converted. The client must not rely on the length returned"
+
+ ^ self selectionAsString size
+ ].
+
"we do not support the requestet target"
^ nil.
!
@@ -9669,7 +9690,7 @@
|supportedTargets numericTargetArray|
- supportedTargets := #(STRING LENGTH TARGETS ST_OBJECT).
+ supportedTargets := #(ST_OBJECT STRING TARGETS LENGTH).
numericTargetArray := IntegerArray new:supportedTargets size.
supportedTargets keysAndValuesDo:[:index :targetSymbol|
@@ -9737,18 +9758,11 @@
}
ENTER_XLIB();
- selectionOwner = XGetSelectionOwner(dpy, __AtomVal(selectionID));
- if (selectionOwner != None) {
- XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
- __AtomVal(propertyID), w, CurrentTime);
- }
+ XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
+ __AtomVal(propertyID), w, CurrentTime);
LEAVE_XLIB();
- if (selectionOwner == None) {
- RETURN(false);
- } else {
- RETURN (true);
- }
+ RETURN (true);
}
%}.
self primitiveFailedOrClosedConnection.
@@ -9757,7 +9771,8 @@
"
Display requestSelection:(Display atomIDOf:'PRIMARY')
property:(Display atomIDOf:'VT_SELECTION')
- for:0
+ type:(Display atomIDOf:'STRING')
+ for:nil
"
!
@@ -9857,10 +9872,12 @@
|selectionAtomID|
+ "/ selectionOwner := aWindowId.
+
selectionAtomSymbolOrID isString ifTrue:[
- selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
+ selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
] ifFalse:[
- selectionAtomID := selectionAtomSymbolOrID.
+ selectionAtomID := selectionAtomSymbolOrID.
].
%{
@@ -9869,19 +9886,19 @@
if (__isExternalAddress(aWindowId)
&& __isAtomID(selectionAtomID)
&& ISCONNECTED) {
- Display *dpy = myDpy;
- Window owner;
-
- win = __WindowVal(aWindowId);
- DPRINTF(("setOwner prop=%x win=%x\n", __AtomVal(selectionAtomID), win));
- ENTER_XLIB();
- XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, CurrentTime);
- owner = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
- LEAVE_XLIB();
- if (owner != win) {
- RETURN (false);
- }
- RETURN (true);
+ Display *dpy = myDpy;
+ Window owner;
+
+ win = __WindowVal(aWindowId);
+ DPRINTF(("setOwner prop=%x win=%x\n", __AtomVal(selectionAtomID), win));
+ ENTER_XLIB();
+ XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, CurrentTime);
+ owner = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
+ LEAVE_XLIB();
+ if (owner != win) {
+ RETURN (false);
+ }
+ RETURN (true);
}
%}.
self primitiveFailedOrClosedConnection.
@@ -11009,7 +11026,7 @@
!XWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.422 2003-02-11 15:00:24 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.423 2003-02-11 19:41:55 stefan Exp $'
! !
XWorkstation initialize!