--- a/XWorkstation.st Tue Jan 14 00:20:22 1997 +0100
+++ b/XWorkstation.st Tue Jan 14 00:41:03 1997 +0100
@@ -889,12 +889,13 @@
|xIconSizes count ret|
%{
- Display *dpy = myDpy;
int screen = __intVal(__INST(screen));
XIconSize *sizeList;
int cnt;
if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
if (XGetIconSizes(myDpy, RootWindow(dpy, screen), &sizeList, &cnt) > 0) {
xIconSizes = __MKEXTERNALBYTES(sizeList);
count = __MKSMALLINT(cnt);
@@ -973,11 +974,13 @@
|nFormats "{ Class: SmallInteger }"
formatArray|
%{
- Display *dpy = myDpy;
+ Display *dpy;
if (! ISCONNECTED) {
RETURN (nil);
}
+
+ dpy = myDpy;
nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
%}.
formatArray := Array new:nFormats.
@@ -1046,7 +1049,6 @@
|id w h|
%{
- Display *dpy = myDpy;
int screen = __intVal(__INST(screen));
Pixmap newBitmap;
char *filename;
@@ -1055,6 +1057,8 @@
int status;
if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
if (__isString(aString) || __isSymbol(aString)) {
filename = (char *)_stringVal(aString);
@@ -1087,11 +1091,12 @@
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
int screen = __intVal(__INST(screen));
Pixmap newBitmap;
if (__bothSmallInteger(w, h) && ISCONNECTED) {
+ Display *dpy = myDpy;
+
BEGIN_INTERRUPTSBLOCKED
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
__intVal(w), __intVal(h), 1);
@@ -1114,11 +1119,12 @@
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
int screen = __intVal(__INST(screen));
Pixmap newBitmap;
if (__bothSmallInteger(w, h) && ISCONNECTED) {
+ Display *dpy = myDpy;
+
BEGIN_INTERRUPTSBLOCKED
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
__intVal(w), __intVal(h), __intVal(d));
@@ -1611,7 +1617,7 @@
%{ /* UNLIMITEDSTACK */
- Display *dpy = myDpy;
+ Display *dpy;
int screen = __intVal(__INST(screen));
Pixmap newBitmap;
unsigned int b_width, b_height;
@@ -1631,6 +1637,8 @@
if (! ISCONNECTED) {
RETURN (nil);
}
+
+ dpy = myDpy;
if (firstCall) {
for (index=0; index < 256; index++) {
reverseBitTable[index] = 0;
@@ -1864,13 +1872,14 @@
%{ /* NOCONTEXT */
char *colorname;
- Display *dpy = myDpy;
XColor scolor, ecolor;
int screen = __intVal(__INST(screen));
int id;
Status ok;
if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
if (__isString(aString) || __isSymbol(aString)) {
colorname = (char *)_stringVal(aString);
@@ -1959,7 +1968,7 @@
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
+ Display *dpy;
unsigned long color;
int screen = __intVal(__INST(screen));
@@ -1971,6 +1980,7 @@
#endif
if (__isSmallInteger(colorIndex) && ISCONNECTED) {
+ dpy = myDpy;
color = (long) __intVal(colorIndex);
BEGIN_INTERRUPTSBLOCKED
XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
@@ -3820,9 +3830,9 @@
%{ /* UNLIMITEDSTACK */
- Display *dpy = myDpy;
-
if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
if (doSync == true) {
XSync(dpy, 0); /* make certain everything is flushed */
}
@@ -3867,12 +3877,13 @@
%{ /* UNLIMITEDSTACK */
- Display *dpy = myDpy;
XEvent ev;
Window win;
int thereIsOne;
if (ISCONNECTED && __isSmallInteger(anEventMask)) {
+ Display *dpy = myDpy;
+
if (doSync == true) {
XSync(dpy, 0); /* make certain everything is flushed */
}
@@ -3898,12 +3909,13 @@
%{ /* UNLIMITEDSTACK */
- Display *dpy = myDpy;
XEvent ev;
Window win;
int thereIsOne;
if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
if (doSync == true) {
XSync(dpy, 0); /* make certain everything is flushed */
}
@@ -3940,7 +3952,7 @@
%{ /* UNLIMITEDSTACK */
- Display *dpy = myDpy;
+ Display *dpy;
Window win, wWanted;
int evMask;
OBJ eB;
@@ -3950,6 +3962,8 @@
RETURN (false);
}
+ dpy = myDpy;
+
eB = __INST(eventBuffer);
if (__isByteArray(eB)) {
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
@@ -4057,7 +4071,6 @@
(not very user friendly)"
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
int type;
int state;
@@ -4071,6 +4084,8 @@
&& __isSmallInteger(xPos) && __isSmallInteger(yPos)
&& (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr))
&& (__isExternalAddress(targetId) || __isInteger(targetId))) {
+ Display *dpy = myDpy;
+
XEvent ev;
Window target;
Status result;
@@ -4399,12 +4414,14 @@
char *cp;
Atom fontAtom, registryAtom, encodingAtom, charSetCollAtom;
- registryAtom = XInternAtom(myDpy, "CHARSET_REGISTRY", True);
- encodingAtom = XInternAtom(myDpy, "CHARSET_ENCODING", True);
- charSetCollAtom = XInternAtom(myDpy, "CHARSET_COLLECTIONS", True);
- fontAtom = XInternAtom(myDpy, "FONT", True);
-
if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
+ registryAtom = XInternAtom(dpy, "CHARSET_REGISTRY", True);
+ encodingAtom = XInternAtom(dpy, "CHARSET_ENCODING", True);
+ charSetCollAtom = XInternAtom(dpy, "CHARSET_COLLECTIONS", True);
+ fontAtom = XInternAtom(dpy, "FONT", True);
+
if (__isExternalAddress(aFontId)) {
f = _FontVal(aFontId);
@@ -4414,12 +4431,12 @@
if (prop) {
while (n--) {
#ifdef SUPERDEBUG
- cp = XGetAtomName(myDpy, prop->name);
+ cp = XGetAtomName(dpy, prop->name);
printf("%s (%d) -> %d\n", cp, prop->name, prop->card32);
XFree(cp);
#endif
if (prop->name == XA_FULL_NAME) {
- cp = XGetAtomName(myDpy, prop->card32);
+ cp = XGetAtomName(dpy, prop->card32);
if (cp) {
fullName = __MKSTRING(cp);
#ifdef SUPERDEBUG
@@ -4428,7 +4445,7 @@
XFree(cp);
}
} else if (prop->name == fontAtom) {
- cp = XGetAtomName(myDpy, prop->card32);
+ cp = XGetAtomName(dpy, prop->card32);
if (cp) {
fontName = __MKSTRING(cp);
#ifdef SUPERDEBUG
@@ -4437,7 +4454,7 @@
XFree(cp);
}
} else if (prop->name == encodingAtom) {
- cp = XGetAtomName(myDpy, prop->card32);
+ cp = XGetAtomName(dpy, prop->card32);
if (cp) {
encoding = __MKSTRING(cp);
#ifdef SUPERDEBUG
@@ -4446,7 +4463,7 @@
XFree(cp);
}
} else if (prop->name == registryAtom) {
- cp = XGetAtomName(myDpy, prop->card32);
+ cp = XGetAtomName(dpy, prop->card32);
if (cp) {
registry = __MKSTRING(cp);
#ifdef SUPERDEBUG
@@ -4455,7 +4472,7 @@
XFree(cp);
}
} else if (prop->name == charSetCollAtom) {
- cp = XGetAtomName(myDpy, prop->card32);
+ cp = XGetAtomName(dpy, prop->card32);
if (cp) {
charSetCollections = __MKSTRING(cp);
#ifdef SUPERDEBUG
@@ -4602,6 +4619,8 @@
XFontStruct *f;
if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
if (__isExternalAddress(fontId)) {
f = _FontVal(fontId);
if (f) {
@@ -4614,8 +4633,8 @@
prop = f->properties;
if (prop) {
- resolutionXAtom = XInternAtom(myDpy, "RESOLUTION_X", True);
- resolutionYAtom = XInternAtom(myDpy, "RESOLUTION_Y", True);
+ resolutionXAtom = XInternAtom(dpy, "RESOLUTION_X", True);
+ resolutionYAtom = XInternAtom(dpy, "RESOLUTION_Y", True);
while (n--) {
if (prop->name == resolutionXAtom) {
@@ -4655,9 +4674,11 @@
char *cp;
Atom fontAtom;
- fontAtom = XInternAtom(myDpy, "FONT", True);
-
if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
+ fontAtom = XInternAtom(dpy, "FONT", True);
+
if (__isExternalAddress(aFontId)) {
f = _FontVal(aFontId);
@@ -4667,12 +4688,12 @@
if (prop) {
while (n--) {
#ifdef SUPERDEBUG
- cp = XGetAtomName(myDpy, prop->name);
+ cp = XGetAtomName(dpy, prop->name);
printf("%s (%d) -> %d\n", cp, prop->name, prop->card32);
XFree(cp);
#endif
if (prop->name == XA_FULL_NAME) {
- cp = XGetAtomName(myDpy, prop->card32);
+ cp = XGetAtomName(dpy, prop->card32);
if (cp) {
fullName = __MKSTRING(cp);
#ifdef SUPERDEBUG
@@ -4682,7 +4703,7 @@
}
}
if (prop->name == fontAtom) {
- cp = XGetAtomName(myDpy, prop->card32);
+ cp = XGetAtomName(dpy, prop->card32);
if (cp) {
fontName = __MKSTRING(cp);
#ifdef SUPERDEBUG
@@ -5335,10 +5356,12 @@
ok = 0;
if (ok) {
- BEGIN_INTERRUPTSBLOCKED
- XAllowEvents(myDpy, _mode, CurrentTime);
- END_INTERRUPTSBLOCKED
- RETURN (self);
+ if (ISCONNECTED) {
+ BEGIN_INTERRUPTSBLOCKED
+ XAllowEvents(myDpy, _mode, CurrentTime);
+ END_INTERRUPTSBLOCKED
+ RETURN (self);
+ }
}
%}.
self primitiveFailed
@@ -5350,47 +5373,49 @@
%{ /* NOCONTEXT */
int result, ok;
- if (__isExternalAddress(aWindowId)) {
- BEGIN_INTERRUPTSBLOCKED
- result = XGrabKeyboard(myDpy,
- _WindowVal(aWindowId),
- True /* False */,
- GrabModeAsync,
- GrabModeAsync,
- CurrentTime);
- END_INTERRUPTSBLOCKED
- ok = 0;
- switch(result) {
- case AlreadyGrabbed:
- if (@global(ErrorPrinting) == true) {
- fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
- }
- break;
- case GrabNotViewable:
- if (@global(ErrorPrinting) == true) {
- fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
- }
- break;
- case GrabInvalidTime:
- if (@global(ErrorPrinting) == true) {
- fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
- }
- break;
- case GrabFrozen:
- if (@global(ErrorPrinting) == true) {
- fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
- }
- break;
- default:
- ok = 1;
- break;
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aWindowId)) {
+ BEGIN_INTERRUPTSBLOCKED
+ result = XGrabKeyboard(myDpy,
+ _WindowVal(aWindowId),
+ True /* False */,
+ GrabModeAsync,
+ GrabModeAsync,
+ CurrentTime);
+ END_INTERRUPTSBLOCKED
+ ok = 0;
+ switch(result) {
+ case AlreadyGrabbed:
+ if (@global(ErrorPrinting) == true) {
+ fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
+ }
+ break;
+ case GrabNotViewable:
+ if (@global(ErrorPrinting) == true) {
+ fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
+ }
+ break;
+ case GrabInvalidTime:
+ if (@global(ErrorPrinting) == true) {
+ fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
+ }
+ break;
+ case GrabFrozen:
+ if (@global(ErrorPrinting) == true) {
+ fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
+ }
+ break;
+ default:
+ ok = 1;
+ break;
+ }
+ if (! ok) {
+ XUngrabKeyboard(myDpy, CurrentTime);
+ RETURN (false);
+ }
+
+ RETURN ( true );
}
- if (! ok) {
- XUngrabKeyboard(myDpy, CurrentTime);
- RETURN (false);
- }
-
- RETURN ( true );
}
%}.
self primitiveFailed
@@ -5406,70 +5431,72 @@
Cursor curs;
int pointer_mode, keyboard_mode;
- if (__isExternalAddress(aWindowId)) {
- if (__isExternalAddress(confineId))
- confineWin = _WindowVal(confineId);
- else
- confineWin = (Window) None;
-
- if (__isExternalAddress(aCursorId))
- curs = _CursorVal(aCursorId);
- else
- curs = (Cursor) None;
-
- if (pMode == @symbol(sync))
- pointer_mode = GrabModeSync;
- else
- pointer_mode = GrabModeAsync;
-
- if (kMode == @symbol(sync))
- keyboard_mode = GrabModeSync;
- else
- keyboard_mode = GrabModeAsync;
-
- BEGIN_INTERRUPTSBLOCKED
- result = XGrabPointer(myDpy,
- _WindowVal(aWindowId),
- False,
- ButtonPressMask | ButtonMotionMask | ButtonReleaseMask,
- pointer_mode, keyboard_mode,
- confineWin,
- curs,
- CurrentTime);
- END_INTERRUPTSBLOCKED
-
- ok = 0;
- switch (result) {
- case AlreadyGrabbed:
- if (@global(ErrorPrinting) == true) {
- fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
- }
- break;
- case GrabNotViewable:
- if (@global(ErrorPrinting) == true) {
- fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
- }
- break;
- case GrabInvalidTime:
- if (@global(ErrorPrinting) == true) {
- fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
- }
- break;
- case GrabFrozen:
- if (@global(ErrorPrinting) == true) {
- fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
- }
- break;
- default:
- ok = 1;
- break;
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aWindowId)) {
+ if (__isExternalAddress(confineId))
+ confineWin = _WindowVal(confineId);
+ else
+ confineWin = (Window) None;
+
+ if (__isExternalAddress(aCursorId))
+ curs = _CursorVal(aCursorId);
+ else
+ curs = (Cursor) None;
+
+ if (pMode == @symbol(sync))
+ pointer_mode = GrabModeSync;
+ else
+ pointer_mode = GrabModeAsync;
+
+ if (kMode == @symbol(sync))
+ keyboard_mode = GrabModeSync;
+ else
+ keyboard_mode = GrabModeAsync;
+
+ BEGIN_INTERRUPTSBLOCKED
+ result = XGrabPointer(myDpy,
+ _WindowVal(aWindowId),
+ False,
+ ButtonPressMask | ButtonMotionMask | ButtonReleaseMask,
+ pointer_mode, keyboard_mode,
+ confineWin,
+ curs,
+ CurrentTime);
+ END_INTERRUPTSBLOCKED
+
+ ok = 0;
+ switch (result) {
+ case AlreadyGrabbed:
+ if (@global(ErrorPrinting) == true) {
+ fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
+ }
+ break;
+ case GrabNotViewable:
+ if (@global(ErrorPrinting) == true) {
+ fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
+ }
+ break;
+ case GrabInvalidTime:
+ if (@global(ErrorPrinting) == true) {
+ fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
+ }
+ break;
+ case GrabFrozen:
+ if (@global(ErrorPrinting) == true) {
+ fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
+ }
+ break;
+ default:
+ ok = 1;
+ break;
+ }
+
+ if (! ok) {
+ XUngrabPointer(myDpy, CurrentTime);
+ RETURN (false);
+ }
+ RETURN ( true );
}
-
- if (! ok) {
- XUngrabPointer(myDpy, CurrentTime);
- RETURN (false);
- }
- RETURN ( true );
}
%}.
self primitiveFailed
@@ -5515,11 +5542,13 @@
XGCValues gcv;
GC gc;
- if (__isExternalAddress(aGCId)) {
- gc = _GCVal(aGCId);
- gcv.clip_mask = None;
- XChangeGC(myDpy, gc, GCClipMask, &gcv);
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aGCId)) {
+ gc = _GCVal(aGCId);
+ gcv.clip_mask = None;
+ XChangeGC(myDpy, gc, GCClipMask, &gcv);
+ RETURN ( self );
+ }
}
%}.
self primitiveFailed
@@ -5530,10 +5559,12 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aGCId)
- && __isSmallInteger(bgColorIndex)) {
- XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex));
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aGCId)
+ && __isSmallInteger(bgColorIndex)) {
+ XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex));
+ RETURN ( self );
+ }
}
%}.
self primitiveFailed
@@ -5544,21 +5575,24 @@
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
GC gc;
Pixmap bitmap;
- if (__isExternalAddress(aGCId)) {
- gc = _GCVal(aGCId);
- if (__isExternalAddress(aBitmapId)) {
- bitmap = _PixmapVal(aBitmapId);
- XSetStipple(dpy, gc, bitmap);
- XSetFillStyle(dpy, gc, FillOpaqueStippled);
- RETURN ( self );
- }
- if (aBitmapId == nil) {
- XSetFillStyle(dpy, gc, FillSolid);
- RETURN ( self );
+ if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
+ if (__isExternalAddress(aGCId)) {
+ gc = _GCVal(aGCId);
+ if (__isExternalAddress(aBitmapId)) {
+ bitmap = _PixmapVal(aBitmapId);
+ XSetStipple(dpy, gc, bitmap);
+ XSetFillStyle(dpy, gc, FillOpaqueStippled);
+ RETURN ( self );
+ }
+ if (aBitmapId == nil) {
+ XSetFillStyle(dpy, gc, FillSolid);
+ RETURN ( self );
+ }
}
}
%}.
@@ -5573,15 +5607,17 @@
XGCValues gcv;
GC gc;
- if (__isExternalAddress(aGCId)) {
- gc = _GCVal(aGCId);
- if (aBool == true)
- gcv.subwindow_mode = ClipByChildren;
- else
- gcv.subwindow_mode = IncludeInferiors;
-
- XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aGCId)) {
+ gc = _GCVal(aGCId);
+ if (aBool == true)
+ gcv.subwindow_mode = ClipByChildren;
+ else
+ gcv.subwindow_mode = IncludeInferiors;
+
+ XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
+ RETURN ( self );
+ }
}
%}.
self primitiveFailed
@@ -5594,15 +5630,17 @@
XRectangle r;
- if (__isExternalAddress(aGCId)
- && __bothSmallInteger(clipX, clipY)
- && __bothSmallInteger(clipWidth, clipHeight)) {
- r.x = __intVal(clipX);
- r.y = __intVal(clipY);
- r.width = __intVal(clipWidth);
- r.height = __intVal(clipHeight);
- XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted);
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aGCId)
+ && __bothSmallInteger(clipX, clipY)
+ && __bothSmallInteger(clipWidth, clipHeight)) {
+ r.x = __intVal(clipX);
+ r.y = __intVal(clipY);
+ r.width = __intVal(clipWidth);
+ r.height = __intVal(clipHeight);
+ XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted);
+ RETURN ( self );
+ }
}
%}.
self primitiveFailed
@@ -5613,14 +5651,16 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aGCId)
- && __isSmallInteger(offset)
- && __isByteArray(dashList)) {
- XSetDashes(myDpy, _GCVal(aGCId),
- __intVal(offset),
- __ByteArrayInstPtr(dashList)->ba_element,
- __byteArraySize(dashList));
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aGCId)
+ && __isSmallInteger(offset)
+ && __isByteArray(dashList)) {
+ XSetDashes(myDpy, _GCVal(aGCId),
+ __intVal(offset),
+ __ByteArrayInstPtr(dashList)->ba_element,
+ __byteArraySize(dashList));
+ RETURN ( self );
+ }
}
bad: ;
%}.
@@ -5639,11 +5679,13 @@
XFontStruct *f;
- if (__isExternalAddress(aFontId)
- && __isExternalAddress(aGCId)) {
- f = (XFontStruct *) _FontVal(aFontId);
- XSetFont(myDpy, _GCVal(aGCId), f->fid);
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aFontId)
+ && __isExternalAddress(aGCId)) {
+ f = (XFontStruct *) _FontVal(aFontId);
+ XSetFont(myDpy, _GCVal(aGCId), f->fid);
+ RETURN ( self );
+ }
}
%}.
"
@@ -5657,16 +5699,18 @@
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
GC gc;
- if (__bothSmallInteger(fgColorIndex, bgColorIndex)
- && __isExternalAddress(aGCId)) {
- gc = _GCVal(aGCId);
-
- XSetForeground(dpy, gc, __intVal(fgColorIndex));
- XSetBackground(dpy, gc, __intVal(bgColorIndex));
- RETURN ( self );
+ if (ISCONNECTED) {
+ Display *dpy = myDpy;
+ if (__bothSmallInteger(fgColorIndex, bgColorIndex)
+ && __isExternalAddress(aGCId)) {
+ gc = _GCVal(aGCId);
+
+ XSetForeground(dpy, gc, __intVal(fgColorIndex));
+ XSetBackground(dpy, gc, __intVal(bgColorIndex));
+ RETURN ( self );
+ }
}
%}.
self primitiveFailed
@@ -5678,24 +5722,27 @@
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
GC gc;
- if (__isExternalAddress(aGCId)) {
- gc = _GCVal(aGCId);
- if (__isSmallInteger(fgColor))
- XSetForeground(dpy, gc, __intVal(fgColor));
- if (__isSmallInteger(bgColor))
- XSetBackground(dpy, gc, __intVal(bgColor));
-
- if (__isExternalAddress(aBitmapId)) {
- XSetStipple(dpy, gc, _PixmapVal(aBitmapId));
- XSetFillStyle(dpy, gc, FillOpaqueStippled);
- RETURN ( self );
- }
- if (aBitmapId == nil) {
- XSetFillStyle(dpy, gc, FillSolid);
- RETURN ( self );
+ if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
+ if (__isExternalAddress(aGCId)) {
+ gc = _GCVal(aGCId);
+ if (__isSmallInteger(fgColor))
+ XSetForeground(dpy, gc, __intVal(fgColor));
+ if (__isSmallInteger(bgColor))
+ XSetBackground(dpy, gc, __intVal(bgColor));
+
+ if (__isExternalAddress(aBitmapId)) {
+ XSetStipple(dpy, gc, _PixmapVal(aBitmapId));
+ XSetFillStyle(dpy, gc, FillOpaqueStippled);
+ RETURN ( self );
+ }
+ if (aBitmapId == nil) {
+ XSetFillStyle(dpy, gc, FillSolid);
+ RETURN ( self );
+ }
}
}
%}.
@@ -5708,28 +5755,31 @@
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
GC gc;
- if (__isExternalAddress(aGCId)) {
- gc = _GCVal(aGCId);
- if (__isSmallInteger(lw)) {
- XSetLineAttributes(dpy, gc, __intVal(lw),
- LineSolid, CapNotLast, JoinMiter);
- }
- if (__isSmallInteger(fgColor))
- XSetForeground(dpy, gc, __intVal(fgColor));
- if (__isSmallInteger(bgColor))
- XSetBackground(dpy, gc, __intVal(bgColor));
-
- if (__isExternalAddress(aBitmapId)) {
- XSetStipple(dpy, gc, _PixmapVal(aBitmapId));
- XSetFillStyle(dpy, gc, FillOpaqueStippled);
- RETURN ( self );
- }
- if (aBitmapId == nil) {
- XSetFillStyle(dpy, gc, FillSolid);
- RETURN ( self );
+ if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
+ if (__isExternalAddress(aGCId)) {
+ gc = _GCVal(aGCId);
+ if (__isSmallInteger(lw)) {
+ XSetLineAttributes(dpy, gc, __intVal(lw),
+ LineSolid, CapNotLast, JoinMiter);
+ }
+ if (__isSmallInteger(fgColor))
+ XSetForeground(dpy, gc, __intVal(fgColor));
+ if (__isSmallInteger(bgColor))
+ XSetBackground(dpy, gc, __intVal(bgColor));
+
+ if (__isExternalAddress(aBitmapId)) {
+ XSetStipple(dpy, gc, _PixmapVal(aBitmapId));
+ XSetFillStyle(dpy, gc, FillOpaqueStippled);
+ RETURN ( self );
+ }
+ if (aBitmapId == nil) {
+ XSetFillStyle(dpy, gc, FillSolid);
+ RETURN ( self );
+ }
}
}
%}.
@@ -5741,10 +5791,12 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aGCId)
- && __isSmallInteger(fgColorIndex)) {
- XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex));
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aGCId)
+ && __isSmallInteger(fgColorIndex)) {
+ XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex));
+ RETURN ( self );
+ }
}
%}.
self primitiveFailed
@@ -5758,20 +5810,22 @@
GC gc;
int fun = -1;
- if (__isExternalAddress(aGCId)) {
- gc = _GCVal(aGCId);
- if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
- else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
- else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
- else if (aFunctionSymbol == @symbol(and)) fun = GXand;
- else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
- else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
- else if (aFunctionSymbol == @symbol(or)) fun = GXor;
- else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
- else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
- if (fun != -1) {
- XSetFunction(myDpy, gc, fun);
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aGCId)) {
+ gc = _GCVal(aGCId);
+ if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
+ else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
+ else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
+ else if (aFunctionSymbol == @symbol(and)) fun = GXand;
+ else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
+ else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
+ else if (aFunctionSymbol == @symbol(or)) fun = GXor;
+ else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
+ else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
+ if (fun != -1) {
+ XSetFunction(myDpy, gc, fun);
+ RETURN ( self );
+ }
}
}
%}.
@@ -5788,9 +5842,11 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aGCId)) {
- XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0);
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aGCId)) {
+ XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0);
+ RETURN ( self );
+ }
}
%}
.
@@ -5804,28 +5860,30 @@
int x_style, x_cap, x_join;
- if (__isExternalAddress(aGCId)
- && __isSmallInteger(aNumber)) {
- if (lineStyle == @symbol(solid)) x_style = LineSolid;
- else if (lineStyle == @symbol(dashed)) x_style = LineOnOffDash;
- else if (lineStyle == @symbol(doubleDashed)) x_style = LineDoubleDash;
- else goto bad;
-
- if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
- else if (capStyle == @symbol(butt)) x_cap = CapButt;
- else if (capStyle == @symbol(round)) x_cap = CapRound;
- else if (capStyle == @symbol(projecting)) x_cap = CapProjecting;
- else goto bad;
-
- if (joinStyle == @symbol(miter)) x_join = JoinMiter;
- else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
- else if (joinStyle == @symbol(round)) x_join = JoinRound;
- else goto bad;
-
- XSetLineAttributes(myDpy,
- _GCVal(aGCId), __intVal(aNumber),
- x_style, x_cap, x_join);
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aGCId)
+ && __isSmallInteger(aNumber)) {
+ if (lineStyle == @symbol(solid)) x_style = LineSolid;
+ else if (lineStyle == @symbol(dashed)) x_style = LineOnOffDash;
+ else if (lineStyle == @symbol(doubleDashed)) x_style = LineDoubleDash;
+ else goto bad;
+
+ if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
+ else if (capStyle == @symbol(butt)) x_cap = CapButt;
+ else if (capStyle == @symbol(round)) x_cap = CapRound;
+ else if (capStyle == @symbol(projecting)) x_cap = CapProjecting;
+ else goto bad;
+
+ if (joinStyle == @symbol(miter)) x_join = JoinMiter;
+ else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
+ else if (joinStyle == @symbol(round)) x_join = JoinRound;
+ else goto bad;
+
+ XSetLineAttributes(myDpy,
+ _GCVal(aGCId), __intVal(aNumber),
+ x_style, x_cap, x_join);
+ RETURN ( self );
+ }
}
bad: ;
%}.
@@ -5843,9 +5901,11 @@
%{ /* NOCONTEXT */
- if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
- XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY));
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
+ XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY));
+ RETURN ( self );
+ }
}
%}.
self primitiveFailed
@@ -5860,17 +5920,19 @@
GC gc;
Pixmap pixmap;
- if (__isExternalAddress(aGCId)) {
- gc = _GCVal(aGCId);
- if (__isExternalAddress(aPixmapId)) {
- pixmap = _PixmapVal(aPixmapId);
- XSetTile(dpy, gc, pixmap);
- XSetFillStyle(dpy, gc, FillTiled);
- RETURN ( self );
- }
- if (aPixmapId == nil) {
- XSetFillStyle(dpy, gc, FillSolid);
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aGCId)) {
+ gc = _GCVal(aGCId);
+ if (__isExternalAddress(aPixmapId)) {
+ pixmap = _PixmapVal(aPixmapId);
+ XSetTile(dpy, gc, pixmap);
+ XSetFillStyle(dpy, gc, FillTiled);
+ RETURN ( self );
+ }
+ if (aPixmapId == nil) {
+ XSetFillStyle(dpy, gc, FillSolid);
+ RETURN ( self );
+ }
}
}
%}.
@@ -5884,9 +5946,9 @@
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
-
if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
BEGIN_INTERRUPTSBLOCKED
__INST(displayId) = nil;
XCloseDisplay(myDpy);
@@ -6063,7 +6125,7 @@
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
+ Display *dpy;
int scr;
Visual *visual;
XVisualInfo viproto;
@@ -6079,6 +6141,8 @@
int mask, shift, nBits;
if (ISCONNECTED) {
+ dpy = myDpy;
+
__INST(altModifierMask) = __MKSMALLINT(Mod2Mask);
__INST(metaModifierMask) = __MKSMALLINT(Mod1Mask);
@@ -6395,11 +6459,12 @@
|modifierKeyMap maxKeyPerMod ret nextKey|
%{
- Display *dpy = myDpy;
XModifierKeymap *modmap;
OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT();
if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
if ((modmap = XGetModifierMapping(myDpy)) != 0) {
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod);
modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
@@ -6445,11 +6510,12 @@
|str|
%{
- Display *dpy = myDpy;
KeySym keysym;
char *keystring;
if (ISCONNECTED && __isSmallInteger(code)) {
+ Display *dpy = myDpy;
+
if ((keysym = XKeycodeToKeysym(myDpy, __intVal(code), 0)) != NoSymbol &&
(keystring = XKeysymToString(keysym)) != 0)
str = __MKSTRING(keystring);
@@ -6661,26 +6727,30 @@
shiftMask/controlMask and modifierMask methods for the meaning of the bits."
%{ /* NOCONTEXT*/
- Display *dpy = myDpy;
Window w;
int screen = __intVal(__INST(screen));
Window rootRet, childRet;
int rootX, rootY, winX, winY;
unsigned int mask;
- BEGIN_INTERRUPTSBLOCKED
+ if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
+ BEGIN_INTERRUPTSBLOCKED
#ifdef VIRTUAL_ROOT
- w = getRootWindow(myDpy, screen);
+ w = getRootWindow(myDpy, screen);
#else
- w = RootWindow(dpy, screen);
+ w = RootWindow(dpy, screen);
#endif
- XQueryPointer(dpy, w, &rootRet, &childRet,
- &rootX, &rootY,
- &winX, &winY,
- &mask);
- END_INTERRUPTSBLOCKED
- RETURN (__MKSMALLINT(mask));
-%}
+ XQueryPointer(dpy, w, &rootRet, &childRet,
+ &rootX, &rootY,
+ &winX, &winY,
+ &mask);
+ END_INTERRUPTSBLOCKED
+ RETURN (__MKSMALLINT(mask));
+ }
+%}.
+ self primitiveFailed
"
Display buttonStates
@@ -6726,26 +6796,29 @@
|xpos ypos|
%{
- Display *dpy = myDpy;
Window w;
int screen = __intVal(__INST(screen));
Window rootRet, childRet;
int rootX, rootY, winX, winY;
unsigned int mask;
- BEGIN_INTERRUPTSBLOCKED
+ if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
+ BEGIN_INTERRUPTSBLOCKED
#ifdef VIRTUAL_ROOT
- w = getRootWindow(myDpy, screen);
+ w = getRootWindow(myDpy, screen);
#else
- w = RootWindow(dpy, screen);
+ w = RootWindow(dpy, screen);
#endif
- XQueryPointer(dpy, w, &rootRet, &childRet,
- &rootX, &rootY,
- &winX, &winY,
- &mask);
- xpos = __MKSMALLINT(rootX);
- ypos = __MKSMALLINT(rootY);
- END_INTERRUPTSBLOCKED
+ XQueryPointer(dpy, w, &rootRet, &childRet,
+ &rootX, &rootY,
+ &winX, &winY,
+ &mask);
+ xpos = __MKSMALLINT(rootX);
+ ypos = __MKSMALLINT(rootY);
+ END_INTERRUPTSBLOCKED
+ }
%}
.
^ xpos @ ypos
@@ -7027,16 +7100,18 @@
%{ /* UNLIMITEDSTACK */
- Display *dpy = myDpy;
Window win;
XImage *image = (XImage *)0;
int pad, bytes_per_line, numBytes;
- if (__isExternalAddress(aDrawableId)
+ if (ISCONNECTED
+ && __isExternalAddress(aDrawableId)
&& __bothSmallInteger(srcx, srcy)
&& __bothSmallInteger(w, h)
&& __isArray(info)
&& __isByteArray(imageBits)) {
+ Display *dpy = myDpy;
+
win = _WindowVal(aDrawableId);
image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
__intVal(w), __intVal(h),
@@ -7131,7 +7206,6 @@
cls := ByteArray.
%{
- Display *dpy = myDpy;
Window window;
Atom property;
char *cp, *cp2;
@@ -7142,62 +7216,66 @@
int ok = 1;
# define PROP_SIZE 2048
- if (__isAtomID(propertyID)) {
- property = _AtomVal(propertyID);
- if (__isExternalAddress(aWindowID)) {
- window = _WindowVal(aWindowID);
- } else {
- window = DefaultRootWindow(dpy);
- }
-
- nread = 0;
- cp = 0;
-/*
- fprintf(stderr, "getProperty: ");
- */
- do {
- if (XGetWindowProperty(dpy,window,property,nread/4,PROP_SIZE,False,
- AnyPropertyType,&actual_type,&actual_format,
- &nitems,&bytes_after,(unsigned char **)&data)
- != Success) {
- ok = 0;
- break;
- }
- typeID = __MKATOMOBJ(actual_type);
- if (! cp) {
- cp = cp2 = (char *)malloc(nitems+1);
+ if (ISCONNECTED) {
+ Display *dpy = myDpy;
+
+ if (__isAtomID(propertyID)) {
+ property = _AtomVal(propertyID);
+ if (__isExternalAddress(aWindowID)) {
+ window = _WindowVal(aWindowID);
} else {
- cp = (char *)realloc(cp, nread + nitems + 1);
- cp2 = cp + nread;
+ window = DefaultRootWindow(dpy);
}
- if (! cp) {
- XFree(data);
- goto fail;
- }
-
- nread += nitems;
- bcopy(data, cp2, nitems);
- XFree(data);
-/*
- fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after);
- */
- } while (bytes_after > 0);
+
+ nread = 0;
+ cp = 0;
/*
- fprintf(stderr, "\n");
+ fprintf(stderr, "getProperty: ");
*/
-
- if (ok) {
- if (actual_type == XA_STRING) {
- cp[nread] = '\0';
- val = __MKSTRING_L(cp, nread);
- } else {
- val = __new(nread + OHDR_SIZE);
- val->o_class = cls;
- bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread);
+ do {
+ if (XGetWindowProperty(dpy,window,property,nread/4,PROP_SIZE,False,
+ AnyPropertyType,&actual_type,&actual_format,
+ &nitems,&bytes_after,(unsigned char **)&data)
+ != Success) {
+ ok = 0;
+ break;
+ }
+ typeID = __MKATOMOBJ(actual_type);
+ if (! cp) {
+ cp = cp2 = (char *)malloc(nitems+1);
+ } else {
+ cp = (char *)realloc(cp, nread + nitems + 1);
+ cp2 = cp + nread;
+ }
+ if (! cp) {
+ XFree(data);
+ goto fail;
+ }
+
+ nread += nitems;
+ bcopy(data, cp2, nitems);
+ XFree(data);
+ /*
+ fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after);
+ */
+ } while (bytes_after > 0);
+ /*
+ fprintf(stderr, "\n");
+ */
+
+ if (ok) {
+ if (actual_type == XA_STRING) {
+ cp[nread] = '\0';
+ val = __MKSTRING_L(cp, nread);
+ } else {
+ val = __new(nread + OHDR_SIZE);
+ val->o_class = cls;
+ bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread);
+ }
}
- }
- if (cp)
- free(cp);
+ if (cp)
+ free(cp);
+ }
}
fail: ;
%}.
@@ -7228,11 +7306,12 @@
"get the owner of a selection"
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
Atom selection;
Window window;
if (__isAtomID(selectionAtomID) && ISCONNECTED) {
+ Display *dpy = myDpy;
+
window = XGetSelectionOwner(dpy, _AtomVal(selectionAtomID));
RETURN ((window == None) ? nil : __MKOBJ(window));
}
@@ -7284,7 +7363,6 @@
with the selections value)."
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
Atom sel_prop;
char *cp;
@@ -7292,6 +7370,8 @@
&& ISCONNECTED
&& __isSmallInteger(typeID)
&& __isAtomID(selectionID)) {
+ Display *dpy = myDpy;
+
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) {
/*
* no owner of primary selection
@@ -7358,13 +7438,13 @@
"send a selectionNotify back from a SelectionRequest"
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
if (__isAtomID(propertyID)
&& __isExternalAddress(requestorID)
&& ISCONNECTED
&& __isAtomID(targetID)
&& __isAtomID(selectionID)) {
+ Display *dpy = myDpy;
XEvent ev;
Window requestor = _WindowVal(requestorID);
Atom property = _AtomVal(propertyID);
@@ -7427,7 +7507,6 @@
%{ /* UNLIMITEDSTACK */
- Display *dpy = myDpy;
Atom prop, type;
Window window;
unsigned int value;
@@ -7441,6 +7520,8 @@
|| __isByteArray(anObject)
|| __isWords(anObject))) {
+ Display *dpy = myDpy;
+
prop = _AtomVal(propertyID);
type = _AtomVal(typeID);
if (__isExternalAddress(aWindowID)) {
@@ -7495,12 +7576,13 @@
"set the owner of a selection; return false if failed"
%{ /* NOCONTEXT */
- Display *dpy = myDpy;
Window win;
if (__isExternalAddress(aWindowId)
&& __isAtomID(selectionID)
&& ISCONNECTED) {
+ Display *dpy = myDpy;
+
win = _WindowVal(aWindowId);
XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime);
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) {
@@ -7539,18 +7621,20 @@
int w, h;
- if (__isExternalAddress(aWindowId)
- && __bothSmallInteger(x, y)
- && __bothSmallInteger(width, height)) {
- w = __intVal(width);
- h = __intVal(height);
- /*
- * need this check here: some servers simply dump core with bad args
- */
- if ((w >= 0) && (h >= 0)) {
- XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0);
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aWindowId)
+ && __bothSmallInteger(x, y)
+ && __bothSmallInteger(width, height)) {
+ w = __intVal(width);
+ h = __intVal(height);
+ /*
+ * need this check here: some servers simply dump core with bad args
+ */
+ if ((w >= 0) && (h >= 0)) {
+ XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0);
+ }
+ RETURN ( self );
}
- RETURN ( self );
}
%}
.
@@ -7562,9 +7646,11 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)) {
- XClearWindow(myDpy, _WindowVal(aWindowId));
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aWindowId)) {
+ XClearWindow(myDpy, _WindowVal(aWindowId));
+ RETURN ( self );
+ }
}
%}
.
@@ -7579,26 +7665,28 @@
XWindowChanges chg;
int mask = CWSibling | CWStackMode;
- if (__isExternalAddress(aWindowId)
- && __isExternalAddress(siblingId)) {
- if (modeSymbol == @symbol(above)) {
- chg.stack_mode = Above;
- } else if (modeSymbol == @symbol(below)) {
- chg.stack_mode = Below;
- } else if (modeSymbol == @symbol(topIf)) {
- chg.stack_mode = TopIf;
- } else if (modeSymbol == @symbol(bottomIf)) {
- chg.stack_mode = BottomIf;
- } else if (modeSymbol == @symbol(opposite)) {
- chg.stack_mode = Opposite;
- } else {
- mask = CWSibling;
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aWindowId)
+ && __isExternalAddress(siblingId)) {
+ if (modeSymbol == @symbol(above)) {
+ chg.stack_mode = Above;
+ } else if (modeSymbol == @symbol(below)) {
+ chg.stack_mode = Below;
+ } else if (modeSymbol == @symbol(topIf)) {
+ chg.stack_mode = TopIf;
+ } else if (modeSymbol == @symbol(bottomIf)) {
+ chg.stack_mode = BottomIf;
+ } else if (modeSymbol == @symbol(opposite)) {
+ chg.stack_mode = Opposite;
+ } else {
+ mask = CWSibling;
+ }
+
+ chg.sibling = _WindowVal(siblingId);
+ XConfigureWindow(myDpy, _WindowVal(aWindowId),
+ mask, &chg);
+ RETURN ( self );
}
-
- chg.sibling = _WindowVal(siblingId);
- XConfigureWindow(myDpy, _WindowVal(aWindowId),
- mask, &chg);
- RETURN ( self );
}
bad: ;
%}
@@ -7611,7 +7699,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)) {
XLowerWindow(myDpy, _WindowVal(aWindowId));
RETURN ( self );
}
@@ -7640,10 +7729,12 @@
XWMHints wmhints;
XSizeHints szhints;
- Display *dpy = myDpy;
Window win;
- if (__isExternalAddress(aWindowId)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)) {
+ Display *dpy = myDpy;
+
win = _WindowVal(aWindowId);
szhints.flags = 0;
@@ -7717,7 +7808,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)) {
XMapWindow(myDpy, _WindowVal(aWindowId));
RETURN ( self );
}
@@ -7733,7 +7825,8 @@
int newWidth, newHeight;
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& __bothSmallInteger(w, h)
&& __bothSmallInteger(x, y)) {
newWidth = __intVal(w);
@@ -7755,7 +7848,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
XMoveWindow(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y));
RETURN ( self );
}
@@ -7769,7 +7863,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)) {
XRaiseWindow(myDpy, _WindowVal(aWindowId));
RETURN ( self );
}
@@ -7785,7 +7880,8 @@
int newWidth, newHeight;
- if (__isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
newWidth = __intVal(w);
newHeight = __intVal(h);
if (newWidth < 1) newWidth = 1;
@@ -7805,7 +7901,8 @@
XSetWindowAttributes wa;
- if (__isExternalAddress(aWindowId)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)) {
if (__INST(ignoreBackingStore) != true) {
if (how == @symbol(always)) wa.backing_store = Always;
else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
@@ -7828,7 +7925,8 @@
XSetWindowAttributes wa;
- if (__isExternalAddress(aWindowId)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)) {
if (how == @symbol(NorthWest)) {
wa.bit_gravity = NorthWestGravity;
} else if (how == @symbol(NorthEast)) {
@@ -7867,7 +7965,8 @@
Display *dpy = myDpy;
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& __isExternalAddress(aCursorId)) {
XDefineCursor(dpy, _WindowVal(aWindowId), _CursorVal(aCursorId));
RETURN ( self );
@@ -7881,7 +7980,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& (__isString(aString) || __isSymbol(aString))) {
XSetIconName(myDpy, _WindowVal(aWindowId), (char *)_stringVal(aString));
RETURN ( self );
@@ -7897,7 +7997,8 @@
XSetWindowAttributes wa;
- if (__isExternalAddress(aWindowId)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)) {
if (__INST(hasSaveUnder) == true) {
wa.save_under = (yesOrNo == true) ? 1 : 0;
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa);
@@ -7913,7 +8014,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)) {
Window w;
if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
@@ -7940,7 +8042,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& __isSmallInteger(aColorIndex)) {
XSetWindowBackground(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex));
RETURN ( self );
@@ -7957,7 +8060,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& __isExternalAddress(aPixmapId)) {
XSetWindowBackgroundPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId));
RETURN ( self );
@@ -7971,7 +8075,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& __isSmallInteger(aColorIndex)) {
XSetWindowBorder(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex));
RETURN ( self );
@@ -7985,7 +8090,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& __isExternalAddress(aPixmapId)) {
XSetWindowBorderPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId));
RETURN ( self );
@@ -8003,7 +8109,8 @@
%{ /* NOCONTEXT */
#ifdef SHAPE
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& __isExternalAddress(aPixmapId)) {
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeBounding,
0, 0, _PixmapVal(aPixmapId), ShapeSet);
@@ -8019,7 +8126,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& __isSmallInteger(aNumber)) {
XSetWindowBorderWidth(myDpy, _WindowVal(aWindowId), __intVal(aNumber));
RETURN ( self );
@@ -8034,7 +8142,8 @@
select client specific resources."
%{
- if (__isExternalAddress(aWindowId)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)) {
XClassHint classhint;
classhint.res_class = classhint.res_name = 0;
@@ -8064,7 +8173,8 @@
XSetWindowAttributes wa;
- if (__isExternalAddress(aWindowId)) {
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)) {
if (how == @symbol(NorthWest)) {
wa.win_gravity = NorthWestGravity;
} else if (how == @symbol(NorthEast)) {
@@ -8105,7 +8215,8 @@
iconId := aForm id
].
%{
- if (__isExternalAddress(iconId)
+ if (ISCONNECTED
+ && __isExternalAddress(iconId)
&& __isExternalAddress(aWindowId)) {
XWMHints hints;
@@ -8127,7 +8238,8 @@
iconWindowId := aView id
].
%{
- if (__isExternalAddress(iconWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(iconWindowId)
&& __isExternalAddress(aWindowId)) {
XWMHints wmhints;
@@ -8145,7 +8257,8 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& (__isString(aString) || __isSymbol(aString))) {
XStoreName(myDpy, _WindowVal(aWindowId), (char *)_stringVal(aString));
RETURN ( self );
@@ -8162,7 +8275,8 @@
%{ /* NOCONTEXT */
#ifdef SHAPE
- if (__isExternalAddress(aWindowId)
+ if (ISCONNECTED
+ && __isExternalAddress(aWindowId)
&& __isExternalAddress(aPixmapId)) {
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeClip,
0, 0,
@@ -8179,9 +8293,11 @@
%{ /* NOCONTEXT */
- if (__isExternalAddress(aWindowId)) {
- XUnmapWindow(myDpy, _WindowVal(aWindowId));
- RETURN ( self );
+ if (ISCONNECTED) {
+ if (__isExternalAddress(aWindowId)) {
+ XUnmapWindow(myDpy, _WindowVal(aWindowId));
+ RETURN ( self );
+ }
}
%}
.
@@ -8191,6 +8307,6 @@
!XWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.189 1997-01-13 23:20:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.190 1997-01-13 23:41:03 cg Exp $'
! !
XWorkstation initialize!