--- a/XWorkstation.st Thu Aug 31 21:59:48 2017 +0200
+++ b/XWorkstation.st Thu Aug 31 22:02:52 2017 +0200
@@ -1849,7 +1849,7 @@
Blame: I cannot ask via server vendor, if it's a Quartz display, because
it does not return a valid server vendor string"
OperatingSystem isOSXlike ifTrue:[
- ^ false
+ ^ false
].
^ true
@@ -1964,8 +1964,8 @@
h := (self monitorBoundsAt:aPoint) height.
OperatingSystem isOSXlike ifTrue:[
- "/ take away some space for the dock at the bottom.
- ^ h - 50
+ "/ take away some space for the dock at the bottom.
+ ^ h - 50
].
^ h
@@ -2099,18 +2099,18 @@
!
createWindowFor:aView type:typeSymbol
- origin:origin
- extent:extent
- minExtent:minExt
- maxExtent:maxExt
- borderWidth:bWidth
- subViewOf:wsuperView
- style:wStyle
- inputOnly:winputOnly
- label:wlabel
- owner:wowner
- icon:wicon iconMask:wiconMask
- iconView:wiconView
+ origin:origin
+ extent:extent
+ minExtent:minExt
+ maxExtent:maxExt
+ borderWidth:bWidth
+ subViewOf:wsuperView
+ style:wStyle
+ inputOnly:winputOnly
+ label:wlabel
+ owner:wowner
+ icon:wicon iconMask:wiconMask
+ iconView:wiconView
<context: #return>
@@ -2121,46 +2121,46 @@
wiconId wiconMaskId wiconViewId windowGroupWindowId|
self isOpen ifFalse:[
- self primitiveFailedOrClosedConnection.
- ^ nil
+ self primitiveFailedOrClosedConnection.
+ ^ nil
].
origin notNil ifTrue:[
- xpos := origin x.
- ypos := origin y.
+ xpos := origin x.
+ ypos := origin y.
].
extent notNil ifTrue:[
- wwidth := extent x.
- wheight := extent y.
+ wwidth := extent x.
+ wheight := extent y.
].
minExt notNil ifTrue:[
- minWidth := minExt x.
- minHeight := minExt y
+ minWidth := minExt x.
+ minHeight := minExt y
].
maxExt notNil ifTrue:[
- maxWidth := maxExt x.
- maxHeight := maxExt y
+ maxWidth := maxExt x.
+ maxHeight := maxExt y
].
wsuperView notNil ifTrue:[
- wsuperViewId := wsuperView id
+ wsuperViewId := wsuperView id
] ifFalse:[
- isTopWindow := true.
- aView class ~~ WindowGroupWindow ifTrue:[
- windowGroupWindow isNil ifTrue:[
- self getWindowGroupWindow.
- ].
- windowGroupWindowId := windowGroupWindow id.
- ].
- wicon notNil ifTrue:[
- wiconId := wicon id.
- wiconMask notNil ifTrue:[
- wiconMaskId := wiconMask id
- ]
- ].
- wiconView notNil ifTrue:[
- wiconViewId := wiconView id
- ].
+ isTopWindow := true.
+ aView class ~~ WindowGroupWindow ifTrue:[
+ windowGroupWindow isNil ifTrue:[
+ self getWindowGroupWindow.
+ ].
+ windowGroupWindowId := windowGroupWindow id.
+ ].
+ wicon notNil ifTrue:[
+ wiconId := wicon id.
+ wiconMask notNil ifTrue:[
+ wiconMaskId := wiconMask id
+ ]
+ ].
+ wiconView notNil ifTrue:[
+ wiconViewId := wiconView id
+ ].
].
weventMask := aView eventMask.
@@ -2194,122 +2194,122 @@
sizehints.y = 0;
if (__bothSmallInteger(wwidth, wheight)) {
- sizehints.flags |= PSize;
- sizehints.width = __intVal(wwidth);
- sizehints.height = __intVal(wheight);
+ sizehints.flags |= PSize;
+ sizehints.width = __intVal(wwidth);
+ sizehints.height = __intVal(wheight);
}
if (__bothSmallInteger(xpos, ypos)) {
- sizehints.flags |= PPosition;
- sizehints.x = __intVal(xpos);
- sizehints.y = __intVal(ypos);
+ sizehints.flags |= PPosition;
+ sizehints.x = __intVal(xpos);
+ sizehints.y = __intVal(ypos);
}
if (__bothSmallInteger(minWidth, minHeight)) {
- sizehints.flags |= PMinSize;
- sizehints.min_width = __intVal(minWidth);
- sizehints.min_height = __intVal(minHeight);
+ sizehints.flags |= PMinSize;
+ sizehints.min_width = __intVal(minWidth);
+ sizehints.min_height = __intVal(minHeight);
}
if (__bothSmallInteger(maxWidth, maxHeight)) {
- sizehints.flags |= PMaxSize;
- sizehints.max_width = __intVal(maxWidth);
- sizehints.max_height = __intVal(maxHeight);
+ sizehints.flags |= PMaxSize;
+ sizehints.max_width = __intVal(maxWidth);
+ sizehints.max_height = __intVal(maxHeight);
}
bg = WhitePixel(dpy, screen);
if (__isSmallInteger(bWidth)) {
- bw = __intVal(bWidth);
+ bw = __intVal(bWidth);
} else {
- bw = 0;
+ bw = 0;
}
bd = BlackPixel(dpy, screen);
if (__isExternalAddress(wsuperViewId)) {
- parentWindow = __WindowVal(wsuperViewId);
+ parentWindow = __WindowVal(wsuperViewId);
} else {
- parentWindow = RootWindow(dpy, screen);
+ parentWindow = RootWindow(dpy, screen);
}
if (wStyle == @symbol(popUp))
- xswa.override_redirect = 1;
+ xswa.override_redirect = 1;
else
- xswa.override_redirect = 0;
+ xswa.override_redirect = 0;
if (winputOnly == true)
- ioClass = InputOnly;
+ ioClass = InputOnly;
else
- ioClass = InputOutput;
+ ioClass = InputOutput;
if (__isSmallInteger(weventMask)) {
- xswa.event_mask = __intVal(weventMask);
+ xswa.event_mask = __intVal(weventMask);
} else {
- xswa.event_mask = 0;
+ xswa.event_mask = 0;
}
if (ioClass == InputOnly) {
- bw = 0;
- depth = 0;
- flags |= CWEventMask;
+ bw = 0;
+ depth = 0;
+ flags |= CWEventMask;
} else {
- depth = DefaultDepth(dpy,screen);
- flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
-
- if (backPixmap != (Pixmap)0) {
- xswa.background_pixmap = backPixmap;
- flags |= CWBackPixmap;
- } else {
- xswa.background_pixel = bg;
- flags |= CWBackPixel;
- }
- xswa.border_pixel = bd;
+ depth = DefaultDepth(dpy,screen);
+ flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
+
+ if (backPixmap != (Pixmap)0) {
+ xswa.background_pixmap = backPixmap;
+ flags |= CWBackPixmap;
+ } else {
+ xswa.background_pixel = bg;
+ flags |= CWBackPixel;
+ }
+ xswa.border_pixel = bd;
}
visual.visualid = CopyFromParent;
if (__isSmallInteger(preferredDepth)) {
- depth = __intVal(preferredDepth);
+ depth = __intVal(preferredDepth);
}
if (preferredVisual != nil) {
- XVisualInfo vi;
- int cls;
-
- if (preferredVisual == @symbol(StaticGray))
- cls = StaticGray;
- else if (preferredVisual == @symbol(GrayScale))
- cls = GrayScale;
- else if (preferredVisual == @symbol(StaticColor))
- cls = StaticColor;
- else if (preferredVisual == @symbol(PseudoColor))
- cls = PseudoColor;
- else if (preferredVisual == @symbol(TrueColor))
- cls = TrueColor;
- else if (preferredVisual == @symbol(DirectColor))
- cls = DirectColor;
- else
- cls = PseudoColor;
-
- ENTER_XLIB();
- if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
- visual.visualid = vi.visualid;
+ XVisualInfo vi;
+ int cls;
+
+ if (preferredVisual == @symbol(StaticGray))
+ cls = StaticGray;
+ else if (preferredVisual == @symbol(GrayScale))
+ cls = GrayScale;
+ else if (preferredVisual == @symbol(StaticColor))
+ cls = StaticColor;
+ else if (preferredVisual == @symbol(PseudoColor))
+ cls = PseudoColor;
+ else if (preferredVisual == @symbol(TrueColor))
+ cls = TrueColor;
+ else if (preferredVisual == @symbol(DirectColor))
+ cls = DirectColor;
+ else
+ cls = PseudoColor;
+
+ ENTER_XLIB();
+ if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
+ visual.visualid = vi.visualid;
/*
- console_fprintf(stderr, "visualId=%x\n", vi.visualid);
+ console_fprintf(stderr, "visualId=%x\n", vi.visualid);
*/
- }
- LEAVE_XLIB();
+ }
+ LEAVE_XLIB();
}
ENTER_XLIB2();
newWindow = XCreateWindow(dpy, parentWindow,
- sizehints.x, sizehints.y,
- sizehints.width, sizehints.height,
- bw, depth, ioClass, &visual,
- flags, &xswa);
+ sizehints.x, sizehints.y,
+ sizehints.width, sizehints.height,
+ bw, depth, ioClass, &visual,
+ flags, &xswa);
LEAVE_XLIB();
if (! newWindow) {
- RETURN ( nil );
+ RETURN ( nil );
}
#ifdef COUNT_RESOURCES
@@ -2321,168 +2321,168 @@
* (only makes sense for topWindows)
*/
if (isTopWindow == true) {
- XWMHints wmhints;
-
- wmhints.flags = 0;
-
- if (__isExternalAddress(wiconId)) {
- wmhints.icon_pixmap = __PixmapVal(wiconId);
- wmhints.flags = IconPixmapHint;
- if (__isExternalAddress(wiconMaskId)) {
- wmhints.icon_mask = __PixmapVal(wiconMaskId);
- wmhints.flags |= IconMaskHint;
- }
- }
-
- if (__isExternalAddress(windowGroupWindowId)) {
- wmhints.window_group = __WindowVal(windowGroupWindowId);
- wmhints.flags |= WindowGroupHint;
- }
-
- if (__isExternalAddress(wiconViewId)) {
- wmhints.flags |= IconWindowHint;
- wmhints.icon_window = __WindowVal(wiconViewId);
- };
+ XWMHints wmhints;
+
+ wmhints.flags = 0;
+
+ if (__isExternalAddress(wiconId)) {
+ wmhints.icon_pixmap = __PixmapVal(wiconId);
+ wmhints.flags = IconPixmapHint;
+ if (__isExternalAddress(wiconMaskId)) {
+ wmhints.icon_mask = __PixmapVal(wiconMaskId);
+ wmhints.flags |= IconMaskHint;
+ }
+ }
+
+ if (__isExternalAddress(windowGroupWindowId)) {
+ wmhints.window_group = __WindowVal(windowGroupWindowId);
+ wmhints.flags |= WindowGroupHint;
+ }
+
+ if (__isExternalAddress(wiconViewId)) {
+ wmhints.flags |= IconWindowHint;
+ wmhints.icon_window = __WindowVal(wiconViewId);
+ };
/*
- wmhints.flags |= InputHint;
- wmhints.input = True;
+ wmhints.flags |= InputHint;
+ wmhints.input = True;
*/
- ENTER_XLIB();
- XSetWMHints(dpy, newWindow, &wmhints);
- XSetWMNormalHints(dpy, newWindow, &sizehints);
- LEAVE_XLIB();
-
- /*
- * get atoms first (if not already known)
- */
- if (__INST(protocolsAtom) == nil) {
- ENTER_XLIB();
- WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
- __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
+ ENTER_XLIB();
+ XSetWMHints(dpy, newWindow, &wmhints);
+ XSetWMNormalHints(dpy, newWindow, &sizehints);
+ LEAVE_XLIB();
+
+ /*
+ * get atoms first (if not already known)
+ */
+ if (__INST(protocolsAtom) == nil) {
+ ENTER_XLIB();
+ WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
+ __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
#ifdef USE_SAVEYOURSELF_ATOM
- WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
- __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
+ WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
+ __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
#endif
#ifdef USE_QUIT_APP_ATOM
- WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
- __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
-#endif
- WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
- __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
-
- UUIDAtom = XInternAtom(dpy, "UUID", False);
- __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom);
- STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False);
- __INST(stxDeviceAtom) = __MKATOMOBJ(STXDeviceAtom);
-
- LEAVE_XLIB();
- } else {
+ WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
+ __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
+#endif
+ WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
+ __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
+
+ UUIDAtom = XInternAtom(dpy, "UUID", False);
+ __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom);
+ STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False);
+ __INST(stxDeviceAtom) = __MKATOMOBJ(STXDeviceAtom);
+
+ LEAVE_XLIB();
+ } else {
#ifdef USE_QUIT_APP_ATOM
- WmQuitAppAtom = __AtomVal(__INST(quitAppAtom));
+ WmQuitAppAtom = __AtomVal(__INST(quitAppAtom));
#else
- WmQuitAppAtom = 0;
-#endif
- WmProtocolsAtom = __AtomVal(__INST(protocolsAtom));
- WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom));
+ WmQuitAppAtom = 0;
+#endif
+ WmProtocolsAtom = __AtomVal(__INST(protocolsAtom));
+ WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom));
#ifdef USE_SAVEYOURSELF_ATOM
- WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom));
+ WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom));
#else
- WmSaveYourselfAtom = 0;
-#endif
- UUIDAtom = __AtomVal(__INST(uuidAtom));;
- STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));;
- }
-
- /*
- * tell window manager to not kill us but send an event instead
- */
- atoms[0] = WmDeleteWindowAtom; atomCount++;
+ WmSaveYourselfAtom = 0;
+#endif
+ UUIDAtom = __AtomVal(__INST(uuidAtom));;
+ STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));;
+ }
+
+ /*
+ * tell window manager to not kill us but send an event instead
+ */
+ atoms[0] = WmDeleteWindowAtom; atomCount++;
#ifdef USE_SAVEYOURSELF_ATOM
- atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
+ atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
#endif
#ifdef USE_QUIT_APP_ATOM
- atoms[atomCount] = WmQuitAppAtom; atomCount++;
-#endif
- ENTER_XLIB();
- XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
- 32, PropModeReplace, (unsigned char *)atoms, atomCount);
- LEAVE_XLIB();
-
- /*
- * an optional unique id (to mark stx-windows)
- */
- if (__isBytes(__INST(uniqueDeviceID))) {
- int numUUIDBytes = __byteArraySize(__INST(uniqueDeviceID));
- unsigned char uuidBytes[32];
-
- if (numUUIDBytes <= sizeof(uuidBytes)) {
- Atom uuidAtom;
-
- bcopy(__byteArrayVal(__INST(uniqueDeviceID)), uuidBytes, numUUIDBytes);
-
- ENTER_XLIB();
- XChangeProperty (dpy, newWindow, STXDeviceAtom, UUIDAtom, 8, PropModeReplace,
- uuidBytes, numUUIDBytes );
- LEAVE_XLIB();
- }
- }
+ atoms[atomCount] = WmQuitAppAtom; atomCount++;
+#endif
+ ENTER_XLIB();
+ XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
+ 32, PropModeReplace, (unsigned char *)atoms, atomCount);
+ LEAVE_XLIB();
+
+ /*
+ * an optional unique id (to mark stx-windows)
+ */
+ if (__isBytes(__INST(uniqueDeviceID))) {
+ int numUUIDBytes = __byteArraySize(__INST(uniqueDeviceID));
+ unsigned char uuidBytes[32];
+
+ if (numUUIDBytes <= sizeof(uuidBytes)) {
+ Atom uuidAtom;
+
+ bcopy(__byteArrayVal(__INST(uniqueDeviceID)), uuidBytes, numUUIDBytes);
+
+ ENTER_XLIB();
+ XChangeProperty (dpy, newWindow, STXDeviceAtom, UUIDAtom, 8, PropModeReplace,
+ uuidBytes, numUUIDBytes );
+ LEAVE_XLIB();
+ }
+ }
#ifdef SUPPORT_MOTIF_WM_HINTS
- /*
- * less decoration
- */
- if ((wStyle == @symbol(undecorated))
- || (wStyle == @symbol(dialog2))
- || (wStyle == @symbol(notitle))
- ) {
- if (__INST(motifWMHintsAtom) == nil) {
- ENTER_XLIB();
- MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
- __INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom);
- LEAVE_XLIB();
- } else {
- MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom));
- }
-
- {
- struct hints {
- unsigned long flags;
- unsigned long functions;
- unsigned long decorations;
- long input_mode;
- unsigned long status;
- } mvm_hints;
-
- if (wStyle == @symbol(undecorated)) {
- mvm_hints.decorations = MWM_DECOR_NONE;
- }
- if (wStyle == @symbol(dialog2)) {
- mvm_hints.decorations = MWM_DECOR_BORDER
- | MWM_DECOR_RESIZEH
- | MWM_DECOR_TITLE
- /* | MWM_DECOR_MENU */
- /* | MWM_DECOR_MINIMIZE */
- /* | MWM_DECOR_MAXIMIZE */
- ;
- }
- if (wStyle == @symbol(notitle)) {
- mvm_hints.decorations = MWM_DECOR_BORDER
- /* | MWM_DECOR_RESIZEH */
- /* | MWM_DECOR_TITLE */
- /* | MWM_DECOR_MENU */
- /* | MWM_DECOR_MINIMIZE */
- /* | MWM_DECOR_MAXIMIZE */
- ;
- }
- mvm_hints.flags = MWM_HINTS_DECORATIONS;
- ENTER_XLIB();
- XChangeProperty (dpy, newWindow, MotifWMHintsAtom,
- MotifWMHintsAtom, 32, PropModeReplace,
- (unsigned char*)&mvm_hints, 5 );
- LEAVE_XLIB();
- }
- }
+ /*
+ * less decoration
+ */
+ if ((wStyle == @symbol(undecorated))
+ || (wStyle == @symbol(dialog2))
+ || (wStyle == @symbol(notitle))
+ ) {
+ if (__INST(motifWMHintsAtom) == nil) {
+ ENTER_XLIB();
+ MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
+ __INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom);
+ LEAVE_XLIB();
+ } else {
+ MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom));
+ }
+
+ {
+ struct hints {
+ unsigned long flags;
+ unsigned long functions;
+ unsigned long decorations;
+ long input_mode;
+ unsigned long status;
+ } mvm_hints;
+
+ if (wStyle == @symbol(undecorated)) {
+ mvm_hints.decorations = MWM_DECOR_NONE;
+ }
+ if (wStyle == @symbol(dialog2)) {
+ mvm_hints.decorations = MWM_DECOR_BORDER
+ | MWM_DECOR_RESIZEH
+ | MWM_DECOR_TITLE
+ /* | MWM_DECOR_MENU */
+ /* | MWM_DECOR_MINIMIZE */
+ /* | MWM_DECOR_MAXIMIZE */
+ ;
+ }
+ if (wStyle == @symbol(notitle)) {
+ mvm_hints.decorations = MWM_DECOR_BORDER
+ /* | MWM_DECOR_RESIZEH */
+ /* | MWM_DECOR_TITLE */
+ /* | MWM_DECOR_MENU */
+ /* | MWM_DECOR_MINIMIZE */
+ /* | MWM_DECOR_MAXIMIZE */
+ ;
+ }
+ mvm_hints.flags = MWM_HINTS_DECORATIONS;
+ ENTER_XLIB();
+ XChangeProperty (dpy, newWindow, MotifWMHintsAtom,
+ MotifWMHintsAtom, 32, PropModeReplace,
+ (unsigned char*)&mvm_hints, 5 );
+ LEAVE_XLIB();
+ }
+ }
#endif /* SUPPORT_MOTIF_WM_HINTS */
}
@@ -2495,9 +2495,9 @@
(wsuperView isNil "this is a topwindow"
and:[wlabel notEmptyOrNil]) ifTrue:[
- self
- setIconName:wlabel in:windowId;
- setWindowName:wlabel in:windowId.
+ self
+ setIconName:wlabel in:windowId;
+ setWindowName:wlabel in:windowId.
].
self addKnownView:aView withId:windowId.
@@ -4635,12 +4635,12 @@
!
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
- width:imageWidth height:imageHeight
- x:srcx y:srcy
- into:aDrawableId
- x:dstx y:dsty
- width:w height:h
- with:aGCId
+ width:imageWidth height:imageHeight
+ x:srcx y:srcy
+ into:aDrawableId
+ x:dstx y:dsty
+ width:w height:h
+ with:aGCId
"draw a bitImage which has depth id, width iw and height ih into
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
@@ -4662,44 +4662,44 @@
"/ care for that.
((imageDepth == 4) and:[depth == 4]) ifTrue:[
- fmt := self supportedImageFormatForDepth:4.
- fmt isNil ifTrue:[
- self primitiveFailed. "/ cannot represent this image
- ^ nil
- ].
- wantedPadding := fmt at:#padding.
- wantedPadding > givenPadding ifTrue:[
- bits := self
- repadBits:givenBits
- width:imageWidth
- height:imageHeight
- depth:imageDepth
- from:givenPadding
- to:wantedPadding.
- padding := wantedPadding.
- ]
- ].
-
- self
- drawBits:bits
- msb:true bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
- width:imageWidth height:imageHeight
- x:srcx y:srcy
- into:aDrawableId
- x:dstx y:dsty
- width:w height:h
- with:aGCId
+ fmt := self supportedImageFormatForDepth:4.
+ fmt isNil ifTrue:[
+ self primitiveFailed. "/ cannot represent this image
+ ^ nil
+ ].
+ wantedPadding := fmt at:#padding.
+ wantedPadding > givenPadding ifTrue:[
+ bits := self
+ repadBits:givenBits
+ width:imageWidth
+ height:imageHeight
+ depth:imageDepth
+ from:givenPadding
+ to:wantedPadding.
+ padding := wantedPadding.
+ ]
+ ].
+
+ self
+ drawBits:bits
+ msb:true bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
+ width:imageWidth height:imageHeight
+ x:srcx y:srcy
+ into:aDrawableId
+ x:dstx y:dsty
+ width:w height:h
+ with:aGCId
"Modified: / 11-04-2017 / 18:50:32 / cg"
!
drawBits:bits msb:msb bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
- width:imageWidth height:imageHeight
- x:srcx y:srcy
- into:aDrawableId
- x:dstx y:dsty
- width:w height:h
- with:aGCId
+ width:imageWidth height:imageHeight
+ x:srcx y:srcy
+ into:aDrawableId
+ x:dstx y:dsty
+ width:w height:h
+ with:aGCId
"draw a bitImage which has depth id, width iw and height ih into
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
@@ -4711,34 +4711,34 @@
colors are allocated - otherwise the colors may be wrong."
operationsUntilFlush notNil ifTrue:[
- operationsUntilFlush <= 0 ifTrue:[
- self flush.
- ] ifFalse:[
- operationsUntilFlush := operationsUntilFlush - 1.
- ].
+ operationsUntilFlush <= 0 ifTrue:[
+ self flush.
+ ] ifFalse:[
+ operationsUntilFlush := operationsUntilFlush - 1.
+ ].
].
"
sorry; I had to separate it into 2 methods, since XPutImage needs
an unlimited stack, and thus cannot send primitiveFailed
"
(self
- primDrawBits:bits
- bitsPerPixel:bitsPerPixel
- depth:imageDepth
- msb:msb
- padding:padding
- width:imageWidth height:imageHeight
- x:srcx y:srcy
- into:aDrawableId
- x:dstx y:dsty
- width:w height:h
- with:aGCId)
+ primDrawBits:bits
+ bitsPerPixel:bitsPerPixel
+ depth:imageDepth
+ msb:msb
+ padding:padding
+ width:imageWidth height:imageHeight
+ x:srcx y:srcy
+ into:aDrawableId
+ x:dstx y:dsty
+ width:w height:h
+ with:aGCId)
ifFalse:[
- "
- also happens, if a segmentation violation occurs in the
- XPutImage ...
- "
- self primitiveFailedOrClosedConnection
+ "
+ also happens, if a segmentation violation occurs in the
+ XPutImage ...
+ "
+ self primitiveFailedOrClosedConnection
].
"Created: / 11-04-2017 / 18:49:44 / cg"
@@ -4924,10 +4924,10 @@
!
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb masks:maskArray padding:bitPadding
- extent:imageExtent sourceOrigin:srcOrg
- into:aDrawableId
- destinationOrigin:dstOrg extent:dstExtent
- with:aGCId
+ extent:imageExtent sourceOrigin:srcOrg
+ into:aDrawableId
+ destinationOrigin:dstOrg extent:dstExtent
+ with:aGCId
<context: #return>
@@ -4971,57 +4971,57 @@
&& __bothSmallInteger(rm, gm)
&& __isSmallInteger(bm)
&& __isByteArrayLike(imageBits)) {
- Display *dpy = myDpy;
- int pad = __intVal(bitPadding);
-
- gc = __GCVal(aGCId);
- win = __WindowVal(aDrawableId);
- if (! gc || !win)
- goto fail;
+ Display *dpy = myDpy;
+ int pad = __intVal(bitPadding);
+
+ gc = __GCVal(aGCId);
+ win = __WindowVal(aDrawableId);
+ if (! gc || !win)
+ goto fail;
#ifdef ARGDEBUG
- console_printf("args ok\n");
-#endif
- image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
- image.width = imgWdth = __intVal(imageWidth);
- image.height = __intVal(imageHeight);
- image.xoffset = 0;
- image.format = ZPixmap;
- image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
- image.bitmap_unit = 8;
- image.bitmap_bit_order = MSBFirst;
- image.bitmap_pad = pad;
- image.depth = __intVal(imageDepth);
- image.bits_per_pixel = __intVal(bitsPerPixel);
- image.red_mask = __intVal(rm);
- image.green_mask = __intVal(gm);
- image.blue_mask = __intVal(bm);
-
- image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
-
- switch (image.bits_per_pixel) {
- case 1:
- case 2:
- case 4:
- case 8:
- case 16:
- case 24:
- case 32:
- break;
-
- default:
+ console_printf("args ok\n");
+#endif
+ image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
+ image.width = imgWdth = __intVal(imageWidth);
+ image.height = __intVal(imageHeight);
+ image.xoffset = 0;
+ image.format = ZPixmap;
+ image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
+ image.bitmap_unit = 8;
+ image.bitmap_bit_order = MSBFirst;
+ image.bitmap_pad = pad;
+ image.depth = __intVal(imageDepth);
+ image.bits_per_pixel = __intVal(bitsPerPixel);
+ image.red_mask = __intVal(rm);
+ image.green_mask = __intVal(gm);
+ image.blue_mask = __intVal(bm);
+
+ image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
+
+ switch (image.bits_per_pixel) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+
+ default:
#ifdef ARGDEBUG
- console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
-#endif
- goto fail;
- }
-
- /* ENTER_XLIB(); */
- XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
- __intVal(dstx), __intVal(dsty),
- __intVal(w), __intVal(h));
- /* LEAVE_XLIB(); */
-
- RETURN ( true );
+ console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
+#endif
+ goto fail;
+ }
+
+ /* ENTER_XLIB(); */
+ XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
+ __intVal(dstx), __intVal(dsty),
+ __intVal(w), __intVal(h));
+ /* LEAVE_XLIB(); */
+
+ RETURN ( true );
}
#ifdef ARGDEBUG
if (! __isExternalAddress(aGCId)) console_printf("GC\n");
@@ -5048,12 +5048,12 @@
!
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding
- width:imageWidth height:imageHeight
- x:srcx y:srcy
- into:aDrawableId
- x:dstx y:dsty
- width:w height:h
- with:aGCId
+ width:imageWidth height:imageHeight
+ x:srcx y:srcy
+ into:aDrawableId
+ x:dstx y:dsty
+ width:w height:h
+ with:aGCId
<context: #return>
@@ -5081,61 +5081,61 @@
&& __bothSmallInteger(imageDepth, bitsPerPixel)
&& __isSmallInteger(bitPadding)
&& __isByteArrayLike(imageBits)) {
- Display *dpy = myDpy;
- int pad = __intVal(bitPadding);
-
- gc = __GCVal(aGCId);
- win = __WindowVal(aDrawableId);
- if (! gc || !win)
- goto fail;
+ Display *dpy = myDpy;
+ int pad = __intVal(bitPadding);
+
+ gc = __GCVal(aGCId);
+ win = __WindowVal(aDrawableId);
+ if (! gc || !win)
+ goto fail;
#ifdef ARGDEBUG
- console_printf("args ok\n");
-#endif
- image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
- image.width = imgWdth = __intVal(imageWidth);
- image.height = __intVal(imageHeight);
- image.xoffset = 0;
- image.format = ZPixmap;
- image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
- image.bitmap_unit = 8;
- image.bitmap_bit_order = MSBFirst;
- image.bitmap_pad = pad;
- image.depth = __intVal(imageDepth);
- image.bits_per_pixel = __intVal(bitsPerPixel);
-
- /*
- image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8;
- */
- image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
-
- switch (image.bits_per_pixel) {
- case 1:
- case 2:
- case 4:
- case 8:
- case 16:
- case 24:
- case 32:
- break;
-
- default:
+ console_printf("args ok\n");
+#endif
+ image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
+ image.width = imgWdth = __intVal(imageWidth);
+ image.height = __intVal(imageHeight);
+ image.xoffset = 0;
+ image.format = ZPixmap;
+ image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
+ image.bitmap_unit = 8;
+ image.bitmap_bit_order = MSBFirst;
+ image.bitmap_pad = pad;
+ image.depth = __intVal(imageDepth);
+ image.bits_per_pixel = __intVal(bitsPerPixel);
+
+ /*
+ image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8;
+ */
+ image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
+
+ switch (image.bits_per_pixel) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+
+ default:
#ifdef ARGDEBUG
- console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
-#endif
- goto fail;
- }
-
- image.red_mask = 0xFFFF;
- image.green_mask = 0xFFFF;
- image.blue_mask = 0xFFFF;
-
- /* ENTER_XLIB(); */
- XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
- __intVal(dstx), __intVal(dsty),
- __intVal(w), __intVal(h));
- /* LEAVE_XLIB(); */
-
- RETURN ( true );
+ console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
+#endif
+ goto fail;
+ }
+
+ image.red_mask = 0xFFFF;
+ image.green_mask = 0xFFFF;
+ image.blue_mask = 0xFFFF;
+
+ /* ENTER_XLIB(); */
+ XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
+ __intVal(dstx), __intVal(dsty),
+ __intVal(w), __intVal(h));
+ /* LEAVE_XLIB(); */
+
+ RETURN ( true );
}
#ifdef ARGDEBUG
if (! __isExternalAddress(aGCId)) console_printf("GC\n");
@@ -5194,32 +5194,32 @@
].
logicalButton isInteger ifTrue:[
- buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
+ buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
].
clickPosition := x @ y.
- (multiClickTimeDelta notNil
+ (multiClickTimeDelta notNil
and:[lastButtonPressTime notNil
and:[time < (lastButtonPressTime + multiClickTimeDelta)
and:[(clickPosition dist:lastButtonPressPosition) < 6]]]) ifTrue:[
- lastButtonPressTime := time.
- lastButtonPressPosition := clickPosition.
- self buttonMultiPress:logicalButton x:x y:y view:view.
- ^ self.
+ lastButtonPressTime := time.
+ lastButtonPressPosition := clickPosition.
+ self buttonMultiPress:logicalButton x:x y:y view:view.
+ ^ self.
].
lastButtonPressTime := time.
lastButtonPressPosition := clickPosition.
view isNil ifTrue:[
- "/ event arrived, after I destroyed it myself
- ^ self
+ "/ event arrived, after I destroyed it myself
+ ^ self
].
(logicalButton == 1 and:[activateOnClick == true]) ifTrue:[
- "/ don't raise above an active popup view.
- (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
- view topView raise.
- ]
+ "/ don't raise above an active popup view.
+ (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
+ view topView raise.
+ ]
].
self buttonPress:logicalButton x:x y:y view:view
@@ -5597,12 +5597,12 @@
lastEventTime := time.
aView isNil ifTrue:[
- "event arrived, after aView has been destroyed"
- ^ self
+ "event arrived, after aView has been destroyed"
+ ^ self
].
selectionFetcher := self findSelectionFetcher:aView id.
selectionFetcher notNil ifTrue:[
- selectionFetcher message:thisContext message.
+ selectionFetcher message:thisContext message.
].
"Modified (format): / 14-03-2017 / 16:31:20 / cg"
@@ -5764,21 +5764,21 @@
viewId := evArray at:1.
viewId notNil ifTrue:[
- viewId = lastId ifTrue:[
- view := lastView
- ] ifFalse:[
- view := self viewFromId:viewId
- ].
+ viewId = lastId ifTrue:[
+ view := lastView
+ ] ifFalse:[
+ view := self viewFromId:viewId
+ ].
].
evType := evArray at:3.
(self respondsTo:evType) ifTrue:[
- arguments := evArray copyFrom:3 to:(3 + evType argumentCount - 1).
- arguments at:1 put:view.
-
- self perform:evType withArguments:arguments.
- ^ true.
+ arguments := evArray copyFrom:3 to:(3 + evType argumentCount - 1).
+ arguments at:1 put:view.
+
+ self perform:evType withArguments:arguments.
+ ^ true.
].
'********** unhandled event:' errorPrintCR.
@@ -9875,7 +9875,7 @@
Nil returned for other displays"
OperatingSystem isOSXlike ifTrue:[
- ^ 8192
+ ^ 8192
].
^ nil
@@ -9887,7 +9887,7 @@
Nil returned for other displays"
OperatingSystem isOSXlike ifTrue:[
- ^ 16
+ ^ 16
].
^ nil
@@ -10623,15 +10623,15 @@
|val typeID propertyID windowID|
propertySymbolOrAtomID isString ifTrue:[
- propertyID := self atomIDOf:propertySymbolOrAtomID create:false.
- propertyID isNil ifTrue:[^ nil].
+ propertyID := self atomIDOf:propertySymbolOrAtomID create:false.
+ propertyID isNil ifTrue:[^ nil].
] ifFalse:[
- propertyID := propertySymbolOrAtomID.
+ propertyID := propertySymbolOrAtomID.
].
aWindowOrWindowIDOrNil isView ifTrue:[
- windowID := aWindowOrWindowIDOrNil id.
+ windowID := aWindowOrWindowIDOrNil id.
] ifFalse:[
- windowID := aWindowOrWindowIDOrNil.
+ windowID := aWindowOrWindowIDOrNil.
].
%{
@@ -10646,99 +10646,118 @@
# define PROP_SIZE 2048
if (ISCONNECTED) {
- Display *dpy = myDpy;
-
- if (__isAtomID(propertyID)) {
- property = __AtomVal(propertyID);
-
- if (__isExternalAddress(windowID)) {
- window = __WindowVal(windowID);
- } else if (windowID == nil) {
- window = DefaultRootWindow(dpy);
- } else
- goto fail;
-
- nread = 0;
- cp = 0;
+ Display *dpy = myDpy;
+
+ if (__isAtomID(propertyID)) {
+ property = __AtomVal(propertyID);
+
+ if (__isExternalAddress(windowID)) {
+ window = __WindowVal(windowID);
+ } else if (windowID == nil) {
+ window = DefaultRootWindow(dpy);
+ } else
+ goto fail;
+
+ nread = 0;
+ cp = 0;
#ifdef PROPERTY_DEBUG
- console_fprintf(stderr, "getProperty %x\n", property);
-#endif
-
- do {
- int retVal;
-
- ENTER_XLIB();
- retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
- doDelete == true,
- AnyPropertyType, &actual_type, &actual_format,
- &nitems, &bytes_after, (unsigned char **)&data);
- LEAVE_XLIB();
- if (retVal != Success) {
+ console_fprintf(stderr, "getProperty %x\n", property);
+#endif
+
+ do {
+ int retVal;
+
+ ENTER_XLIB();
+ retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
+ doDelete == true,
+ AnyPropertyType, &actual_type, &actual_format,
+ &nitems, &bytes_after, (unsigned char **)&data);
+ LEAVE_XLIB();
+ if (retVal != Success) {
#ifdef PROPERTY_DEBUG
- console_fprintf(stderr, "- no success\n");
-#endif
- ok = 0;
- break;
- }
+ console_fprintf(stderr, "- no success\n");
+#endif
+ ok = 0;
+ break;
+ }
#ifdef PROPERTY_DEBUG
- console_fprintf(stderr, "- type:%x\n", actual_type);
-#endif
- nitems *= (actual_format / 8);
- typeID = __MKATOMOBJ(actual_type);
- if (! cp) {
- cp = cp2 = (char *)malloc(nitems+bytes_after);
- } else {
- cp2 = cp + nread;
- }
- if (! cp) {
- XFree(data);
- goto fail;
- }
-
- nread += nitems;
- bcopy(data, cp2, nitems);
- XFree(data);
+ console_fprintf(stderr, "- type:%x\n", actual_type);
+#endif
+ nitems *= (actual_format / 8);
+ typeID = __MKATOMOBJ(actual_type);
+ if (! cp) {
+ cp = cp2 = (char *)malloc(nitems+bytes_after);
+ } else {
+ cp2 = cp + nread;
+ }
+ if (! cp) {
+ XFree(data);
+ goto fail;
+ }
+
+ nread += nitems;
+ bcopy(data, cp2, nitems);
+ XFree(data);
#ifdef PROPERTY_DEBUG
- console_fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after);
-#endif
- } while (bytes_after > 0);
-
- if (ok) {
- switch (actual_format) {
- case 32:
- val = __stArrayFromCUIntArray((unsigned int*)cp, nread/4);
- break;
- case 16:
- val = __stArrayFromCUShortArray((unsigned short*)cp, nread/2);
- break;
- case 8:
- default:
- if (actual_type == XA_STRING) {
- val = __MKSTRING_L(cp, nread);
- } else {
- val = __MKBYTEARRAY(cp, nread);
- }
- break;
- }
- }
- if (cp)
- free(cp);
- }
+ console_fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after);
+#endif
+ } while (bytes_after > 0);
+
+ if (ok) {
+ switch (actual_format) {
+ case 32:
+ // bad design: even though it says "32",
+ // what is really returned are longs.
+ // this does make a difference on 64bit machines!
+ val = __stArrayFromCULongArray((unsigned long*)cp, nread/sizeof(long));
+ break;
+ case 16:
+ val = __stArrayFromCUShortArray((unsigned short*)cp, nread/2);
+ break;
+ case 8:
+ default:
+ if (actual_type == XA_STRING) {
+ val = __MKSTRING_L(cp, nread);
+ } else {
+ val = __MKBYTEARRAY(cp, nread);
+ }
+ break;
+ }
+ }
+ if (cp)
+ free(cp);
+ }
}
fail: ;
%}.
(typeID isNil or:[typeID == 0]) ifTrue:[
- "typeID == 0 (None): The property does not exist in the specified window"
- ^ nil
+ "typeID == 0 (None): The property does not exist in the specified window"
+ ^ nil
].
^ typeID->val
"
Display
- getProperty:#'_NET_WM_ICON_GEOMETRY'
- from:nil
- delete:false
- "
+ getProperty:#'_NET_WM_ICON_GEOMETRY'
+ from:nil
+ delete:false
+
+ Display
+ getProperty:#'_NET_SUPPORTED'
+ from:nil
+ delete:false
+
+ Transcript showCR:(
+ (Display
+ getProperty:#'_NET_SUPPORTED'
+ from:nil
+ delete:false)
+ value
+ collect:[:eachID | Display atomName:eachID])
+
+ "
+
+ "Modified: / 31-08-2017 / 22:01:44 / cg"
!
propertiesOf:aWindowOrWindowIDOrNil
@@ -11226,80 +11245,80 @@
&& __bothSmallInteger(w, h)
&& __isArray(info) && (__arraySize(info) >= 8)
&& __isByteArray(imageBits)) {
- Display *dpy = myDpy;
-
- win = __WindowVal(aDrawableId);
- ENTER_XLIB();
- image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
- __intVal(w), __intVal(h),
- (unsigned)AllPlanes, ZPixmap);
- LEAVE_XLIB();
-
- if (! image) {
- RETURN ( false );
- }
-
- pad = image->bitmap_pad;
+ Display *dpy = myDpy;
+
+ win = __WindowVal(aDrawableId);
+ ENTER_XLIB();
+ image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
+ __intVal(w), __intVal(h),
+ (unsigned)AllPlanes, ZPixmap);
+ LEAVE_XLIB();
+
+ if (! image) {
+ RETURN ( false );
+ }
+
+ pad = image->bitmap_pad;
#ifdef SUPERDEBUG
- console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
-#endif
- switch (image->depth) {
- case 1:
- case 2:
- case 4:
- case 8:
- case 16:
- case 24:
- case 32:
- numBytes = image->bytes_per_line * image->height;
- break;
-
- default:
- /* unsupported depth ? */
- console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth);
- numBytes = image->bytes_per_line * image->height;
- break;
- }
+ console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
+#endif
+ switch (image->depth) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ numBytes = image->bytes_per_line * image->height;
+ break;
+
+ default:
+ /* unsupported depth ? */
+ console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth);
+ numBytes = image->bytes_per_line * image->height;
+ break;
+ }
#ifdef SUPERDEBUG
- console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits));
-#endif
-
- if (numBytes > __byteArraySize(imageBits)) {
- /* imageBits too small */
- console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
- console_fprintf(stderr, " bytes need:%d given:%d\n", numBytes, (int)__byteArraySize(imageBits));
- console_fprintf(stderr, " pad:%d depth:%d imgBytesPerLine:%d\n",
- image->bitmap_pad, image->depth, image->bytes_per_line);
- goto fail;
- }
- if (image->bitmap_bit_order == MSBFirst)
- __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
- else
- __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
- __ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
- __ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
- if (image->byte_order == MSBFirst)
- __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
- else
- __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
- if (image->format == XYBitmap)
- __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
- else if (image->format == XYPixmap)
- __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
- else if (image->format == ZPixmap)
- __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
-
- __ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
- __ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
- __ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
- bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
- XDestroyImage(image);
- RETURN ( true );
+ console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits));
+#endif
+
+ if (numBytes > __byteArraySize(imageBits)) {
+ /* imageBits too small */
+ console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
+ console_fprintf(stderr, " bytes need:%d given:%d\n", numBytes, (int)__byteArraySize(imageBits));
+ console_fprintf(stderr, " pad:%d depth:%d imgBytesPerLine:%d\n",
+ image->bitmap_pad, image->depth, image->bytes_per_line);
+ goto fail;
+ }
+ if (image->bitmap_bit_order == MSBFirst)
+ __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
+ else
+ __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
+ __ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
+ __ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
+ if (image->byte_order == MSBFirst)
+ __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
+ else
+ __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
+ if (image->format == XYBitmap)
+ __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
+ else if (image->format == XYPixmap)
+ __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
+ else if (image->format == ZPixmap)
+ __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
+
+ __ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
+ __ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
+ __ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
+ bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
+ XDestroyImage(image);
+ RETURN ( true );
}
fail:
if (image) {
- XDestroyImage(image);
+ XDestroyImage(image);
}
%}.
^ false
@@ -13601,31 +13620,31 @@
incremental := false.
[
- |timeout|
-
- display registerSelectionFetcher:self.
-
- display
- requestSelection:aSelectionId
- type:aTargetId
- for:drawableID
- intoProperty:propertyID.
-
- timeout := display xlibTimeout.
- [
- |currentMessage|
-
- (sema waitWithTimeout:timeout) isNil ifTrue:[
- "the selection owner didn't respond within reasonable time"
- 'XWorkstation(error): selection owner does not respond:' infoPrint. display infoPrintCR.
- ^ nil.
- ].
- currentMessage := message.
- message := nil.
- currentMessage notNil ifTrue:[currentMessage sendTo:self].
- ] doUntil:[done].
+ |timeout|
+
+ display registerSelectionFetcher:self.
+
+ display
+ requestSelection:aSelectionId
+ type:aTargetId
+ for:drawableID
+ intoProperty:propertyID.
+
+ timeout := display xlibTimeout.
+ [
+ |currentMessage|
+
+ (sema waitWithTimeout:timeout) isNil ifTrue:[
+ "the selection owner didn't respond within reasonable time"
+ 'XWorkstation(error): selection owner does not respond:' infoPrint. display infoPrintCR.
+ ^ nil.
+ ].
+ currentMessage := message.
+ message := nil.
+ currentMessage notNil ifTrue:[currentMessage sendTo:self].
+ ] doUntil:[done].
] ensure:[
- display unregisterSelectionFetcher:self.
+ display unregisterSelectionFetcher:self.
].
^ self getSelection