--- a/Make.proto Fri Mar 31 04:57:21 1995 +0200
+++ b/Make.proto Fri Mar 31 04:59:23 1995 +0200
@@ -1,4 +1,4 @@
-# $Header: /cvs/stx/stx/libview/Make.proto,v 1.23 1995-03-25 22:16:36 claus Exp $
+# $Header: /cvs/stx/stx/libview/Make.proto,v 1.24 1995-03-31 02:59:09 claus Exp $
#
# -------------- no need to change anything below ----------
@@ -69,6 +69,7 @@
WSensor.$(O) \
WEvent.$(O) \
WGroup.$(O) \
+ KeybdFwd.$(O) \
KeybdMap.$(O) \
RsrcPack.$(O) \
ViewStyle.$(O) \
@@ -171,6 +172,7 @@
WGroup.$(O): WGroup.st $(OBJECT)
WEvent.$(O): WEvent.st $(OBJECT)
KeybdMap.$(O): KeybdMap.st $(I)/IdDict.H $(OBJECT)
+KeybdFwd.$(O): KeybdFwd.st $(OBJECT)
Model.$(O): Model.st $(OBJECT)
AppModel.$(O): AppModel.st $(I)/Model.H $(OBJECT)
Controll.$(O): Controll.st $(OBJECT)
@@ -216,3 +218,5 @@
PCXReader.$(O): PCXReader.st $(IMAGERDR)
XPMReader.$(O): XPMReader.st $(IMAGERDR)
TargaReader.$(O): TargaReader.st $(IMAGERDR)
+
+Colormap.$(O): Colormap.st $(I)/SeqColl.H $(OBJECT)
--- a/ModalBox.st Fri Mar 31 04:57:21 1995 +0200
+++ b/ModalBox.st Fri Mar 31 04:59:23 1995 +0200
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1990 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.19 1995-03-26 20:12:51 claus Exp $
+$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.20 1995-03-31 02:57:28 claus Exp $
'!
!ModalBox class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.19 1995-03-26 20:12:51 claus Exp $
+$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.20 1995-03-31 02:57:28 claus Exp $
"
!
@@ -356,7 +356,18 @@
useTransient ifTrue:[
device setTransient:drawableId for:(mainView id).
].
- super openModal:aBlock.
+
+ [
+ super openModal:aBlock.
+ ] valueNowOrOnUnwindDo:[
+ "
+ restore cursors in the main group
+ "
+ mainGroup notNil ifTrue:[
+ mainGroup restoreCursors
+ ]
+ ].
+
mainGroup notNil ifTrue:[
"
flush any key & mouse events which arrived
@@ -686,14 +697,6 @@
!ModalBox methodsFor:'private'!
leaveControl
- |g|
-
- windowGroup notNil ifTrue:[
- g := windowGroup mainGroup.
- g notNil ifTrue:[
- g restoreCursors
- ]
- ].
exclusiveKeyboard ifTrue:[
device ungrabKeyboard
]
--- a/PseudoV.st Fri Mar 31 04:57:21 1995 +0200
+++ b/PseudoV.st Fri Mar 31 04:59:23 1995 +0200
@@ -26,7 +26,7 @@
COPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/Attic/PseudoV.st,v 1.31 1995-03-25 22:13:01 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/PseudoV.st,v 1.32 1995-03-31 02:57:40 claus Exp $
'!
!PseudoView class methodsFor:'documentation'!
@@ -47,7 +47,7 @@
version
"
-$Header: /cvs/stx/stx/libview/Attic/PseudoV.st,v 1.31 1995-03-25 22:13:01 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/PseudoV.st,v 1.32 1995-03-31 02:57:40 claus Exp $
"
!
@@ -912,14 +912,14 @@
!PseudoView methodsFor:'selection handling '!
-selectionClear
+selectionClear:selectionID
"someone else has the selection"
"
I disabled that; some windowmanagers (programs) seem to clear our
selection too often .... (or did I make a mistake somewhere ?)
"
-"/ Smalltalk at:#CopyBuffer put:nil.
+ Smalltalk at:#CopyBuffer put:nil.
!
getSelection
@@ -999,6 +999,7 @@
sendSelection:s
property:propertyID
target:targetID
+ from:windowID
to:windowID
] ifFalse:[
stream := WriteStream on:(ByteArray new:200).
@@ -1007,6 +1008,7 @@
sendSelection:(stream contents)
property:propertyID
target:(device atomIDOf:'ST_OBJECT' create:true)
+ from:windowID
to:windowID
]
!
@@ -1382,10 +1384,10 @@
gcId := nil.
drawableId := nil.
-"/ self recreate.
-"/ realized ifTrue:[
-"/ self rerealize
-"/ ]
+ self recreate.
+ realized ifTrue:[
+ self rerealize
+ ]
"
|s|
--- a/View.st Fri Mar 31 04:57:21 1995 +0200
+++ b/View.st Fri Mar 31 04:59:23 1995 +0200
@@ -18,7 +18,7 @@
extentChanged originChanged cornerChanged relativeOrigin
relativeExtent relativeCorner originRule extentRule cornerRule
insets shown hidden name level margin innerClipRect shadowColor
- lightColor viewOrigin bitGravity viewGravity keyboardHandler
+ lightColor bitGravity viewGravity
model controller windowGroup aspectSymbol changeSymbol menuSymbol'
classVariableNames:'Grey CentPoint ViewSpacing DefaultStyle StyleSheet
DefaultViewBackgroundColor DefaultBorderColor DefaultLightColor
@@ -34,7 +34,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/View.st,v 1.38 1995-03-26 20:13:34 claus Exp $
+$Header: /cvs/stx/stx/libview/View.st,v 1.39 1995-03-31 02:58:01 claus Exp $
'!
!View class methodsFor:'documentation'!
@@ -55,7 +55,7 @@
version
"
-$Header: /cvs/stx/stx/libview/View.st,v 1.38 1995-03-26 20:13:34 claus Exp $
+$Header: /cvs/stx/stx/libview/View.st,v 1.39 1995-03-31 02:58:01 claus Exp $
"
!
@@ -93,12 +93,10 @@
innerClipRect <Rectangle> convenient inner clip (minus margin)
shadowColor <Color> color used to draw 3D shadowed edges
lightColor <Color> color used to draw 3D lighted edges
- viewOrigin <Point> origin within model
contentsChanngeAction <Block> action to perform when model contents changes
originChangeAction <Block> action to perform when model origin changes
bitGravity <nil | Symbol> gravity of contents (if device supports it)
viewGravity <nil | Symbol> gravity of view (if device supports it)
- keyboardHandler <nil | any> gets keyboard input if non-nil
model <nil | any> the model (if any)
controller <nil | Controller> the controller (if any)
@@ -2257,7 +2255,6 @@
"/ rightInset := 0.
"/ bottomInset := 0.
- viewOrigin := 0@0.
originChanged := extentChanged := false.
bitGravity := nil.
viewGravity := nil.
@@ -2839,9 +2836,9 @@
!
keyPress:key x:x y:y
- "a key has been pressed.
- if there is a keyboardHandler, pass input to him;
- otherwise forward it to the superview, if there is any."
+ "a key has been pressed. If there are components,
+ pass it to the corresponding one.
+ Otherwise, forward it to the superview, if there is any."
components notNil ifTrue:[
components do:[:aComponent |
@@ -2856,30 +2853,15 @@
]
].
- "
- allow forwarding events to the keyboardhandler
- "
- keyboardHandler notNil ifTrue:[
- ^ keyboardHandler keyPress:key x:x y:y
- ].
-
- "
- mhmh: consider this a kludge:
- if there is a key-event in a subview, AND the key is not handled
- in the subview (such as SHIFT_L), AND the subviews topview has set
- a keyboardHandler, which is the original subview,
- THEN we are cought in a recursive loop as:
- subview keyPress -> superView keyPress -> handler(==subview) keyPress
-
- the following kludge checks for this, and breaks out.
- Do you have any better idea ?
- "
- thisContext isRecursive ifTrue:[^ self].
-
- superView notNil ifTrue:[
- superView keyPress:key x:x y:y
- ] ifFalse:[
- super keyPress:key x:x y:y
+ x >= 0 ifTrue:[
+ superView notNil ifTrue:[
+ WindowEvent
+ sendEvent:#keyPress:x:y:
+ arguments:(Array with:key with:x with:y)
+ view:superView
+ ] ifFalse:[
+ super keyPress:key x:x y:y
+ ]
]
!
@@ -2933,12 +2915,6 @@
^ borderWidth
!
-keyboardHandler:someOne
- "set my keyboardHandler"
-
- keyboardHandler := someOne
-!
-
borderWidth:aNumber
"set my borderWidth"
--- a/XWorkstat.st Fri Mar 31 04:57:21 1995 +0200
+++ b/XWorkstat.st Fri Mar 31 04:59:23 1995 +0200
@@ -17,6 +17,7 @@
blackpixel whitepixel redMask greenMask blueMask
protocolsAtom deleteWindowAtom saveYourselfAtom
quitAppAtom
+ primaryAtom secondaryAtom cutBuffer0Atom stringAtom
listOfXFonts eventRootX eventRootY buttonsPressed
displayName eventTrace
dispatchingExpose
@@ -30,7 +31,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.37 1995-03-26 20:14:10 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.38 1995-03-31 02:58:45 claus Exp $
'!
!XWorkstation class methodsFor:'documentation'!
@@ -51,7 +52,7 @@
version
"
-$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.37 1995-03-26 20:14:10 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.38 1995-03-31 02:58:45 claus Exp $
"
!
@@ -203,6 +204,9 @@
static unsigned lastRequestCode = 0;
static unsigned lastMinorCode = 0;
static unsigned lastResource = 0;
+
+static int __debug__ = 0;
+#define DPRINTF(x) if (__debug__) { printf x; }
%}
! !
@@ -296,6 +300,13 @@
!XWorkstation class methodsFor:'error handling'!
+debug:aBoolean
+%{ /* NOCONTEXT */
+
+ __debug__ = (aBoolean == true) ? 1 : 0;
+%}
+!
+
requestCodeOfLastError
%{ /* NOCONTEXT */
@@ -521,6 +532,11 @@
_INST(blueMask) = _MKSMALLINT(visual->blue_mask);
XSetErrorHandler(__XErrorHandler__);
+
+ _INST(primaryAtom) = MKOBJ( XA_PRIMARY );
+ _INST(secondaryAtom) = MKOBJ( XA_SECONDARY );
+ _INST(cutBuffer0Atom) = MKOBJ( XA_CUT_BUFFER0 );
+ _INST(stringAtom) = MKOBJ( XA_STRING );
}
END_INTERRUPTSBLOCKED
@@ -547,6 +563,7 @@
deleteWindowAtom := nil.
saveYourselfAtom := nil.
quitAppAtom := nil.
+
self initializeKeyboardMap.
ObjectMemory errorInterruptHandler:self class.
@@ -876,7 +893,7 @@
%{ /* NOCONTEXT */
RETURN (_MKSMALLINT( ExposureMask | StructureNotifyMask |
- KeyPressMask | EnterWindowMask | LeaveWindowMask |
+ KeyPressMask |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask ));
%}
!
@@ -1557,7 +1574,7 @@
#ifdef OLD
/* these may not be disabled */
xswa.event_mask |= ExposureMask | StructureNotifyMask |
- KeyPressMask | EnterWindowMask | LeaveWindowMask |
+ KeyPressMask |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
#endif
@@ -1829,7 +1846,11 @@
].
s := WriteStream on:(ByteArray new:200).
anObject storeBinaryOn:s.
- ^ self setProperty:propertyID type:(self atomIDOf:'ST_OBJECT' create:true) value:(s contents) for:aWindowID
+ ^ self
+ setProperty:propertyID
+ type:(self atomIDOf:'ST_OBJECT' create:true)
+ value:(s contents)
+ for:aWindowID
!
setProperty:propertyID type:typeID value:anObject for:aWindowID
@@ -1869,8 +1890,10 @@
!
getTextProperty:propertyID from:aWindowID
+ "get a text property; return string or nil"
+
self getProperty:propertyID from:aWindowID into:[:type :value |
- type == (self atomIDOf:'STRING') ifTrue:[
+ type == stringAtom ifTrue:[
^ value
]
].
@@ -1878,8 +1901,10 @@
!
getObjectProperty:propertyID from:aWindowID
+ "get an object property; return object or nil"
+
self getProperty:propertyID from:aWindowID into:[:type :value |
- type == (self atomIDOf:'STRING') ifTrue:[
+ type == stringAtom ifTrue:[
^ value
].
(value isMemberOf:ByteArray) ifTrue:[
@@ -1890,6 +1915,8 @@
!
getProperty:propertyID from:aWindowID into:aTwoArgBlock
+ "get a property, evaluate aTwoArgBlock with typeID and value"
+
|val typeID cls|
cls := ByteArray.
@@ -1970,6 +1997,7 @@
!
getSelectionOwnerOf:selectionID
+ "get the owner of a selection"
%{
Display *dpy = myDpy;
Atom selection;
@@ -1988,6 +2016,7 @@
!
setSelectionOwner:aWindowId of:selectionID
+ "set the owner of a selection; return false if failed"
%{
Display *dpy = myDpy;
@@ -2010,7 +2039,7 @@
^ self requestSelection:selectionID
property:propertyID
- type:(self atomIDOf:'ST_OBJECT')
+ type:(self atomIDOf:'ST_OBJECT' create:true)
for:aWindowId
!
@@ -2020,7 +2049,7 @@
^ self requestSelection:selectionID
property:propertyID
- type:(self atomIDOf:'STRING')
+ type:stringAtom
for:aWindowId
!
@@ -2058,17 +2087,34 @@
"
!
+atomIDOfPRIMARY
+ ^ primaryAtom
+!
+
+atomIDOfSECONDARY
+ ^ secondaryAtom
+!
+
+atomIDOfSTRING
+ ^ stringAtom
+!
+
atomIDOf:aStringOrSymbol
+ "return an Atoms ID; dont create if not already present"
+
^ self atomIDOf:aStringOrSymbol create:false
!
atomIDOf:aStringOrSymbol create:create
+ "return an Atoms ID; if create is true, create it if not already present"
+
%{ /* NOCONTEXT */
Atom prop;
if (__isString(aStringOrSymbol)
|| __isSymbol(aStringOrSymbol)) {
- prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol), (create == true) ? False : True);
+ prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol),
+ (create == true) ? False : True);
if (prop == None) {
RETURN (nil);
}
@@ -2086,43 +2132,69 @@
"
!
-sendSelection:something property:propertyID target:targetID to:requestorID
+sendSelection:something property:propertyID target:targetID from:windowID to:requestorID
+ "send aString back from a SelectionRequest"
+
+ self
+ sendSelection:something
+ selection:primaryAtom
+ property:propertyID
+ target:targetID
+ from:windowID
+ to:requestorID
+!
+
+sendSelection:something selection:selectionID property:propertyID target:targetID from:windowID to:requestorID
"send aString back from a SelectionRequest"
+
+ self
+ setProperty:propertyID
+ type:targetID
+ value:something
+ for:requestorID.
+ self
+ sendSelectionNotifySelection:selectionID
+ property:propertyID
+ target:targetID
+ from:windowID
+ to:requestorID.
+!
+
+sendSelectionNotifySelection:selectionID property:propertyID target:targetID from:windowID to:requestorID
+ "send a selectionNotify back from a SelectionRequest"
%{
Display *dpy = myDpy;
if (__bothSmallInteger(propertyID, requestorID)
- && __isSmallInteger(targetID)
- && (__isString(something) || __isByteArray(something))) {
+ && __bothSmallInteger(targetID, selectionID)) {
XEvent ev;
int requestor = (int)(_AtomVal(requestorID));
int property = (int)(_AtomVal(propertyID));
int target = (int)(_AtomVal(targetID));
- unsigned char *p;
- int sz;
+ int selection = (int)(_AtomVal(selectionID));
+ Status result;
ev.xselection.type = SelectionNotify;
- ev.xselection.selection = XA_PRIMARY;
- ev.xselection.target = target /* XA_STRING */;
- ev.xselection.requestor = requestor;
+ ev.xselection.selection = selection;
+ ev.xselection.target = target;
+ if (_isSmallInteger(windowID))
+ ev.xselection.requestor = _WindowVal(windowID);
+ else
+ ev.xselection.requestor = DefaultRootWindow(dpy);
ev.xselection.time = CurrentTime;
- if (__isString(something)) {
- p = (unsigned char *) _stringVal(something);
- sz = strlen(p);
- } else {
- p = _ByteArrayInstPtr(something)->ba_element;
- sz = _byteArraySize(something);
- }
- XChangeProperty(dpy, requestor, property, target, 8, PropModeReplace,
- p, sz);
ev.xselection.property = property;
-/*
- printf("sending SelectionNotify prop=%x target=%x requestor=%x\n",
+
+ DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n",
+ ev.xselection.selection,
ev.xselection.property,
ev.xselection.target,
- ev.xselection.requestor);
-*/
- XSendEvent(dpy, requestor, False, 0 , &ev);
+ ev.xselection.requestor,
+ requestor));
+
+ result = XSendEvent(dpy, requestor, False, 0 , &ev);
+ if ((result == BadValue) || (result == BadWindow)) {
+ DPRINTF(("bad status\n"));
+ }
RETURN (self )
}
%}
@@ -2134,17 +2206,15 @@
"get the text selection - either immediate, or asynchronous.
Returns nil, if async request is on its way"
- |primary cutBuffer selProp sel|
-
- primary := self atomIDOf:'PRIMARY'.
- (self getSelectionOwnerOf:primary) isNil ifTrue:[
+ |selProp sel|
+
+ (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
"no primary selection - use cut buffer"
- cutBuffer := self atomIDOf:'CUT_BUFFER0'.
- sel := self getTextProperty:cutBuffer from:nil.
+ sel := self getTextProperty:cutBuffer0Atom from:nil.
^ sel
].
- selProp := self atomIDOf:'VT_SELECTION'.
- self requestTextSelection:primary property:selProp for:drawableId.
+ selProp := self atomIDOf:'VT_SELECTION' create:true.
+ self requestTextSelection:primaryAtom property:selProp for:drawableId.
^ nil
!
@@ -2152,17 +2222,15 @@
"get the object selection - either immediate, or asynchronous.
Returns nil, if async request is on its way"
- |primary cutBuffer selProp sel|
-
- primary := self atomIDOf:'PRIMARY'.
- (self getSelectionOwnerOf:primary) isNil ifTrue:[
+ |selProp sel|
+
+ (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
"no primary selection - use cut buffer"
- cutBuffer := self atomIDOf:'ST_CUT_BUFFER0' create:true.
- sel := self getObjectProperty:cutBuffer from:nil.
+ sel := self getObjectProperty:cutBuffer0Atom from:nil.
^ sel
].
selProp := self atomIDOf:'ST_SELECTION' create:true.
- self requestObjectSelection:primary property:selProp for:drawableId.
+ self requestObjectSelection:primaryAtom property:selProp for:drawableId.
^ nil
!
@@ -2170,28 +2238,22 @@
"set the text selection, and make aWindowId be the owner.
This can be used by any other X application."
- |primary cutBuffer|
-
- primary := self atomIDOf:'PRIMARY'.
- (self setSelectionOwner:aWindowId of:primary) ifFalse:[
+ |cutBuffer|
+
+ (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
'ownerchange failed' errorPrintNL.
].
- cutBuffer := self atomIDOf:'CUT_BUFFER0'.
- ^ self setTextProperty:cutBuffer value:aString for:nil
+ ^ self setTextProperty:cutBuffer0Atom value:aString for:nil
!
setSelection:anObject owner:aWindowId
"set the object selection, and make aWindowId be the owner.
This can be used by other Smalltalk(X) applications only."
- |primary cutBuffer|
-
- primary := self atomIDOf:'PRIMARY'.
- (self setSelectionOwner:aWindowId of:primary) ifFalse:[
+ (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
^ false
].
-"/ cutBuffer := self atomIDOf:'ST_CUT_BUFFER0' create:true.
-"/ ^ self setObjectProperty:cutBuffer value:anObject for:nil
+"/ ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil
^ true
! !
@@ -5365,7 +5427,7 @@
static struct inlineCache confReq = _ILC0;
static struct inlineCache resReq = _ILC0;
static struct inlineCache prop = _ILC0;
- static struct inlineCache selClear = _ILC0;
+ static struct inlineCache selClear = _ILC1;
static struct inlineCache selReq = _ILC4;
static struct inlineCache selNotify = _ILC4;
static struct inlineCache colormap = _ILC0;
@@ -5716,18 +5778,19 @@
case SelectionClear:
(*selClear.ilc_func)(theView,
- @symbol(selectionClear)
- COMMA_CON, nil, &selClear);
+ @symbol(selectionClear:)
+ COMMA_CON, nil, &selClear,
+ MKOBJ(__ev__.xselectionclear.selection));
break;
case SelectionNotify:
/*
* returned selection value (answer from SelectionRequest)
*/
-/*
- printf("SelectionNotify prop=%x requestor=%x\n", __ev__.xselection.property,
- __ev__.xselection.requestor);
-*/
+ DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n",
+ __ev__.xselection.property, __ev__.xselection.target,
+ __ev__.xselection.selection, __ev__.xselection.requestor));
+
(*selNotify.ilc_func)(theView,
@symbol(selectionNotify:target:selection:from:)
COMMA_CON, nil, &selNotify,
@@ -5738,13 +5801,15 @@
break;
case SelectionRequest:
-/*
- printf("SelectionRequest prop=%x requestor=%x target=%x selection=%x\n",
- __ev__.xselectionrequest.property,
- __ev__.xselectionrequest.requestor,
- __ev__.xselectionrequest.target,
- __ev__.xselectionrequest.selection);
-*/
+ /*
+ * someone wants the selection
+ */
+ DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n",
+ __ev__.xselectionrequest.property,
+ __ev__.xselectionrequest.target,
+ __ev__.xselectionrequest.selection,
+ __ev__.xselectionrequest.requestor));
+
(*selReq.ilc_func)(theView,
@symbol(selectionRequest:target:selection:from:)
COMMA_CON, nil, &selReq,
--- a/XWorkstation.st Fri Mar 31 04:57:21 1995 +0200
+++ b/XWorkstation.st Fri Mar 31 04:59:23 1995 +0200
@@ -17,6 +17,7 @@
blackpixel whitepixel redMask greenMask blueMask
protocolsAtom deleteWindowAtom saveYourselfAtom
quitAppAtom
+ primaryAtom secondaryAtom cutBuffer0Atom stringAtom
listOfXFonts eventRootX eventRootY buttonsPressed
displayName eventTrace
dispatchingExpose
@@ -30,7 +31,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.37 1995-03-26 20:14:10 claus Exp $
+$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.38 1995-03-31 02:58:45 claus Exp $
'!
!XWorkstation class methodsFor:'documentation'!
@@ -51,7 +52,7 @@
version
"
-$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.37 1995-03-26 20:14:10 claus Exp $
+$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.38 1995-03-31 02:58:45 claus Exp $
"
!
@@ -203,6 +204,9 @@
static unsigned lastRequestCode = 0;
static unsigned lastMinorCode = 0;
static unsigned lastResource = 0;
+
+static int __debug__ = 0;
+#define DPRINTF(x) if (__debug__) { printf x; }
%}
! !
@@ -296,6 +300,13 @@
!XWorkstation class methodsFor:'error handling'!
+debug:aBoolean
+%{ /* NOCONTEXT */
+
+ __debug__ = (aBoolean == true) ? 1 : 0;
+%}
+!
+
requestCodeOfLastError
%{ /* NOCONTEXT */
@@ -521,6 +532,11 @@
_INST(blueMask) = _MKSMALLINT(visual->blue_mask);
XSetErrorHandler(__XErrorHandler__);
+
+ _INST(primaryAtom) = MKOBJ( XA_PRIMARY );
+ _INST(secondaryAtom) = MKOBJ( XA_SECONDARY );
+ _INST(cutBuffer0Atom) = MKOBJ( XA_CUT_BUFFER0 );
+ _INST(stringAtom) = MKOBJ( XA_STRING );
}
END_INTERRUPTSBLOCKED
@@ -547,6 +563,7 @@
deleteWindowAtom := nil.
saveYourselfAtom := nil.
quitAppAtom := nil.
+
self initializeKeyboardMap.
ObjectMemory errorInterruptHandler:self class.
@@ -876,7 +893,7 @@
%{ /* NOCONTEXT */
RETURN (_MKSMALLINT( ExposureMask | StructureNotifyMask |
- KeyPressMask | EnterWindowMask | LeaveWindowMask |
+ KeyPressMask |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask ));
%}
!
@@ -1557,7 +1574,7 @@
#ifdef OLD
/* these may not be disabled */
xswa.event_mask |= ExposureMask | StructureNotifyMask |
- KeyPressMask | EnterWindowMask | LeaveWindowMask |
+ KeyPressMask |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
#endif
@@ -1829,7 +1846,11 @@
].
s := WriteStream on:(ByteArray new:200).
anObject storeBinaryOn:s.
- ^ self setProperty:propertyID type:(self atomIDOf:'ST_OBJECT' create:true) value:(s contents) for:aWindowID
+ ^ self
+ setProperty:propertyID
+ type:(self atomIDOf:'ST_OBJECT' create:true)
+ value:(s contents)
+ for:aWindowID
!
setProperty:propertyID type:typeID value:anObject for:aWindowID
@@ -1869,8 +1890,10 @@
!
getTextProperty:propertyID from:aWindowID
+ "get a text property; return string or nil"
+
self getProperty:propertyID from:aWindowID into:[:type :value |
- type == (self atomIDOf:'STRING') ifTrue:[
+ type == stringAtom ifTrue:[
^ value
]
].
@@ -1878,8 +1901,10 @@
!
getObjectProperty:propertyID from:aWindowID
+ "get an object property; return object or nil"
+
self getProperty:propertyID from:aWindowID into:[:type :value |
- type == (self atomIDOf:'STRING') ifTrue:[
+ type == stringAtom ifTrue:[
^ value
].
(value isMemberOf:ByteArray) ifTrue:[
@@ -1890,6 +1915,8 @@
!
getProperty:propertyID from:aWindowID into:aTwoArgBlock
+ "get a property, evaluate aTwoArgBlock with typeID and value"
+
|val typeID cls|
cls := ByteArray.
@@ -1970,6 +1997,7 @@
!
getSelectionOwnerOf:selectionID
+ "get the owner of a selection"
%{
Display *dpy = myDpy;
Atom selection;
@@ -1988,6 +2016,7 @@
!
setSelectionOwner:aWindowId of:selectionID
+ "set the owner of a selection; return false if failed"
%{
Display *dpy = myDpy;
@@ -2010,7 +2039,7 @@
^ self requestSelection:selectionID
property:propertyID
- type:(self atomIDOf:'ST_OBJECT')
+ type:(self atomIDOf:'ST_OBJECT' create:true)
for:aWindowId
!
@@ -2020,7 +2049,7 @@
^ self requestSelection:selectionID
property:propertyID
- type:(self atomIDOf:'STRING')
+ type:stringAtom
for:aWindowId
!
@@ -2058,17 +2087,34 @@
"
!
+atomIDOfPRIMARY
+ ^ primaryAtom
+!
+
+atomIDOfSECONDARY
+ ^ secondaryAtom
+!
+
+atomIDOfSTRING
+ ^ stringAtom
+!
+
atomIDOf:aStringOrSymbol
+ "return an Atoms ID; dont create if not already present"
+
^ self atomIDOf:aStringOrSymbol create:false
!
atomIDOf:aStringOrSymbol create:create
+ "return an Atoms ID; if create is true, create it if not already present"
+
%{ /* NOCONTEXT */
Atom prop;
if (__isString(aStringOrSymbol)
|| __isSymbol(aStringOrSymbol)) {
- prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol), (create == true) ? False : True);
+ prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol),
+ (create == true) ? False : True);
if (prop == None) {
RETURN (nil);
}
@@ -2086,43 +2132,69 @@
"
!
-sendSelection:something property:propertyID target:targetID to:requestorID
+sendSelection:something property:propertyID target:targetID from:windowID to:requestorID
+ "send aString back from a SelectionRequest"
+
+ self
+ sendSelection:something
+ selection:primaryAtom
+ property:propertyID
+ target:targetID
+ from:windowID
+ to:requestorID
+!
+
+sendSelection:something selection:selectionID property:propertyID target:targetID from:windowID to:requestorID
"send aString back from a SelectionRequest"
+
+ self
+ setProperty:propertyID
+ type:targetID
+ value:something
+ for:requestorID.
+ self
+ sendSelectionNotifySelection:selectionID
+ property:propertyID
+ target:targetID
+ from:windowID
+ to:requestorID.
+!
+
+sendSelectionNotifySelection:selectionID property:propertyID target:targetID from:windowID to:requestorID
+ "send a selectionNotify back from a SelectionRequest"
%{
Display *dpy = myDpy;
if (__bothSmallInteger(propertyID, requestorID)
- && __isSmallInteger(targetID)
- && (__isString(something) || __isByteArray(something))) {
+ && __bothSmallInteger(targetID, selectionID)) {
XEvent ev;
int requestor = (int)(_AtomVal(requestorID));
int property = (int)(_AtomVal(propertyID));
int target = (int)(_AtomVal(targetID));
- unsigned char *p;
- int sz;
+ int selection = (int)(_AtomVal(selectionID));
+ Status result;
ev.xselection.type = SelectionNotify;
- ev.xselection.selection = XA_PRIMARY;
- ev.xselection.target = target /* XA_STRING */;
- ev.xselection.requestor = requestor;
+ ev.xselection.selection = selection;
+ ev.xselection.target = target;
+ if (_isSmallInteger(windowID))
+ ev.xselection.requestor = _WindowVal(windowID);
+ else
+ ev.xselection.requestor = DefaultRootWindow(dpy);
ev.xselection.time = CurrentTime;
- if (__isString(something)) {
- p = (unsigned char *) _stringVal(something);
- sz = strlen(p);
- } else {
- p = _ByteArrayInstPtr(something)->ba_element;
- sz = _byteArraySize(something);
- }
- XChangeProperty(dpy, requestor, property, target, 8, PropModeReplace,
- p, sz);
ev.xselection.property = property;
-/*
- printf("sending SelectionNotify prop=%x target=%x requestor=%x\n",
+
+ DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n",
+ ev.xselection.selection,
ev.xselection.property,
ev.xselection.target,
- ev.xselection.requestor);
-*/
- XSendEvent(dpy, requestor, False, 0 , &ev);
+ ev.xselection.requestor,
+ requestor));
+
+ result = XSendEvent(dpy, requestor, False, 0 , &ev);
+ if ((result == BadValue) || (result == BadWindow)) {
+ DPRINTF(("bad status\n"));
+ }
RETURN (self )
}
%}
@@ -2134,17 +2206,15 @@
"get the text selection - either immediate, or asynchronous.
Returns nil, if async request is on its way"
- |primary cutBuffer selProp sel|
-
- primary := self atomIDOf:'PRIMARY'.
- (self getSelectionOwnerOf:primary) isNil ifTrue:[
+ |selProp sel|
+
+ (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
"no primary selection - use cut buffer"
- cutBuffer := self atomIDOf:'CUT_BUFFER0'.
- sel := self getTextProperty:cutBuffer from:nil.
+ sel := self getTextProperty:cutBuffer0Atom from:nil.
^ sel
].
- selProp := self atomIDOf:'VT_SELECTION'.
- self requestTextSelection:primary property:selProp for:drawableId.
+ selProp := self atomIDOf:'VT_SELECTION' create:true.
+ self requestTextSelection:primaryAtom property:selProp for:drawableId.
^ nil
!
@@ -2152,17 +2222,15 @@
"get the object selection - either immediate, or asynchronous.
Returns nil, if async request is on its way"
- |primary cutBuffer selProp sel|
-
- primary := self atomIDOf:'PRIMARY'.
- (self getSelectionOwnerOf:primary) isNil ifTrue:[
+ |selProp sel|
+
+ (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
"no primary selection - use cut buffer"
- cutBuffer := self atomIDOf:'ST_CUT_BUFFER0' create:true.
- sel := self getObjectProperty:cutBuffer from:nil.
+ sel := self getObjectProperty:cutBuffer0Atom from:nil.
^ sel
].
selProp := self atomIDOf:'ST_SELECTION' create:true.
- self requestObjectSelection:primary property:selProp for:drawableId.
+ self requestObjectSelection:primaryAtom property:selProp for:drawableId.
^ nil
!
@@ -2170,28 +2238,22 @@
"set the text selection, and make aWindowId be the owner.
This can be used by any other X application."
- |primary cutBuffer|
-
- primary := self atomIDOf:'PRIMARY'.
- (self setSelectionOwner:aWindowId of:primary) ifFalse:[
+ |cutBuffer|
+
+ (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
'ownerchange failed' errorPrintNL.
].
- cutBuffer := self atomIDOf:'CUT_BUFFER0'.
- ^ self setTextProperty:cutBuffer value:aString for:nil
+ ^ self setTextProperty:cutBuffer0Atom value:aString for:nil
!
setSelection:anObject owner:aWindowId
"set the object selection, and make aWindowId be the owner.
This can be used by other Smalltalk(X) applications only."
- |primary cutBuffer|
-
- primary := self atomIDOf:'PRIMARY'.
- (self setSelectionOwner:aWindowId of:primary) ifFalse:[
+ (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
^ false
].
-"/ cutBuffer := self atomIDOf:'ST_CUT_BUFFER0' create:true.
-"/ ^ self setObjectProperty:cutBuffer value:anObject for:nil
+"/ ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil
^ true
! !
@@ -5365,7 +5427,7 @@
static struct inlineCache confReq = _ILC0;
static struct inlineCache resReq = _ILC0;
static struct inlineCache prop = _ILC0;
- static struct inlineCache selClear = _ILC0;
+ static struct inlineCache selClear = _ILC1;
static struct inlineCache selReq = _ILC4;
static struct inlineCache selNotify = _ILC4;
static struct inlineCache colormap = _ILC0;
@@ -5716,18 +5778,19 @@
case SelectionClear:
(*selClear.ilc_func)(theView,
- @symbol(selectionClear)
- COMMA_CON, nil, &selClear);
+ @symbol(selectionClear:)
+ COMMA_CON, nil, &selClear,
+ MKOBJ(__ev__.xselectionclear.selection));
break;
case SelectionNotify:
/*
* returned selection value (answer from SelectionRequest)
*/
-/*
- printf("SelectionNotify prop=%x requestor=%x\n", __ev__.xselection.property,
- __ev__.xselection.requestor);
-*/
+ DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n",
+ __ev__.xselection.property, __ev__.xselection.target,
+ __ev__.xselection.selection, __ev__.xselection.requestor));
+
(*selNotify.ilc_func)(theView,
@symbol(selectionNotify:target:selection:from:)
COMMA_CON, nil, &selNotify,
@@ -5738,13 +5801,15 @@
break;
case SelectionRequest:
-/*
- printf("SelectionRequest prop=%x requestor=%x target=%x selection=%x\n",
- __ev__.xselectionrequest.property,
- __ev__.xselectionrequest.requestor,
- __ev__.xselectionrequest.target,
- __ev__.xselectionrequest.selection);
-*/
+ /*
+ * someone wants the selection
+ */
+ DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n",
+ __ev__.xselectionrequest.property,
+ __ev__.xselectionrequest.target,
+ __ev__.xselectionrequest.selection,
+ __ev__.xselectionrequest.requestor));
+
(*selReq.ilc_func)(theView,
@symbol(selectionRequest:target:selection:from:)
COMMA_CON, nil, &selReq,
--- a/styles/generic.style Fri Mar 31 04:57:21 1995 +0200
+++ b/styles/generic.style Fri Mar 31 04:59:23 1995 +0200
@@ -26,7 +26,7 @@
; all of them for new styles.
;
;
-; $Header: /cvs/stx/stx/libview/styles/generic.style,v 1.1 1995-03-23 16:54:36 claus Exp $
+; $Header: /cvs/stx/stx/libview/styles/generic.style,v 1.2 1995-03-31 02:59:18 claus Exp $
;
; agenda:
@@ -49,7 +49,19 @@
; ...
; #endif
; For example, colors can be set different for mono vs. color displays.
-
+; else constructs are possible too:
+; #if <st-expression>
+; ...
+; #else
+; ...
+; #endif
+;
+; finally, other files can be included:
+;
+; ...
+; #include 'filename'
+; ...
+;
; ----------------------------------------------------------------------------
; if it some type of 3D style
--- a/styles/iris.style Fri Mar 31 04:57:21 1995 +0200
+++ b/styles/iris.style Fri Mar 31 04:59:23 1995 +0200
@@ -3,7 +3,7 @@
; silicon graphics style
; (somwehat like motif, but with smooth edges and bells&whistles)
;
-; $Header: /cvs/stx/stx/libview/styles/iris.style,v 1.1 1995-03-23 16:54:41 claus Exp $
+; $Header: /cvs/stx/stx/libview/styles/iris.style,v 1.2 1995-03-31 02:59:23 claus Exp $
is3D true
name #iris
@@ -52,7 +52,9 @@
#endif
editFieldFont Font family:'screen' face:'bold' style:'roman' size:16
-selectionFont Font family:'helvetica' face:'medium' style:'roman' size:12
+variableFont Font family:'helvetica' face:'medium' style:'roman' size:12
+selectionFont =variableFont
+labelFont =variableFont
#if Display hasColors
toggleShowLamp true