Fixed wrong string comparison.

This commit is contained in:
frese 2001-07-16 11:52:01 +00:00
parent 704e6cc895
commit 2a471242a5
2 changed files with 65 additions and 77 deletions

View File

@ -12,73 +12,73 @@ unsigned long AList_To_GCValues(s48_value alist, XGCValues* GCV) {
value = S48_CDR(l); value = S48_CDR(l);
cname = s48_extract_string(S48_SYMBOL_TO_STRING(name)); cname = s48_extract_string(S48_SYMBOL_TO_STRING(name));
if (cname == "function") { if (strcmp(cname, "function") == 0) {
GCV->function = Symbols_To_Bits(value, 0, Func_Syms); GCV->function = Symbols_To_Bits(value, 0, Func_Syms);
mask |= GCFunction; mask |= GCFunction;
} else if (cname == "plane-mask") { } else if (strcmp(cname, "plane-mask") == 0) {
GCV->plane_mask = EXTRACT_PIXEL(value); GCV->plane_mask = EXTRACT_PIXEL(value);
mask |= GCPlaneMask; mask |= GCPlaneMask;
} else if (cname == "foreground") { } else if (strcmp(cname, "foreground") == 0) {
GCV->foreground = EXTRACT_PIXEL(value); GCV->foreground = EXTRACT_PIXEL(value);
mask |= GCForeground; mask |= GCForeground;
} else if (cname == "background") { } else if (strcmp(cname, "background") == 0) {
GCV->background = EXTRACT_PIXEL(value); GCV->background = EXTRACT_PIXEL(value);
mask |= GCBackground; mask |= GCBackground;
} else if (cname == "line-width") { } else if (strcmp(cname, "line-width") == 0) {
GCV->line_width = s48_extract_integer(value); GCV->line_width = s48_extract_integer(value);
mask |= GCLineWidth; mask |= GCLineWidth;
} else if (cname == "line-style") { } else if (strcmp(cname, "line-style") == 0) {
GCV->line_style = Symbol_To_Bit(value,Line_Style_Syms); GCV->line_style = Symbol_To_Bit(value,Line_Style_Syms);
mask |= GCLineStyle; mask |= GCLineStyle;
} else if (cname == "cap-style") { } else if (strcmp(cname, "cap-style") == 0) {
GCV->cap_style = Symbol_To_Bit(value, Cap_Style_Syms); GCV->cap_style = Symbol_To_Bit(value, Cap_Style_Syms);
mask |= GCCapStyle; mask |= GCCapStyle;
} else if (cname == "join-style") { } else if (strcmp(cname, "join-style") == 0) {
GCV->join_style = Symbol_To_Bit(value, Join_Style_Syms); GCV->join_style = Symbol_To_Bit(value, Join_Style_Syms);
mask |= GCJoinStyle; mask |= GCJoinStyle;
} else if (cname == "fill-style") { } else if (strcmp(cname, "fill-style") == 0) {
GCV->fill_style = Symbol_To_Bit(value, Fill_Style_Syms); GCV->fill_style = Symbol_To_Bit(value, Fill_Style_Syms);
mask |= GCFillStyle; mask |= GCFillStyle;
} else if (cname == "fill-rule") { } else if (strcmp(cname, "fill-rule") == 0) {
GCV->fill_rule = Symbol_To_Bit(value, Fill_Rule_Syms); GCV->fill_rule = Symbol_To_Bit(value, Fill_Rule_Syms);
mask |= GCFillRule; mask |= GCFillRule;
} else if (cname == "arc-mode") { } else if (strcmp(cname, "arc-mode") == 0) {
GCV->arc_mode = Symbol_To_Bit(value, Arc_Mode_Syms); GCV->arc_mode = Symbol_To_Bit(value, Arc_Mode_Syms);
mask |= GCArcMode; mask |= GCArcMode;
} else if (cname == "tile") { } else if (strcmp(cname, "tile") == 0) {
GCV->tile = EXTRACT_PIXMAP(value); GCV->tile = EXTRACT_PIXMAP(value);
mask |= GCTile; mask |= GCTile;
} else if (cname == "stipple") { } else if (strcmp(cname, "stipple") == 0) {
GCV->stipple = EXTRACT_PIXMAP(value); GCV->stipple = EXTRACT_PIXMAP(value);
mask |= GCStipple; mask |= GCStipple;
} else if (cname == "ts-x") { } else if (strcmp(cname, "ts-x") == 0) {
GCV->ts_x_origin = s48_extract_integer(value); GCV->ts_x_origin = s48_extract_integer(value);
mask |= GCTileStipXOrigin; mask |= GCTileStipXOrigin;
} else if (cname == "ts-y") { } else if (strcmp(cname, "ts-y") == 0) {
GCV->ts_y_origin = s48_extract_integer(value); GCV->ts_y_origin = s48_extract_integer(value);
mask |= GCTileStipYOrigin; mask |= GCTileStipYOrigin;
} else if (cname == "font") { } else if (strcmp(cname, "font") == 0) {
GCV->font = EXTRACT_FONT(value); GCV->font = EXTRACT_FONT(value);
mask |= GCFont; mask |= GCFont;
} else if (cname == "subwindow-mode") { } else if (strcmp(cname, "subwindow-mode") == 0) {
GCV->subwindow_mode = Symbol_To_Bit(value, Subwin_Mode_Syms); GCV->subwindow_mode = Symbol_To_Bit(value, Subwin_Mode_Syms);
mask |= GCSubwindowMode; mask |= GCSubwindowMode;
} else if (cname == "exposures") { } else if (strcmp(cname, "exposures") == 0) {
GCV->graphics_exposures = !S48_FALSE_P(value); GCV->graphics_exposures = !S48_FALSE_P(value);
mask |= GCGraphicsExposures; mask |= GCGraphicsExposures;
} else if (cname == "clip-x") { } else if (strcmp(cname, "clip-x") == 0) {
GCV->clip_x_origin = s48_extract_integer(value); GCV->clip_x_origin = s48_extract_integer(value);
mask |= GCClipXOrigin; mask |= GCClipXOrigin;
} else if (cname == "clip-y") { } else if (strcmp(cname, "clip-y") == 0) {
GCV->clip_y_origin = s48_extract_integer(value); GCV->clip_y_origin = s48_extract_integer(value);
mask |= GCClipYOrigin; mask |= GCClipYOrigin;
} else if (cname == "clip-mask") { } else if (strcmp(cname, "clip-mask") == 0) {
GCV->clip_mask = EXTRACT_PIXMAP(value); GCV->clip_mask = EXTRACT_PIXMAP(value);
mask |= GCClipMask; mask |= GCClipMask;
} else if (cname == "dash-offset") { } else if (strcmp(cname, "dash-offset") == 0) {
GCV->dash_offset = s48_extract_integer(value); GCV->dash_offset = s48_extract_integer(value);
mask |= GCDashOffset; mask |= GCDashOffset;
} else if (cname == "dashes") { } else if (strcmp(cname, "dashes") == 0) {
GCV->dashes = (char)s48_extract_integer(value); GCV->dashes = (char)s48_extract_integer(value);
mask |= GCDashList; mask |= GCDashList;
} }

View File

@ -5,60 +5,62 @@ unsigned long AList_To_XSetWindowAttributes(s48_value attrAlist,
XSetWindowAttributes* Xattrs) { XSetWindowAttributes* Xattrs) {
unsigned long mask = 0; unsigned long mask = 0;
s48_value l; s48_value l;
s48_value p;
char* cname; char* cname;
s48_value name, value; s48_value name, value;
for (l = attrAlist; !S48_NULL_P(l); l = S48_CDR(l)) { for (l = attrAlist; !S48_NULL_P(l); l = S48_CDR(l)) {
name = S48_CAR(l); p = S48_CAR(l);
value = S48_CDR(l); name = S48_CAR(p);
cname = s48_extract_string(S48_SYMBOL_TO_STRING(name)); value = S48_CDR(p);
cname = s48_extract_symbol(name);
if (cname == "background-pixmap") {
if (strcmp(cname, "background-pixmap") == 0) {
Xattrs->background_pixmap = extract_background(value); Xattrs->background_pixmap = extract_background(value);
mask |= CWBackPixmap; mask |= CWBackPixmap;
} else if (cname == "background-pixel") { } else if (strcmp(cname, "background-pixel") == 0) {
Xattrs->background_pixel = s48_extract_integer(value); Xattrs->background_pixel = s48_extract_integer(value);
mask |= CWBackPixel; mask |= CWBackPixel;
} else if (cname == "border-pixmap") { } else if (strcmp(cname, "border-pixmap") == 0) {
Xattrs->border_pixmap = extract_border(value); Xattrs->border_pixmap = extract_border(value);
mask |= CWBorderPixmap; mask |= CWBorderPixmap;
} else if (cname == "border-pixel") { } else if (strcmp(cname, "border-pixel") == 0) {
Xattrs->border_pixel = s48_extract_integer(value); Xattrs->border_pixel = s48_extract_integer(value);
mask |= CWBorderPixel; mask |= CWBorderPixel;
} else if (cname == "bit-gravity") { } else if (strcmp(cname, "bit-gravity") == 0) {
Xattrs->bit_gravity = Symbol_To_Bit(value, Bit_Grav_Syms); Xattrs->bit_gravity = Symbol_To_Bit(value, Bit_Grav_Syms);
mask |= CWBitGravity; mask |= CWBitGravity;
} else if (cname == "gravity") { } else if (strcmp(cname, "gravity") == 0) {
Xattrs->win_gravity = Symbol_To_Bit(value, Grav_Syms); Xattrs->win_gravity = Symbol_To_Bit(value, Grav_Syms);
mask |= CWWinGravity; mask |= CWWinGravity;
} else if (cname == "backing-store") { } else if (strcmp(cname, "backing-store") == 0) {
Xattrs->backing_store = Symbol_To_Bit(value, Backing_Store_Syms); Xattrs->backing_store = Symbol_To_Bit(value, Backing_Store_Syms);
mask |= CWBackingStore; mask |= CWBackingStore;
} else if (cname == "backing-planes") { } else if (strcmp(cname, "backing-planes") == 0) {
Xattrs->backing_planes = s48_extract_integer(value); Xattrs->backing_planes = s48_extract_integer(value);
mask |= CWBackingPlanes; mask |= CWBackingPlanes;
} else if (cname == "backing-pixel") { } else if (strcmp(cname, "backing-pixel") == 0) {
Xattrs->backing_pixel = s48_extract_integer(value); Xattrs->backing_pixel = s48_extract_integer(value);
mask |= CWBackingPixel; mask |= CWBackingPixel;
} else if (cname == "save-under") { } else if (strcmp(cname, "save-under") == 0) {
Xattrs->save_under = !S48_FALSE_P(value); Xattrs->save_under = !S48_FALSE_P(value);
mask |= CWSaveUnder; mask |= CWSaveUnder;
} else if (cname == "event-mask") { } else if (strcmp(cname, "event-mask") == 0) {
Xattrs->event_mask = Symbols_To_Bits(value, Event_Syms); Xattrs->event_mask = Symbols_To_Bits(value, Event_Mask_Syms);
mask |= CWEventMask; mask |= CWEventMask;
} else if (cname == "do-not-propagate-mask") { } else if (strcmp(cname, "do-not-propagate-mask") == 0) {
Xattrs->do_not_propagate_mask = Symbols_To_Bits(value, Event_Syms); Xattrs->do_not_propagate_mask = Symbols_To_Bits(value, Event_Mask_Syms);
mask |= CWDontPropagate; mask |= CWDontPropagate;
} else if (cname == "override-redirect") { } else if (strcmp(cname, "override-redirect") == 0) {
Xattrs->override_redirect = !S48_FALSE_P(value); Xattrs->override_redirect = !S48_FALSE_P(value);
mask |= CWOverrideRedirect; mask |= CWOverrideRedirect;
} else if (cname == "colormap") { } else if (strcmp(cname, "colormap") == 0) {
Xattrs->colormap = s48_extract_integer(value); Xattrs->colormap = s48_extract_integer(value);
mask |= CWColormap; mask |= CWColormap;
} else if (cname == "cursor") { } else if (strcmp(cname, "cursor") == 0) {
Xattrs->cursor = s48_extract_integer(value); Xattrs->cursor = s48_extract_integer(value);
mask |= CWCursor; mask |= CWCursor;
} // else error } // else error ??
} /* for */ } /* for */
return mask; return mask;
} }
@ -66,9 +68,9 @@ unsigned long AList_To_XSetWindowAttributes(s48_value attrAlist,
int extract_background(s48_value value) { int extract_background(s48_value value) {
if (S48_SYMBOL_P(value)) { if (S48_SYMBOL_P(value)) {
char* v = s48_extract_string(S48_SYMBOL_TO_STRING(value)); char* v = s48_extract_string(S48_SYMBOL_TO_STRING(value));
if (v == "none") if (strcmp(v, "none") == 0)
return None; return None;
else if (v == "parent-relative") else if (strcmp(v, "parent-relative") == 0)
return ParentRelative; return ParentRelative;
//else // error ... //else // error ...
} }
@ -78,7 +80,7 @@ int extract_background(s48_value value) {
int extract_border(s48_value value) { int extract_border(s48_value value) {
if (S48_SYMBOL_P(value)) { if (S48_SYMBOL_P(value)) {
char* v = s48_extract_string(S48_SYMBOL_TO_STRING(value)); char* v = s48_extract_string(S48_SYMBOL_TO_STRING(value));
if (v == "copy-from-parent") if (strcmp(v, "copy-from-parent") == 0)
return CopyFromParent; return CopyFromParent;
// else error // else error
} else } else
@ -116,9 +118,7 @@ s48_value Change_Window_Attributes(s48_value Xwindow, s48_value Xdisplay,
s48_value attrAlist) { s48_value attrAlist) {
XSetWindowAttributes Xattrs; XSetWindowAttributes Xattrs;
unsigned long mask = 0; unsigned long mask = AList_To_XSetWindowAttributes( attrAlist, &Xattrs );
mask = AList_To_XSetWindowAttributes( attrAlist, &Xattrs );
XChangeWindowAttributes(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow), XChangeWindowAttributes(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow),
mask, &Xattrs); mask, &Xattrs);
@ -159,12 +159,15 @@ s48_value Get_Window_Attributes(s48_value Xdisplay, s48_value Xwindow) {
S48_VECTOR_SET(res, 15, ENTER_COLORMAP( WA.colormap )); S48_VECTOR_SET(res, 15, ENTER_COLORMAP( WA.colormap ));
S48_VECTOR_SET(res, 16, WA.map_installed ? S48_TRUE : S48_FALSE); S48_VECTOR_SET(res, 16, WA.map_installed ? S48_TRUE : S48_FALSE);
S48_VECTOR_SET(res, 17, Bit_To_Symbol( WA.map_state, Map_State_Syms)); S48_VECTOR_SET(res, 17, Bit_To_Symbol( WA.map_state, Map_State_Syms));
S48_VECTOR_SET(res, 18, ENTER_MASK( WA.all_event_masks )); //?? MASKS? S48_VECTOR_SET(res, 18, Bits_To_Symbols( WA.all_event_masks,
S48_VECTOR_SET(res, 19, ENTER_MASK( WA.your_event_mask )); Event_Mask_Syms ));
S48_VECTOR_SET(res, 20, ENTER_MASK( WA.do_not_propagate_mask )); S48_VECTOR_SET(res, 19, Bits_To_Symbols( WA.your_event_mask,
Event_Mask_Syms ));
S48_VECTOR_SET(res, 20, Bits_To_Symbols( WA.do_not_propagate_mask,
Event_Mask_Syms ));
S48_VECTOR_SET(res, 21, WA.override_redirect ? S48_TRUE : S48_FALSE); S48_VECTOR_SET(res, 21, WA.override_redirect ? S48_TRUE : S48_FALSE);
S48_VECTOR_SET(res, 22, s48_enter_integer((long)WA.screen)); //?? S48_VECTOR_SET(res, 22, s48_enter_integer((long)WA.screen)); //??
// WA.screen - ignored in Elk // WA.screen - ignored/not supported in Elk
} }
S48_GC_UNPROTECT(); S48_GC_UNPROTECT();
@ -186,25 +189,25 @@ s48_value Configure_Window (s48_value Xwindow, s48_value Xdisplay,
cname = s48_extract_string(S48_SYMBOL_TO_STRING(name)); cname = s48_extract_string(S48_SYMBOL_TO_STRING(name));
cvalue = (int)s48_extract_integer(value); // only ints here cvalue = (int)s48_extract_integer(value); // only ints here
if (cname == "x") { if (strcmp(cname, "x") == 0) {
WC.x = cvalue; WC.x = cvalue;
mask |= CWX; mask |= CWX;
} else if (cname == "y") { } else if (strcmp(cname, "y") == 0) {
WC.y = cvalue; WC.y = cvalue;
mask |= CWY; mask |= CWY;
} else if (cname == "width") { } else if (strcmp(cname, "width") == 0) {
WC.width = cvalue; WC.width = cvalue;
mask |= CWWidth; mask |= CWWidth;
} else if (cname == "height") { } else if (strcmp(cname, "height") == 0) {
WC.height = cvalue; WC.height = cvalue;
mask |= CWHeight; mask |= CWHeight;
} else if (cname == "border-width") { } else if (strcmp(cname, "border-width") == 0) {
WC.border_width = cvalue; WC.border_width = cvalue;
mask |= CWBorderWidth; mask |= CWBorderWidth;
} else if (cname == "sibling") { } else if (strcmp(cname, "sibling") == 0) {
WC.sibling = (Window)s48_extract_integer(value); WC.sibling = (Window)s48_extract_integer(value);
mask |= CWSibling; mask |= CWSibling;
} else if (cname == "stack-mode") { } else if (strcmp(cname, "stack-mode") == 0) {
WC.stack_mode = cvalue; WC.stack_mode = cvalue;
mask |= CWStackMode; mask |= CWStackMode;
} }
@ -247,23 +250,8 @@ s48_value Circulate_Subwindows(s48_value Xwindow, s48_value Xdisplay,
return S48_UNSPECIFIC; return S48_UNSPECIFIC;
} }
/* /*
Drawable Get_Drawable (d, dpyp) s48_value d; Display **dpyp; {
if (TYPE(d) == T_Window) {
*dpyp = WINDOW(d)->dpy;
return (Drawable)WINDOW(d)->win;
} else if (TYPE(d) == T_Pixmap) {
*dpyp = PIXMAP(d)->dpy;
return (Drawable)PIXMAP(d)->pm;
}
Wrong_Type_Combination (d, "drawable");
//NOTREACHED
}
static s48_value P_Get_Geometry (d) s48_value d; { static s48_value P_Get_Geometry (d) s48_value d; {
Display *dpy; Display *dpy;
Drawable dr = Get_Drawable (d, &dpy); Drawable dr = Get_Drawable (d, &dpy);