sync with OpenBSD -current
This commit is contained in:
parent
81739016d9
commit
48226b7c51
178 changed files with 76551 additions and 36405 deletions
|
@ -151,15 +151,17 @@ static Cardinal num_variable_list;
|
|||
Bool
|
||||
XawParseBoolean(Widget w, String param, XEvent *event, Bool *succeed)
|
||||
{
|
||||
char *tmp = (char *)param;
|
||||
int value;
|
||||
|
||||
if (!param)
|
||||
return (False);
|
||||
else
|
||||
{
|
||||
char *tmp = (char *)param;
|
||||
double dd = strtod(param, &tmp);
|
||||
int value = (int) dd;
|
||||
|
||||
value = (int)strtod(param, &tmp);
|
||||
if (*tmp == '\0')
|
||||
return (value);
|
||||
if (*tmp == '\0')
|
||||
return (value);
|
||||
}
|
||||
|
||||
if (XmuCompareISOLatin1(param, "true") == 0
|
||||
|| XmuCompareISOLatin1(param, "yes") == 0
|
||||
|
@ -188,7 +190,6 @@ Bool
|
|||
XawBooleanExpression(Widget w, String param, XEvent *event)
|
||||
{
|
||||
XawEvalInfo info;
|
||||
Bool retval;
|
||||
|
||||
if (!param)
|
||||
return (False);
|
||||
|
@ -215,16 +216,18 @@ XawBooleanExpression(Widget w, String param, XEvent *event)
|
|||
(void)get_token(&info);
|
||||
if (info.token == ERROR)
|
||||
return (False);
|
||||
retval = expr(&info);
|
||||
else
|
||||
{
|
||||
Bool retval = expr(&info);
|
||||
|
||||
return (info.token != ERROR ? retval : False);
|
||||
return (info.token != ERROR ? retval : False);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
get_token(XawEvalInfo *info)
|
||||
{
|
||||
int ch;
|
||||
char *p, name[256];
|
||||
|
||||
info->lp = info->cp;
|
||||
|
||||
|
@ -248,7 +251,8 @@ get_token(XawEvalInfo *info)
|
|||
{
|
||||
Bool succeed = True;
|
||||
|
||||
p = info->cp - 1;
|
||||
char *p = info->cp - 1;
|
||||
char name[256];
|
||||
|
||||
while ((ch = *info->cp) && (isalnum(ch) || ch == '_'))
|
||||
++info->cp;
|
||||
|
@ -409,6 +413,7 @@ XawSetValuesAction(Widget w, XEvent *event,
|
|||
#ifdef LONG64
|
||||
long c_8;
|
||||
#endif
|
||||
unsigned use_size;
|
||||
|
||||
if (!(*num_params & 1))
|
||||
{
|
||||
|
@ -440,13 +445,14 @@ XawSetValuesAction(Widget w, XEvent *event,
|
|||
from.size = (Cardinal) strlen(value) + 1;
|
||||
from.addr = (char *)value;
|
||||
to.size = resource->size;
|
||||
switch (to.size)
|
||||
use_size = resource->size;
|
||||
switch (use_size)
|
||||
{
|
||||
case 1: to.addr = (XPointer)&c_1; break;
|
||||
case 2: to.addr = (XPointer)&c_2; break;
|
||||
case 4: to.addr = (XPointer)&c_4; break;
|
||||
case 1: to.addr = (XPointer)&c_1; c_1 = 0; break;
|
||||
case 2: to.addr = (XPointer)&c_2; c_2 = 0; break;
|
||||
case 4: to.addr = (XPointer)&c_4; c_4 = 0; break;
|
||||
#ifdef LONG64
|
||||
case 8: to.addr = (XPointer)&c_8; break;
|
||||
case 8: to.addr = (XPointer)&c_8; c_8 = 0; break;
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
|
@ -466,10 +472,11 @@ XawSetValuesAction(Widget w, XEvent *event,
|
|||
c_4 = (int)from.addr;
|
||||
#endif
|
||||
else if (!XtConvertAndStore(w, XtRString, &from,
|
||||
XrmQuarkToString(resource->qtype), &to))
|
||||
XrmQuarkToString(resource->qtype), &to)
|
||||
|| to.size != use_size)
|
||||
continue;
|
||||
|
||||
switch (to.size)
|
||||
switch (use_size)
|
||||
{
|
||||
case 1:
|
||||
XtSetArg(arglist[num_args], XrmQuarkToString(resource->qname), c_1);
|
||||
|
@ -499,7 +506,6 @@ XawGetValuesAction(Widget w, XEvent *event,
|
|||
{
|
||||
XawActionResList *rlist;
|
||||
XawActionVarList *vlist;
|
||||
String value;
|
||||
Cardinal count;
|
||||
|
||||
if (!(*num_params & 1))
|
||||
|
@ -515,7 +521,8 @@ XawGetValuesAction(Widget w, XEvent *event,
|
|||
|
||||
for (count = 1; count < *num_params; count += 2)
|
||||
{
|
||||
if ((value = XawConvertActionRes(rlist, w, params[count + 1])) == NULL)
|
||||
String value = XawConvertActionRes(rlist, w, params[count + 1]);
|
||||
if (value == NULL)
|
||||
continue;
|
||||
XawDeclareActionVar(vlist, params[count], value);
|
||||
}
|
||||
|
@ -865,11 +872,9 @@ _XawFindActionRes(XawActionResList *list, Widget detail, String name)
|
|||
static char *
|
||||
_XawEscapeActionVarValue(String value)
|
||||
{
|
||||
char * escape;
|
||||
|
||||
if (value[0] == '$' || value[0] == '\\')
|
||||
{
|
||||
escape = XtMalloc((Cardinal)strlen(value) + 2);
|
||||
char *escape = XtMalloc((Cardinal)strlen(value) + 2);
|
||||
escape[0] = '\\';
|
||||
strcpy(escape + 1, value);
|
||||
return (escape);
|
||||
|
@ -881,11 +886,9 @@ _XawEscapeActionVarValue(String value)
|
|||
static char *
|
||||
_XawUnescapeActionVarValue(String value)
|
||||
{
|
||||
char * unescape;
|
||||
|
||||
if (value[0] == '\\')
|
||||
{
|
||||
unescape = XtMalloc((Cardinal)strlen(value));
|
||||
char *unescape = XtMalloc((Cardinal)strlen(value));
|
||||
strcpy(unescape, value + 1);
|
||||
return (unescape);
|
||||
}
|
||||
|
@ -918,7 +921,7 @@ XawDeclareActionVar(XawActionVarList *list, String name, String value)
|
|||
{
|
||||
String val = escape ? escape : value;
|
||||
|
||||
if (strcmp(XrmQuarkToString(variable->qvalue), val) == 0)
|
||||
if (val != NULL && strcmp(XrmQuarkToString(variable->qvalue), val) == 0)
|
||||
{
|
||||
if (escape)
|
||||
XtFree(escape);
|
||||
|
|
|
@ -60,7 +60,7 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include <X11/Xaw/Tree.h>
|
||||
#include <X11/Xaw/Viewport.h>
|
||||
|
||||
#define DATA(name,class) { (char *)name, class }
|
||||
#define DATA(name,class) { (char *)name, class, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
XmuWidgetNode XawWidgetArray[] = {
|
||||
DATA( "applicationShell", &applicationShellWidgetClass ),
|
||||
DATA( "asciiSink", &asciiSinkObjectClass ),
|
||||
|
|
|
@ -296,12 +296,13 @@ static int
|
|||
GetTextWidth(TextWidget ctx, int current_width, XFontStruct *font,
|
||||
XawTextPosition from, int length)
|
||||
{
|
||||
int i, width = 0;
|
||||
XawTextBlock block;
|
||||
XawTextPosition pos = from;
|
||||
int width = 0;
|
||||
|
||||
while (length > 0) {
|
||||
pos = XawTextSourceRead(ctx->text.source, from, &block, length);
|
||||
int i;
|
||||
XawTextBlock block;
|
||||
XawTextPosition pos = XawTextSourceRead(ctx->text.source, from, &block, length);
|
||||
|
||||
length = (int)(length - (pos - from));
|
||||
from = pos;
|
||||
for (i = 0; i < block.length; i++)
|
||||
|
@ -340,7 +341,6 @@ void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y,
|
|||
XawTextAnchor *anchor;
|
||||
XawTextEntity *entity;
|
||||
XawTextProperty *property;
|
||||
XawTextPaintStruct *paint;
|
||||
XawTextBlock block;
|
||||
XFontStruct *font;
|
||||
|
||||
|
@ -373,7 +373,7 @@ void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y,
|
|||
rbearing = font->per_char[c - font->min_char_or_byte2].rbearing -
|
||||
font->per_char[c - font->min_char_or_byte2].width;
|
||||
if (rbearing > 0) {
|
||||
paint = XtNew(XawTextPaintStruct);
|
||||
XawTextPaintStruct *paint = XtNew(XawTextPaintStruct);
|
||||
paint->next = sink->text_sink.paint->bearings;
|
||||
sink->text_sink.paint->bearings = paint;
|
||||
paint->x = x - (paint->width = CharWidth(sink, font, 0, c));
|
||||
|
@ -408,7 +408,7 @@ void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y,
|
|||
(c >= font->min_char_or_byte2 && c <= font->max_char_or_byte2))
|
||||
lbearing = font->per_char[c - font->min_char_or_byte2].lbearing;
|
||||
if (lbearing < 0) {
|
||||
paint = XtNew(XawTextPaintStruct);
|
||||
XawTextPaintStruct *paint = XtNew(XawTextPaintStruct);
|
||||
paint->next = sink->text_sink.paint->bearings;
|
||||
sink->text_sink.paint->bearings = paint;
|
||||
paint->x = x;
|
||||
|
@ -438,14 +438,13 @@ AsciiPreparePaint(Widget w, int y, int line,
|
|||
|
||||
TextWidget ctx = (TextWidget)XtParent(w);
|
||||
AsciiSinkObject sink = (AsciiSinkObject)ctx->text.sink;
|
||||
XawTextPosition left, right, pos, pos2, tmp, length;
|
||||
XawTextPosition left, right, pos, tmp, length;
|
||||
XawTextAnchor *anchor;
|
||||
XawTextEntity *entity;
|
||||
XawTextProperty *property;
|
||||
int i, ascent = 0, descent = 0, xl, xr, x = ctx->text.left_margin, bufsiz;
|
||||
int i, ascent = 0, descent = 0, xl, xr, x = ctx->text.left_margin;
|
||||
XawTextBlock block;
|
||||
XFontStruct *font;
|
||||
XawTextPaintStruct *paint;
|
||||
|
||||
if (!sink->ascii_sink.echo)
|
||||
return;
|
||||
|
@ -455,7 +454,7 @@ AsciiPreparePaint(Widget w, int y, int line,
|
|||
/* XXX the x coordinate can be a parameter, but since it is required
|
||||
to calculate the ascent/descent, do it here to avoid an extra
|
||||
search in the entities */
|
||||
pos = tmp = left = ctx->text.lt.info[line].position;
|
||||
pos = left = ctx->text.lt.info[line].position;
|
||||
right = ctx->text.lt.info[line + 1].position;
|
||||
right = XawMin(right, ctx->text.lastPos + 1);
|
||||
while (pos < right) {
|
||||
|
@ -530,7 +529,9 @@ AsciiPreparePaint(Widget w, int y, int line,
|
|||
/* pass 2: feed the XawTextPaintStruct lists */
|
||||
pos = from;
|
||||
while (pos < to) {
|
||||
paint = XtNew(XawTextPaintStruct);
|
||||
int bufsiz;
|
||||
XawTextPaintStruct *paint = XtNew(XawTextPaintStruct);
|
||||
|
||||
paint->next = sink->text_sink.paint->paint;
|
||||
sink->text_sink.paint->paint = paint;
|
||||
paint->x = x;
|
||||
|
@ -572,9 +573,8 @@ AsciiPreparePaint(Widget w, int y, int line,
|
|||
paint->length = 0;
|
||||
segment.x1 = x;
|
||||
|
||||
pos2 = tmp;
|
||||
while (length > 0) {
|
||||
pos2 = XawTextSourceRead(ctx->text.source, tmp, &block, (int)length);
|
||||
XawTextPosition pos2 = XawTextSourceRead(ctx->text.source, tmp, &block, (int)length);
|
||||
length = pos - pos2;
|
||||
tmp = pos2;
|
||||
for (i = 0; i < block.length; i++) {
|
||||
|
@ -736,9 +736,6 @@ AsciiDoPaint(Widget w)
|
|||
XmuScanline *scan;
|
||||
XmuSegment *seg;
|
||||
XawTextPaintList *list = sink->text_sink.paint;
|
||||
#if 0
|
||||
XawTextPaintStruct *base, *head;
|
||||
#endif
|
||||
XawTextPaintStruct *paint = list->paint;
|
||||
XawTextProperty *property;
|
||||
XFontStruct *font = NULL;
|
||||
|
@ -762,26 +759,6 @@ AsciiDoPaint(Widget w)
|
|||
(unsigned)(seg->x2 - seg->x1),
|
||||
(unsigned)(scan->next->y - scan->y));
|
||||
|
||||
/* pass 2: optimize drawing list to avoid too much GC change requests */
|
||||
/* XXX this assumes there will not exist entities drawn over other
|
||||
entities. */
|
||||
#if 0
|
||||
while (paint) {
|
||||
base = paint;
|
||||
head = paint->next;
|
||||
while (head) {
|
||||
if (head->property == paint->property) {
|
||||
base->next = head->next;
|
||||
head->next = paint->next;
|
||||
paint->next = head;
|
||||
paint = head;
|
||||
}
|
||||
base = head;
|
||||
head = head->next;
|
||||
}
|
||||
paint = paint->next;
|
||||
}
|
||||
#endif
|
||||
if (paint && paint->next) {
|
||||
XawTextPaintStruct **paints;
|
||||
int i = 0, n_paints = 0;
|
||||
|
@ -982,8 +959,6 @@ AsciiDoPaint(Widget w)
|
|||
/* dont care on order of drawing or caching of state (by now) */
|
||||
paint = list->bearings;
|
||||
while (paint) {
|
||||
XRectangle rect2;
|
||||
|
||||
if (paint->highlight)
|
||||
XSetForeground(XtDisplay(ctx), gc, sink->text_sink.background);
|
||||
if (!paint->property || !(paint->property->mask & XAW_TPROP_FONT))
|
||||
|
@ -999,10 +974,13 @@ AsciiDoPaint(Widget w)
|
|||
XSetForeground(XtDisplay(ctx), gc, paint->property->foreground);
|
||||
}
|
||||
if (paint->x < XtWidth(ctx) && paint->x + paint->width > 0) {
|
||||
rect2.x = (short)(paint->x + paint->width);
|
||||
rect2.width = (XawAbs(paint->width)); /* more than enough */
|
||||
rect2.y = (short)(paint->y - font->ascent);
|
||||
rect2.height = (unsigned short)(rect2.y + font->ascent + font->descent);
|
||||
XRectangle rect2 = {
|
||||
.x = (short)(paint->x + paint->width),
|
||||
.width = (unsigned short)(XawAbs(paint->width)), /* more than enough */
|
||||
.y = (short)(paint->y - font->ascent),
|
||||
.height = (unsigned short)((paint->y - font->ascent) +
|
||||
font->ascent + font->descent)
|
||||
};
|
||||
XSetClipRectangles(XtDisplay((Widget)ctx), gc,
|
||||
0, 0, &rect2, 1, Unsorted);
|
||||
XDrawString(XtDisplay(ctx), XtWindow(ctx), gc, paint->x, paint->y,
|
||||
|
@ -1387,7 +1365,7 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx,
|
|||
#ifndef OLDXAW
|
||||
AsciiSinkObject sink = (AsciiSinkObject)w;
|
||||
TextWidget ctx = (TextWidget)XtParent(w);
|
||||
XFontStruct *font = sink->ascii_sink.font;
|
||||
XFontStruct *font;
|
||||
Widget source = ctx->text.source;
|
||||
XawTextPosition idx, pos;
|
||||
unsigned char c;
|
||||
|
@ -1401,12 +1379,11 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx,
|
|||
|
||||
pos = idx = fromPos;
|
||||
rWidth = 0;
|
||||
c = 0;
|
||||
|
||||
while (!done) {
|
||||
if (XawTextSourceAnchorAndEntity(source, pos, &anchor, &entity)) {
|
||||
length = (Cardinal)(anchor->position + entity->offset + entity->length);
|
||||
length = (XawMin(toPos, length) - pos);
|
||||
length = (Cardinal)(XawMin(toPos, length) - pos);
|
||||
if ((property = XawTextSinkGetProperty((Widget)sink,
|
||||
entity->property)) != NULL &&
|
||||
(property->mask & XAW_TPROP_FONT))
|
||||
|
@ -1420,13 +1397,13 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx,
|
|||
entity = entity->next;
|
||||
if (entity) {
|
||||
length = (Cardinal)(anchor->position + entity->offset);
|
||||
length = (XawMin(toPos, length) - pos);
|
||||
length = (Cardinal)(XawMin(toPos, length) - pos);
|
||||
}
|
||||
else
|
||||
length = (XawMin(toPos - pos, 4096));
|
||||
length = (Cardinal)(XawMin(toPos - pos, 4096));
|
||||
}
|
||||
else
|
||||
length = (XawMin(toPos - pos, 4096));
|
||||
length = (Cardinal)(XawMin(toPos - pos, 4096));
|
||||
font = sink->ascii_sink.font;
|
||||
}
|
||||
|
||||
|
@ -1462,16 +1439,17 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx,
|
|||
XFontStruct *font = sink->ascii_sink.font;
|
||||
Widget source = ctx->text.source;
|
||||
XawTextPosition idx, pos;
|
||||
unsigned char c;
|
||||
XawTextBlock blk;
|
||||
int i, rWidth;
|
||||
|
||||
pos = XawTextSourceRead(source, fromPos, &blk, toPos - fromPos);
|
||||
pos = XawTextSourceRead(source, fromPos, &blk, (int)(toPos - fromPos));
|
||||
rWidth = 0;
|
||||
for (i = 0, idx = fromPos; idx < toPos; i++, idx++) {
|
||||
unsigned char c;
|
||||
|
||||
if (i >= blk.length) {
|
||||
i = 0;
|
||||
pos = XawTextSourceRead(source, pos, &blk, toPos - pos);
|
||||
pos = XawTextSourceRead(source, pos, &blk, (int)(toPos - pos));
|
||||
if (blk.length == 0)
|
||||
break;
|
||||
}
|
||||
|
@ -1498,7 +1476,7 @@ FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width,
|
|||
AsciiSinkObject sink = (AsciiSinkObject)w;
|
||||
TextWidget ctx = (TextWidget)XtParent(w);
|
||||
Widget source = ctx->text.source;
|
||||
XFontStruct *font = sink->ascii_sink.font;
|
||||
XFontStruct *font;
|
||||
XawTextPosition idx, pos, whiteSpacePosition = 0;
|
||||
int i, lastWidth, whiteSpaceWidth, rWidth, ascent = 0, descent = 0;
|
||||
Boolean whiteSpaceSeen;
|
||||
|
@ -1653,16 +1631,16 @@ GetGC(AsciiSinkObject sink)
|
|||
{
|
||||
XtGCMask valuemask = (GCFont | GCGraphicsExposures | GCClipXOrigin |
|
||||
GCForeground | GCBackground);
|
||||
XGCValues values;
|
||||
XGCValues values = {
|
||||
/* XXX We dont want to share a gc that will change the clip-mask */
|
||||
.clip_x_origin = (int)(long)sink,
|
||||
.clip_mask = None,
|
||||
.font = sink->ascii_sink.font->fid,
|
||||
.graphics_exposures = False,
|
||||
|
||||
/* XXX We dont want do share a gc that will change the clip-mask */
|
||||
values.clip_x_origin = (int)(long)sink;
|
||||
values.clip_mask = None;
|
||||
values.font = sink->ascii_sink.font->fid;
|
||||
values.graphics_exposures = False;
|
||||
|
||||
values.foreground = sink->text_sink.foreground;
|
||||
values.background = sink->text_sink.background;
|
||||
.foreground = sink->text_sink.foreground,
|
||||
.background = sink->text_sink.background
|
||||
};
|
||||
sink->ascii_sink.normgc = XtAllocateGC((Widget)sink, 0, valuemask, &values,
|
||||
GCClipMask | GCFont | GCForeground |
|
||||
GCBackground, 0);
|
||||
|
|
|
@ -55,6 +55,10 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
#define O_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
#if (defined(ASCII_STRING) || defined(ASCII_DISK))
|
||||
#include <X11/Xaw/AsciiText.h> /* for Widget Classes */
|
||||
#endif
|
||||
|
@ -240,6 +244,9 @@ AsciiSrcClassRec asciiSrcClassRec = {
|
|||
Search, /* Search */
|
||||
XtInheritSetSelection, /* SetSelection */
|
||||
XtInheritConvertSelection, /* ConvertSelection */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* ascii_src */
|
||||
{
|
||||
|
@ -389,7 +396,7 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
|
|||
text->format = XawFmt8Bit;
|
||||
if (length == 0) {
|
||||
text->firstPos = (int)(end = (offset + entity->length));
|
||||
text->ptr = "";
|
||||
text->ptr = (char*)"";
|
||||
}
|
||||
else {
|
||||
text->firstPos = (int)pos;
|
||||
|
@ -411,7 +418,7 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
|
|||
text->firstPos = (int)pos;
|
||||
text->ptr = piece->text + (pos - start);
|
||||
count = piece->used - (pos - start);
|
||||
text->length = (Max(0, (length > count) ? count : length));
|
||||
text->length = (int)(Max(0, (length > count) ? count : length));
|
||||
text->format = XawFmt8Bit;
|
||||
|
||||
return (pos + text->length);
|
||||
|
@ -449,8 +456,10 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos,
|
|||
if (src->text_src.edit_mode == XawtextRead)
|
||||
return (XawEditError);
|
||||
|
||||
start_piece = FindPiece(src, startPos, &start_first);
|
||||
end_piece = FindPiece(src, endPos, &end_first);
|
||||
if ((start_piece = FindPiece(src, startPos, &start_first)) == NULL)
|
||||
return XawEditError;
|
||||
if ((end_piece = FindPiece(src, endPos, &end_first)) == NULL)
|
||||
return XawEditError;
|
||||
|
||||
#ifndef OLDXAW
|
||||
/*
|
||||
|
@ -461,7 +470,7 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos,
|
|||
if (start_piece->used) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < src->text_src.num_text; i++) {
|
||||
for (i = 0; i < (int)src->text_src.num_text; i++) {
|
||||
int line;
|
||||
TextWidget ctx = (TextWidget)src->text_src.text[i];
|
||||
|
||||
|
@ -514,7 +523,8 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos,
|
|||
* Remove Old Stuff
|
||||
*/
|
||||
if (start_piece != end_piece) {
|
||||
temp_piece = start_piece->next;
|
||||
if ((temp_piece = start_piece->next) == NULL)
|
||||
return XawEditError;
|
||||
|
||||
/*
|
||||
* If empty and not the only piece then remove it.
|
||||
|
@ -973,8 +983,7 @@ XawAsciiSrcSetValues(Widget current, Widget request _X_UNUSED, Widget cnew,
|
|||
AsciiSrcObject src = (AsciiSrcObject)cnew;
|
||||
AsciiSrcObject old_src = (AsciiSrcObject)current;
|
||||
Bool total_reset = False, string_set = False;
|
||||
FILE *file;
|
||||
unsigned int i;
|
||||
Cardinal i;
|
||||
|
||||
if (old_src->ascii_src.use_string_in_place
|
||||
!= src->ascii_src.use_string_in_place) {
|
||||
|
@ -992,6 +1001,8 @@ XawAsciiSrcSetValues(Widget current, Widget request _X_UNUSED, Widget cnew,
|
|||
}
|
||||
|
||||
if (string_set || (old_src->ascii_src.type != src->ascii_src.type)) {
|
||||
FILE *file;
|
||||
|
||||
RemoveOldStringOrFile(old_src, string_set); /* remove old info */
|
||||
file = InitStringOrFile(src, string_set); /* Init new info */
|
||||
LoadPieces(src, file, NULL); /* load new info into internal buffers */
|
||||
|
@ -1039,7 +1050,7 @@ static void
|
|||
XawAsciiSrcGetValuesHook(Widget w, ArgList args, Cardinal *num_args)
|
||||
{
|
||||
AsciiSrcObject src = (AsciiSrcObject)w;
|
||||
unsigned int i;
|
||||
Cardinal i;
|
||||
|
||||
if (src->ascii_src.type == XawAsciiString) {
|
||||
for (i = 0; i < *num_args ; i++)
|
||||
|
@ -1280,7 +1291,7 @@ WriteToFile(String string, String name, unsigned length)
|
|||
{
|
||||
int fd;
|
||||
|
||||
if ((fd = creat(name, 0666)) == -1)
|
||||
if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666)) == -1)
|
||||
return (False);
|
||||
|
||||
if (write(fd, string, length) == -1) {
|
||||
|
@ -1317,14 +1328,13 @@ WritePiecesToFile(AsciiSrcObject src, String name)
|
|||
int fd;
|
||||
|
||||
if (src->ascii_src.data_compression) {
|
||||
Piece *tmp;
|
||||
|
||||
piece = src->ascii_src.first_piece;
|
||||
while (piece) {
|
||||
int bytes = (int)(src->ascii_src.piece_size - piece->used);
|
||||
Piece *tmp;
|
||||
|
||||
if (bytes > 0 && (tmp = piece->next) != NULL) {
|
||||
bytes = (XawMin(bytes, tmp->used));
|
||||
bytes = (int)(XawMin(bytes, tmp->used));
|
||||
memcpy(piece->text + piece->used, tmp->text, (size_t)bytes);
|
||||
memmove(tmp->text, tmp->text + bytes, (size_t)(tmp->used - bytes));
|
||||
piece->used += bytes;
|
||||
|
@ -1337,7 +1347,7 @@ WritePiecesToFile(AsciiSrcObject src, String name)
|
|||
}
|
||||
}
|
||||
|
||||
if ((fd = creat(name, 0666)) == -1)
|
||||
if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666)) == -1)
|
||||
return (False);
|
||||
|
||||
for (piece = src->ascii_src.first_piece; piece; piece = piece->next)
|
||||
|
@ -1403,8 +1413,6 @@ InitStringOrFile(AsciiSrcObject src, Bool newString)
|
|||
{
|
||||
mode_t open_mode = 0;
|
||||
const char *fdopen_mode = NULL;
|
||||
int fd;
|
||||
FILE *file;
|
||||
|
||||
if (src->ascii_src.type == XawAsciiString) {
|
||||
if (src->ascii_src.string == NULL)
|
||||
|
@ -1443,19 +1451,19 @@ InitStringOrFile(AsciiSrcObject src, Bool newString)
|
|||
XtErrorMsg("NoFile", "asciiSourceCreate", "XawError",
|
||||
"Creating a read only disk widget and no file specified.",
|
||||
NULL, NULL);
|
||||
open_mode = O_RDONLY;
|
||||
open_mode = O_RDONLY | O_CLOEXEC;
|
||||
fdopen_mode = "r";
|
||||
break;
|
||||
case XawtextAppend:
|
||||
case XawtextEdit:
|
||||
if (src->ascii_src.string == NULL) {
|
||||
src->ascii_src.string = "*ascii-src*";
|
||||
src->ascii_src.string = (char*)"*ascii-src*";
|
||||
src->ascii_src.is_tempfile = True;
|
||||
}
|
||||
else {
|
||||
/* O_NOFOLLOW is a FreeBSD & Linux extension */
|
||||
/* O_NOFOLLOW was a FreeBSD & Linux extension, now adopted by POSIX */
|
||||
#ifdef O_NOFOLLOW
|
||||
open_mode = O_RDWR | O_NOFOLLOW;
|
||||
open_mode = O_RDWR | O_NOFOLLOW | O_CLOEXEC;
|
||||
#else
|
||||
open_mode = O_RDWR; /* unsafe; subject to race conditions */
|
||||
#endif /* O_NOFOLLOW */
|
||||
|
@ -1477,8 +1485,12 @@ InitStringOrFile(AsciiSrcObject src, Bool newString)
|
|||
}
|
||||
|
||||
if (!src->ascii_src.is_tempfile) {
|
||||
if ((fd = open(src->ascii_src.string, (int)open_mode, 0666)) != -1) {
|
||||
if ((file = fdopen(fd, fdopen_mode))) {
|
||||
int fd = open(src->ascii_src.string, (int)open_mode, 0666);
|
||||
|
||||
if (fd != -1) {
|
||||
FILE *file = fdopen(fd, fdopen_mode);
|
||||
|
||||
if (file != NULL) {
|
||||
(void)fseek(file, 0, SEEK_END);
|
||||
src->ascii_src.length = (XawTextPosition)ftell(file);
|
||||
return (file);
|
||||
|
@ -1511,11 +1523,11 @@ LoadPieces(AsciiSrcObject src, FILE *file, char *string)
|
|||
if (string == NULL) {
|
||||
if (src->ascii_src.type == XawAsciiFile) {
|
||||
if (src->ascii_src.length != 0) {
|
||||
int len;
|
||||
|
||||
left = 0;
|
||||
fseek(file, 0, SEEK_SET);
|
||||
while (left < src->ascii_src.length) {
|
||||
int len;
|
||||
|
||||
ptr = XtMalloc((unsigned)src->ascii_src.piece_size);
|
||||
if ((len = (int)fread(ptr, sizeof(unsigned char),
|
||||
(size_t)src->ascii_src.piece_size, file)) < 0)
|
||||
|
|
|
@ -123,10 +123,15 @@ AsciiTextClassRec asciiTextClassRec = {
|
|||
NULL, /* callback_private */
|
||||
XtInheritTranslations, /* tm_table */
|
||||
XtInheritQueryGeometry, /* query_geometry */
|
||||
NULL, /* display_accelerator */
|
||||
NULL, /* extension */
|
||||
},
|
||||
/* simple */
|
||||
{
|
||||
XtInheritChangeSensitive, /* change_sensitive */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* text */
|
||||
{
|
||||
|
|
|
@ -208,7 +208,6 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height,
|
|||
Dimension lw, lh; /* Width and height needed for current line */
|
||||
Dimension bw, bh; /* Width and height needed for current widget */
|
||||
Dimension h_space; /* Local copy of bbw->box.h_space */
|
||||
Widget widget; /* Current widget */
|
||||
unsigned int num_mapped_children = 0;
|
||||
|
||||
/* Box width and height */
|
||||
|
@ -230,7 +229,7 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height,
|
|||
lw = h_space;
|
||||
|
||||
for (i = 0; i < bbw->composite.num_children; i++) {
|
||||
widget = bbw->composite.children[i];
|
||||
Widget widget = bbw->composite.children[i]; /* Current widget */
|
||||
if (widget->core.managed) {
|
||||
if (widget->core.mapped_when_managed)
|
||||
num_mapped_children++;
|
||||
|
@ -498,10 +497,12 @@ TryNewLayout(BoxWidget bbw)
|
|||
proposed_height = preferred_height;
|
||||
}
|
||||
else { /* proposed_height != preferred_height */
|
||||
XtWidgetGeometry constraints, reply;
|
||||
XtWidgetGeometry constraints = {
|
||||
.request_mode = CWHeight,
|
||||
.height = proposed_height
|
||||
};
|
||||
XtWidgetGeometry reply;
|
||||
|
||||
constraints.request_mode = CWHeight;
|
||||
constraints.height = proposed_height;
|
||||
(void)XawBoxQueryGeometry((Widget)bbw, &constraints, &reply);
|
||||
proposed_width = preferred_width;
|
||||
}
|
||||
|
@ -525,9 +526,6 @@ static XtGeometryResult
|
|||
XawBoxGeometryManager(Widget w, XtWidgetGeometry *request,
|
||||
XtWidgetGeometry *reply _X_UNUSED)
|
||||
{
|
||||
Dimension width, height, borderWidth;
|
||||
BoxWidget bbw;
|
||||
|
||||
/* Position request always denied */
|
||||
if (((request->request_mode & CWX) && request->x != XtX(w))
|
||||
|| ((request->request_mode & CWY) && request->y != XtY(w)))
|
||||
|
@ -535,6 +533,9 @@ XawBoxGeometryManager(Widget w, XtWidgetGeometry *request,
|
|||
|
||||
/* Size changes must see if the new size can be accommodated */
|
||||
if (request->request_mode & (CWWidth | CWHeight | CWBorderWidth)) {
|
||||
Dimension width, height, borderWidth;
|
||||
BoxWidget bbw;
|
||||
|
||||
/* Make all three fields in the request valid */
|
||||
if ((request->request_mode & CWWidth) == 0)
|
||||
request->width = XtWidth(w);
|
||||
|
@ -544,12 +545,12 @@ XawBoxGeometryManager(Widget w, XtWidgetGeometry *request,
|
|||
request->border_width = XtBorderWidth(w);
|
||||
|
||||
/* Save current size and set to new size */
|
||||
width = XtWidth(w);
|
||||
height = XtHeight(w);
|
||||
borderWidth = XtBorderWidth(w);
|
||||
XtWidth(w) = request->width;
|
||||
XtHeight(w) = request->height;
|
||||
XtBorderWidth(w) = request->border_width;
|
||||
width = XtWidth(w);
|
||||
height = XtHeight(w);
|
||||
borderWidth = XtBorderWidth(w);
|
||||
XtWidth(w) = request->width;
|
||||
XtHeight(w) = request->height;
|
||||
XtBorderWidth(w) = request->border_width;
|
||||
|
||||
/* Decide if new layout works:
|
||||
(1) new widget is smaller,
|
||||
|
|
|
@ -200,6 +200,9 @@ CommandClassRec commandClassRec = {
|
|||
/* simple */
|
||||
{
|
||||
ChangeSensitive, /* change_sensitive */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* label */
|
||||
{
|
||||
|
@ -219,17 +222,16 @@ WidgetClass commandWidgetClass = (WidgetClass)&commandClassRec;
|
|||
static GC
|
||||
Get_GC(CommandWidget cbw, Pixel fg, Pixel bg)
|
||||
{
|
||||
XGCValues values;
|
||||
|
||||
values.foreground = fg;
|
||||
values.background = bg;
|
||||
values.font = cbw->label.font->fid;
|
||||
values.cap_style = CapProjecting;
|
||||
XGCValues values = {
|
||||
.foreground = fg,
|
||||
.background = bg,
|
||||
.font = cbw->label.font->fid,
|
||||
.cap_style = CapProjecting,
|
||||
.line_width = 0
|
||||
};
|
||||
|
||||
if (cbw->command.highlight_thickness > 1)
|
||||
values.line_width = cbw->command.highlight_thickness;
|
||||
else
|
||||
values.line_width = 0;
|
||||
|
||||
if (cbw->simple.international == True)
|
||||
return (XtAllocateGC((Widget)cbw, 0,
|
||||
|
@ -296,8 +298,8 @@ HighlightRegion(CommandWidget cbw)
|
|||
rect.height = XtHeight(cbw);
|
||||
XUnionRectWithRegion(&rect, emptyRegion, outerRegion);
|
||||
rect.x = rect.y = (short)cbw->command.highlight_thickness;
|
||||
rect.width = (rect.width - cbw->command.highlight_thickness * 2);
|
||||
rect.height = (rect.height - cbw->command.highlight_thickness * 2);
|
||||
rect.width = (unsigned short)(rect.width - cbw->command.highlight_thickness * 2);
|
||||
rect.height = (unsigned short)(rect.height - cbw->command.highlight_thickness * 2);
|
||||
XUnionRectWithRegion(&rect, emptyRegion, innerRegion);
|
||||
XSubtractRegion(outerRegion, innerRegion, outerRegion);
|
||||
|
||||
|
@ -563,7 +565,7 @@ static void
|
|||
XawCommandGetValuesHook(Widget w, ArgList args, Cardinal *num_args)
|
||||
{
|
||||
CommandWidget cbw = (CommandWidget)w;
|
||||
unsigned int i;
|
||||
Cardinal i;
|
||||
|
||||
for (i = 0; i < *num_args; i++) {
|
||||
if (STR_EQUAL(args[i].name, XtNforeground))
|
||||
|
|
|
@ -174,6 +174,9 @@ DialogClassRec dialogClassRec = {
|
|||
/* form */
|
||||
{
|
||||
XtInheritLayout, /* layout */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* dialog */
|
||||
{
|
||||
|
@ -271,7 +274,6 @@ XawDialogSetValues(Widget current, Widget request _X_UNUSED, Widget cnew,
|
|||
DialogWidget w = (DialogWidget)cnew;
|
||||
DialogWidget old = (DialogWidget)current;
|
||||
Arg args[5];
|
||||
Cardinal num_args;
|
||||
unsigned int i;
|
||||
Bool checks[NUM_CHECKS];
|
||||
|
||||
|
@ -310,7 +312,8 @@ XawDialogSetValues(Widget current, Widget request _X_UNUSED, Widget cnew,
|
|||
}
|
||||
|
||||
if (checks[LABEL]) {
|
||||
num_args = 0;
|
||||
Cardinal num_args = 0;
|
||||
|
||||
XtSetArg(args[num_args], XtNlabel, w->dialog.label); num_args++;
|
||||
if (w->dialog.iconW != NULL &&
|
||||
XtHeight(w->dialog.labelW) <= XtHeight(w->dialog.iconW)) {
|
||||
|
@ -359,9 +362,9 @@ XawDialogGetValuesHook(Widget w, ArgList args, Cardinal *num_args)
|
|||
Arg a[1];
|
||||
char * s;
|
||||
DialogWidget src = (DialogWidget)w;
|
||||
unsigned int i;
|
||||
Cardinal i;
|
||||
|
||||
for (i = 0; i < *num_args; i++)
|
||||
for (i = 0; i < *num_args; i++) {
|
||||
if (streq(args[i].name, XtNvalue)) {
|
||||
XtSetArg(a[0], XtNstring, &s);
|
||||
XtGetValues(src->dialog.valueW, a, 1);
|
||||
|
@ -372,6 +375,7 @@ XawDialogGetValuesHook(Widget w, ArgList args, Cardinal *num_args)
|
|||
XtGetValues(src->dialog.labelW, a, 1);
|
||||
*((char **)args[i].value) = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -122,7 +122,6 @@ void
|
|||
XawRunDisplayList(Widget w, _XawDisplayList *list,
|
||||
XEvent *event, Region region)
|
||||
{
|
||||
XawDLProc *proc;
|
||||
Cardinal i;
|
||||
|
||||
if (!XtIsRealized(w))
|
||||
|
@ -130,7 +129,7 @@ XawRunDisplayList(Widget w, _XawDisplayList *list,
|
|||
|
||||
for (i = 0; i < list->num_procs; i++)
|
||||
{
|
||||
proc = list->procs[i];
|
||||
XawDLProc *proc = list->procs[i];
|
||||
proc->proc(w, proc->args, proc->data->data, event, region);
|
||||
}
|
||||
}
|
||||
|
@ -236,8 +235,6 @@ _XawDisplayList *XawCreateDisplayList(String string, Screen *screen,
|
|||
char cname[64], fname[64], aname[1024];
|
||||
Cardinal i;
|
||||
String cp;
|
||||
String fp;
|
||||
String lp;
|
||||
int status;
|
||||
|
||||
xlibc = XawGetDisplayListClass(xlib);
|
||||
|
@ -264,6 +261,8 @@ _XawDisplayList *XawCreateDisplayList(String string, Screen *screen,
|
|||
status = 0;
|
||||
while (status != DLEOF)
|
||||
{
|
||||
String fp, lp;
|
||||
|
||||
lp = cp;
|
||||
cp = read_token(cp, fname, sizeof(fname), &status);
|
||||
|
||||
|
@ -449,16 +448,14 @@ void
|
|||
XawDestroyDisplayList(_XawDisplayList *dlist)
|
||||
{
|
||||
Cardinal i, j;
|
||||
XawDLProc *proc;
|
||||
XawDLData *data;
|
||||
|
||||
if (!dlist)
|
||||
return;
|
||||
|
||||
for (i = 0; i < dlist->num_procs; i++)
|
||||
{
|
||||
proc = dlist->procs[i];
|
||||
data = proc->data;
|
||||
XawDLProc *proc = dlist->procs[i];
|
||||
XawDLData *data = proc->data;
|
||||
|
||||
if (data)
|
||||
{
|
||||
|
@ -707,7 +704,6 @@ DlXPoints(Widget w, XtPointer args, XtPointer data, int id)
|
|||
{
|
||||
XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args;
|
||||
XawXlibData *xdata = (XawXlibData *)data;
|
||||
XawDLPosition *pos;
|
||||
XPoint points_buf[16];
|
||||
XPoint *points;
|
||||
Display *display;
|
||||
|
@ -719,7 +715,7 @@ DlXPoints(Widget w, XtPointer args, XtPointer data, int id)
|
|||
|
||||
for (i = j = 0; i < num_points; i++, j = i << 1)
|
||||
{
|
||||
pos = &pos_ptr->pos[j];
|
||||
XawDLPosition *pos = &pos_ptr->pos[j];
|
||||
points[i].x = X_ARG(pos[0]);
|
||||
points[i].y = Y_ARG(pos[1]);
|
||||
}
|
||||
|
@ -738,7 +734,7 @@ DlXPoints(Widget w, XtPointer args, XtPointer data, int id)
|
|||
points[i].y = (short)(points[i].y + ypad);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (num_points != 0)
|
||||
{
|
||||
points[0].x = (short)(points[0].x + xpad);
|
||||
points[0].y = (short)(points[0].y + ypad);
|
||||
|
@ -888,12 +884,14 @@ DlMask(Widget w, XtPointer args _X_UNUSED, XtPointer data,
|
|||
XSetRegion(display, xdata->gc, region);
|
||||
else if (event)
|
||||
{
|
||||
XRectangle rect;
|
||||
XRectangle rect =
|
||||
{
|
||||
.x = (short)event->xexpose.x,
|
||||
.y = (short)event->xexpose.y,
|
||||
.width = (unsigned short)event->xexpose.width,
|
||||
.height = (unsigned short)event->xexpose.height
|
||||
};
|
||||
|
||||
rect.x = (short)event->xexpose.x;
|
||||
rect.y = (short)event->xexpose.y;
|
||||
rect.width = (unsigned short)event->xexpose.width;
|
||||
rect.height = (unsigned short)event->xexpose.height;
|
||||
XSetClipRectangles(display, xdata->gc, 0, 0, &rect, 1, Unsorted);
|
||||
}
|
||||
}
|
||||
|
@ -916,7 +914,7 @@ DlLineWidth(Widget w, XtPointer args, XtPointer data,
|
|||
XawXlibData *xdata = (XawXlibData *)data;
|
||||
unsigned line_width = (unsigned)(unsigned long)args;
|
||||
|
||||
if (xdata->values.line_width != line_width)
|
||||
if ((unsigned)xdata->values.line_width != line_width)
|
||||
{
|
||||
xdata->mask |= GCLineWidth;
|
||||
xdata->values.line_width = (int)line_width;
|
||||
|
@ -938,7 +936,6 @@ DlDrawSegments(Widget w, XtPointer args, XtPointer data,
|
|||
{
|
||||
XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args;
|
||||
XawXlibData *xdata = (XawXlibData *)data;
|
||||
XawDLPosition *pos;
|
||||
XSegment *segments;
|
||||
XSegment segments_buf[8];
|
||||
Display *display;
|
||||
|
@ -950,7 +947,7 @@ DlDrawSegments(Widget w, XtPointer args, XtPointer data,
|
|||
|
||||
for (i = j = 0; i < num_segments; i++, j = i << 2)
|
||||
{
|
||||
pos = &pos_ptr->pos[j];
|
||||
XawDLPosition *pos = &pos_ptr->pos[j];
|
||||
segments[i].x1 = X_ARG(pos[0]);
|
||||
segments[i].y1 = Y_ARG(pos[1]);
|
||||
segments[i].x2 = X_ARG(pos[2]);
|
||||
|
@ -1323,10 +1320,8 @@ DlClipRectangles(Widget w, XtPointer args, XtPointer data,
|
|||
{
|
||||
XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args;
|
||||
XawXlibData *xdata = (XawXlibData *)data;
|
||||
XawDLPosition *pos;
|
||||
XRectangle *rects;
|
||||
XRectangle rects_buf[8];
|
||||
Position x1, y1, x2, y2;
|
||||
Cardinal num_rects, i, j;
|
||||
|
||||
num_rects = pos_ptr->num_pos>>2;
|
||||
|
@ -1334,11 +1329,11 @@ DlClipRectangles(Widget w, XtPointer args, XtPointer data,
|
|||
|
||||
for (i = j = 0; i < num_rects; i++, j = i << 2)
|
||||
{
|
||||
pos = &pos_ptr->pos[j];
|
||||
x1 = X_ARG(pos[0]);
|
||||
y1 = Y_ARG(pos[1]);
|
||||
x2 = X_ARG(pos[2]);
|
||||
y2 = Y_ARG(pos[3]);
|
||||
XawDLPosition *pos = &pos_ptr->pos[j];
|
||||
Position x1 = X_ARG(pos[0]);
|
||||
Position y1 = Y_ARG(pos[1]);
|
||||
Position x2 = X_ARG(pos[2]);
|
||||
Position y2 = Y_ARG(pos[3]);
|
||||
rects[i].x = XawMin(x1, x2);
|
||||
rects[i].y = XawMin(y1, y2);
|
||||
rects[i].width = (unsigned short)(XawMax(x1, x2) - rects[i].x);
|
||||
|
@ -1751,7 +1746,10 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params,
|
|||
break;
|
||||
case LWIDTH:
|
||||
if (*num_params == 1)
|
||||
retval = (void *)read_int((char *)params[0], NULL);
|
||||
{
|
||||
long x = read_int((char *)params[0], NULL);
|
||||
retval = (void *)x;
|
||||
}
|
||||
break;
|
||||
case ARCMODE:
|
||||
if (*num_params == 1)
|
||||
|
@ -1896,7 +1894,10 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params,
|
|||
break;
|
||||
case PLANEMASK:
|
||||
if (*num_params == 1)
|
||||
retval = (void *)read_int((char *)params[0], NULL);
|
||||
{
|
||||
long x = read_int((char *)params[0], NULL);
|
||||
retval = (void *)x;
|
||||
}
|
||||
break;
|
||||
case DSTRING:
|
||||
case PSTRING:
|
||||
|
@ -1914,7 +1915,10 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params,
|
|||
break;
|
||||
case FONT:
|
||||
if (*num_params == 1)
|
||||
retval = (void *)XLoadFont(DisplayOfScreen(screen), params[0]);
|
||||
{
|
||||
Font x = XLoadFont(DisplayOfScreen(screen), params[0]);
|
||||
retval = (void *)x;
|
||||
}
|
||||
break;
|
||||
case DASHES:
|
||||
if (*num_params && *num_params < 127)
|
||||
|
@ -1942,7 +1946,10 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params,
|
|||
if (*num_params == 1)
|
||||
{
|
||||
if (isdigit((unsigned char)params[0][0]) || params[0][0] == '+' || params[0][0] == '-')
|
||||
retval = (void *)read_int((char *)params[0], NULL);
|
||||
{
|
||||
long x = read_int((char *)params[0], NULL);
|
||||
retval = (void *)x;
|
||||
}
|
||||
else if (XmuCompareISOLatin1(params[0], "true") == 0 ||
|
||||
XmuCompareISOLatin1(params[0], "on") == 0)
|
||||
retval = (void *)True;
|
||||
|
@ -2125,7 +2132,7 @@ Bool XawDeclareDisplayListProc(XawDLClass *lc, String name,
|
|||
if (!lc || !proc || !name || name[0] == '\0')
|
||||
return (False);
|
||||
|
||||
if ((info = _XawFindDLInfo(lc, name)) != NULL)
|
||||
if (_XawFindDLInfo(lc, name) != NULL)
|
||||
/* Since the data structures to the displayList classes are(should be)
|
||||
* opaque, it is not a good idea to allow overriding a displayList
|
||||
* procedure; it's better to choose another name or class name!
|
||||
|
|
|
@ -301,13 +301,12 @@ WidgetClass formWidgetClass = (WidgetClass)&formClassRec;
|
|||
static void
|
||||
XawFormRealize(Widget w, Mask *mask, XSetWindowAttributes *attr)
|
||||
{
|
||||
XawPixmap *pixmap;
|
||||
|
||||
(*formWidgetClass->core_class.superclass->core_class.realize)(w, mask, attr);
|
||||
|
||||
if (w->core.background_pixmap > XtUnspecifiedPixmap) {
|
||||
pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w),
|
||||
w->core.colormap, (int)w->core.depth);
|
||||
XawPixmap *pixmap =
|
||||
XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w),
|
||||
w->core.colormap, (int)w->core.depth);
|
||||
if (pixmap && pixmap->mask)
|
||||
XawReshapeWidget(w, pixmap);
|
||||
}
|
||||
|
@ -781,8 +780,8 @@ XawFormResize(Widget w)
|
|||
fw->form.old_height, XtHeight(fw),
|
||||
form->form.bottom) -
|
||||
(y + (XtBorderWidth(*childP) << 1));
|
||||
form->form.virtual_width = width;
|
||||
form->form.virtual_height = height;
|
||||
form->form.virtual_width = (short)width;
|
||||
form->form.virtual_height = (short)height;
|
||||
#endif
|
||||
|
||||
width = width < 1 ? 1 : width;
|
||||
|
@ -1022,10 +1021,8 @@ static void
|
|||
XawFormChangeManaged(Widget w)
|
||||
{
|
||||
FormWidget fw = (FormWidget)w;
|
||||
FormConstraints form;
|
||||
WidgetList children, childP;
|
||||
int num_children = (int)fw->composite.num_children;
|
||||
Widget child;
|
||||
|
||||
(*((FormWidgetClass)w->core.widget_class)->form_class.layout)
|
||||
(fw, XtWidth(w), XtHeight(w), True);
|
||||
|
@ -1035,7 +1032,8 @@ XawFormChangeManaged(Widget w)
|
|||
for (children = childP = fw->composite.children;
|
||||
childP - children < num_children;
|
||||
childP++) {
|
||||
child = *childP;
|
||||
FormConstraints form;
|
||||
Widget child = *childP;
|
||||
if (!XtIsManaged(child))
|
||||
continue;
|
||||
form = (FormConstraints)child->core.constraints;
|
||||
|
|
|
@ -160,6 +160,9 @@ GripClassRec gripClassRec = {
|
|||
/* simple */
|
||||
{
|
||||
XtInheritChangeSensitive, /* change_sensitive */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* grip */
|
||||
{
|
||||
|
@ -175,11 +178,11 @@ WidgetClass gripWidgetClass = (WidgetClass)&gripClassRec;
|
|||
static void
|
||||
GripAction(Widget widget, XEvent *event, String *params, Cardinal *num_params)
|
||||
{
|
||||
XawGripCallDataRec call_data;
|
||||
|
||||
call_data.event = event;
|
||||
call_data.params = params;
|
||||
call_data.num_params = *num_params;
|
||||
XawGripCallDataRec call_data = {
|
||||
.event = event,
|
||||
.params = params,
|
||||
.num_params = *num_params
|
||||
};
|
||||
|
||||
XtCallCallbacks(widget, XtNcallback, (XtPointer)&call_data);
|
||||
}
|
||||
|
|
|
@ -253,6 +253,9 @@ LabelClassRec labelClassRec = {
|
|||
/* simple */
|
||||
{
|
||||
XtInheritChangeSensitive, /* change_sensitive */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* label */
|
||||
{
|
||||
|
@ -355,10 +358,10 @@ SetTextWidthAndHeight(LabelWidget lw)
|
|||
label = nl + 1;
|
||||
if (*label)
|
||||
lw->label.label_height +=
|
||||
fs->max_bounds.ascent + fs->max_bounds.descent;
|
||||
(Dimension)(fs->max_bounds.ascent + fs->max_bounds.descent);
|
||||
}
|
||||
if (*label) {
|
||||
int width = XTextWidth(fs, label, (int)strlen(label));
|
||||
int width;
|
||||
|
||||
if (lw->label.encoding)
|
||||
width = XTextWidth16(fs, (XChar2b *)label, (int)(strlen(label) / 2));
|
||||
|
@ -384,12 +387,12 @@ SetTextWidthAndHeight(LabelWidget lw)
|
|||
static void
|
||||
GetNormalGC(LabelWidget lw)
|
||||
{
|
||||
XGCValues values;
|
||||
|
||||
values.foreground = lw->label.foreground;
|
||||
values.background = lw->core.background_pixel;
|
||||
values.font = lw->label.font->fid;
|
||||
values.graphics_exposures = False;
|
||||
XGCValues values = {
|
||||
.foreground = lw->label.foreground,
|
||||
.background = lw->core.background_pixel,
|
||||
.font = lw->label.font->fid,
|
||||
.graphics_exposures = False
|
||||
};
|
||||
|
||||
if (lw->simple.international == True)
|
||||
/* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC */
|
||||
|
@ -406,17 +409,17 @@ GetNormalGC(LabelWidget lw)
|
|||
static void
|
||||
GetGrayGC(LabelWidget lw)
|
||||
{
|
||||
XGCValues values;
|
||||
|
||||
values.foreground = lw->label.foreground;
|
||||
values.background = lw->core.background_pixel;
|
||||
values.font = lw->label.font->fid;
|
||||
values.fill_style = FillTiled;
|
||||
values.tile = XmuCreateStippledPixmap(XtScreen((Widget)lw),
|
||||
lw->label.foreground,
|
||||
lw->core.background_pixel,
|
||||
lw->core.depth);
|
||||
values.graphics_exposures = False;
|
||||
XGCValues values = {
|
||||
.foreground = lw->label.foreground,
|
||||
.background = lw->core.background_pixel,
|
||||
.font = lw->label.font->fid,
|
||||
.fill_style = FillTiled,
|
||||
.tile = XmuCreateStippledPixmap(XtScreen((Widget)lw),
|
||||
lw->label.foreground,
|
||||
lw->core.background_pixel,
|
||||
lw->core.depth),
|
||||
.graphics_exposures = False
|
||||
};
|
||||
|
||||
lw->label.stipple = values.tile;
|
||||
if (lw->simple.international == True)
|
||||
|
@ -492,9 +495,9 @@ XawLabelInitialize(Widget request _X_UNUSED, Widget cnew,
|
|||
set_bitmap_info(lw); /* need core.height */
|
||||
|
||||
if (XtWidth(lw) == 0) /* need label.lbm_width */
|
||||
XtWidth(lw) = (lw->label.label_width
|
||||
+ (2 * lw->label.internal_width)
|
||||
+ LEFT_OFFSET(lw));
|
||||
XtWidth(lw) = (Dimension)(lw->label.label_width
|
||||
+ (unsigned)(2 * lw->label.internal_width)
|
||||
+ LEFT_OFFSET(lw));
|
||||
|
||||
lw->label.label_x = lw->label.label_y = 0;
|
||||
(*XtClass(cnew)->core_class.resize)((Widget)lw);
|
||||
|
@ -511,10 +514,6 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region)
|
|||
(*Superclass->core_class.expose)(gw, event, region);
|
||||
|
||||
gc = XtIsSensitive(gw) ? w->label.normal_GC : w->label.gray_GC;
|
||||
#ifdef notdef
|
||||
if (region != NULL)
|
||||
XSetRegion(XtDisplay(gw), gc, region);
|
||||
#endif /*notdef*/
|
||||
|
||||
if (w->label.pixmap == None) {
|
||||
int len = w->label.label_len;
|
||||
|
@ -532,7 +531,7 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region)
|
|||
if (w->simple.international == True) {
|
||||
XFontSetExtents *ext = XExtentsOfFontSet(w->label.fontset);
|
||||
|
||||
ksy = (ksy + XawAbs(ext->max_ink_extent.y));
|
||||
ksy = (Position) (ksy + XawAbs(ext->max_ink_extent.y));
|
||||
|
||||
if (len == MULTI_LINE_LABEL) {
|
||||
char *nl;
|
||||
|
@ -541,7 +540,7 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region)
|
|||
XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset,
|
||||
gc, w->label.label_x, ksy, label,
|
||||
(int)(nl - label));
|
||||
ksy = (ksy + ext->max_ink_extent.height);
|
||||
ksy = (Position) (ksy + ext->max_ink_extent.height);
|
||||
label = nl + 1;
|
||||
}
|
||||
len = (int)strlen(label);
|
||||
|
@ -562,8 +561,8 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region)
|
|||
else
|
||||
XDrawString(XtDisplay(gw), XtWindow(gw), gc,
|
||||
w->label.label_x, y, label, (int)(nl - label));
|
||||
y += (w->label.font->max_bounds.ascent +
|
||||
w->label.font->max_bounds.descent);
|
||||
y += (Position) (w->label.font->max_bounds.ascent +
|
||||
w->label.font->max_bounds.descent);
|
||||
label = nl + 1;
|
||||
}
|
||||
len = (int)strlen(label);
|
||||
|
@ -586,11 +585,6 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region)
|
|||
XCopyArea(XtDisplay(gw), w->label.pixmap, XtWindow(gw), gc,
|
||||
0, 0, w->label.label_width, w->label.label_height,
|
||||
w->label.label_x, w->label.label_y);
|
||||
|
||||
#ifdef notdef
|
||||
if (region != NULL)
|
||||
XSetClipMask(XtDisplay(gw), gc, (Pixmap)None);
|
||||
#endif /* notdef */
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -598,7 +592,7 @@ _Reposition(LabelWidget lw, unsigned int width, unsigned int height,
|
|||
Position *dx, Position *dy)
|
||||
{
|
||||
Position newPos;
|
||||
Position leftedge = (lw->label.internal_width + LEFT_OFFSET(lw));
|
||||
Position leftedge = (Position)(lw->label.internal_width + LEFT_OFFSET(lw));
|
||||
|
||||
switch (lw->label.justify) {
|
||||
case XtJustifyLeft:
|
||||
|
@ -644,8 +638,8 @@ XawLabelSetValues(Widget current, Widget request, Widget cnew,
|
|||
LabelWidget curlw = (LabelWidget)current;
|
||||
LabelWidget reqlw = (LabelWidget)request;
|
||||
LabelWidget newlw = (LabelWidget)cnew;
|
||||
unsigned int i;
|
||||
Boolean was_resized = False, redisplay = False, checks[NUM_CHECKS];
|
||||
Cardinal i;
|
||||
|
||||
for (i = 0; i < NUM_CHECKS; i++)
|
||||
checks[i] = False;
|
||||
|
@ -700,9 +694,9 @@ XawLabelSetValues(Widget current, Widget request, Widget cnew,
|
|||
set_bitmap_info(newlw);
|
||||
|
||||
if (XtWidth(curlw) == XtWidth(reqlw) && !checks[WIDTH])
|
||||
XtWidth(newlw) = (newlw->label.label_width
|
||||
+ LEFT_OFFSET(newlw)
|
||||
+ (unsigned)(newlw->label.internal_width << 1));
|
||||
XtWidth(newlw) = (Dimension)(newlw->label.label_width
|
||||
+ LEFT_OFFSET(newlw)
|
||||
+ (unsigned)(newlw->label.internal_width << 1));
|
||||
}
|
||||
|
||||
if (curlw->label.foreground != newlw->label.foreground
|
||||
|
@ -753,9 +747,9 @@ XawLabelQueryGeometry(Widget w, XtWidgetGeometry *intended,
|
|||
LabelWidget lw = (LabelWidget)w;
|
||||
|
||||
preferred->request_mode = CWWidth | CWHeight;
|
||||
preferred->width = (lw->label.label_width
|
||||
+ (unsigned)(lw->label.internal_width << 1)
|
||||
+ LEFT_OFFSET(lw));
|
||||
preferred->width = (Dimension)(lw->label.label_width
|
||||
+ (unsigned)(lw->label.internal_width << 1)
|
||||
+ LEFT_OFFSET(lw));
|
||||
preferred->height = (Dimension)(lw->label.label_height +
|
||||
(lw->label.internal_height << 1));
|
||||
|
||||
|
|
|
@ -300,10 +300,15 @@ ListClassRec listClassRec = {
|
|||
NULL, /* callback_private */
|
||||
defaultTranslations, /* tm_table */
|
||||
XawListQueryGeometry, /* query_geometry */
|
||||
NULL, /* display_accelerator */
|
||||
NULL, /* extension */
|
||||
},
|
||||
/* simple */
|
||||
{
|
||||
XtInheritChangeSensitive, /* change_sensitive */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* list */
|
||||
{
|
||||
|
@ -319,11 +324,11 @@ WidgetClass listWidgetClass = (WidgetClass)&listClassRec;
|
|||
static void
|
||||
GetGCs(Widget w)
|
||||
{
|
||||
XGCValues values;
|
||||
ListWidget lw = (ListWidget)w;
|
||||
|
||||
values.foreground = lw->list.foreground;
|
||||
values.font = lw->list.font->fid;
|
||||
XGCValues values = {
|
||||
.foreground = lw->list.foreground,
|
||||
.font = lw->list.font->fid
|
||||
};
|
||||
|
||||
if (lw->simple.international == True)
|
||||
lw->list.normgc = XtAllocateGC(w, 0, GCForeground, &values, GCFont, 0);
|
||||
|
@ -353,7 +358,6 @@ GetGCs(Widget w)
|
|||
static void
|
||||
CalculatedValues(Widget w)
|
||||
{
|
||||
int i, len;
|
||||
ListWidget lw = (ListWidget)w;
|
||||
|
||||
/* If list is NULL then the list will just be the name of the widget */
|
||||
|
@ -369,9 +373,13 @@ CalculatedValues(Widget w)
|
|||
|
||||
/* Get column width */
|
||||
if (LongestFree(lw)) {
|
||||
int i;
|
||||
|
||||
lw->list.longest = 0; /* so it will accumulate real longest below */
|
||||
|
||||
for (i = 0 ; i < lw->list.nitems; i++) {
|
||||
int len;
|
||||
|
||||
if (lw->simple.international == True)
|
||||
len = XmbTextEscapement(lw->list.fontset, lw->list.list[i],
|
||||
(int)strlen(lw->list.list[i]));
|
||||
|
@ -432,11 +440,12 @@ ResetList(Widget w, Bool changex, Bool changey)
|
|||
static void
|
||||
ChangeSize(Widget w, unsigned int width, unsigned int height)
|
||||
{
|
||||
XtWidgetGeometry request, reply;
|
||||
|
||||
request.request_mode = CWWidth | CWHeight;
|
||||
request.width = (Dimension)width;
|
||||
request.height = (Dimension)height;
|
||||
XtWidgetGeometry request = {
|
||||
.request_mode = CWWidth | CWHeight,
|
||||
.width = (Dimension)width,
|
||||
.height = (Dimension)height
|
||||
};
|
||||
XtWidgetGeometry reply;
|
||||
|
||||
switch (XtMakeGeometryRequest(w, &request, &reply)) {
|
||||
case XtGeometryYes:
|
||||
|
@ -668,12 +677,15 @@ HighlightBackground(Widget w, int x, int y, GC gc)
|
|||
static void
|
||||
ClipToShadowInteriorAndLongest(ListWidget lw, GC *gc_p, unsigned int x)
|
||||
{
|
||||
XRectangle rect;
|
||||
XRectangle rect = {
|
||||
.x = (short)x,
|
||||
.y = (short)lw->list.internal_height,
|
||||
.height = (unsigned short)
|
||||
(XtHeight(lw) - (lw->list.internal_height << 1)),
|
||||
.width = (unsigned short)
|
||||
(XtWidth(lw) - (unsigned)lw->list.internal_width - x),
|
||||
};
|
||||
|
||||
rect.x = (short)x;
|
||||
rect.y = (short)lw->list.internal_height;
|
||||
rect.height = (unsigned short)(XtHeight(lw) - (lw->list.internal_height << 1));
|
||||
rect.width = (unsigned short)(XtWidth(lw) - (unsigned)lw->list.internal_width - x);
|
||||
if (rect.width > lw->list.longest)
|
||||
rect.width = (unsigned short)lw->list.longest;
|
||||
|
||||
|
@ -980,7 +992,6 @@ Notify(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _
|
|||
{
|
||||
ListWidget lw = (ListWidget)w;
|
||||
int item, item_len;
|
||||
XawListReturnStruct ret_value;
|
||||
|
||||
/*
|
||||
* Find item and if out of range then unhighlight and return
|
||||
|
@ -1012,10 +1023,14 @@ Notify(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _
|
|||
/*
|
||||
* Call Callback function
|
||||
*/
|
||||
ret_value.string = lw->list.list[item];
|
||||
ret_value.list_index = item;
|
||||
{
|
||||
XawListReturnStruct ret_value = {
|
||||
.string = lw->list.list[item],
|
||||
.list_index = item
|
||||
};
|
||||
|
||||
XtCallCallbacks(w, XtNcallback, (XtPointer)&ret_value);
|
||||
XtCallCallbacks(w, XtNcallback, (XtPointer)&ret_value);
|
||||
}
|
||||
}
|
||||
|
||||
/* Unset() - Action
|
||||
|
@ -1178,7 +1193,7 @@ XawListDestroy(Widget w)
|
|||
* If nitems is <= 0 then the list needs to be NULL terminated
|
||||
*/
|
||||
void
|
||||
XawListChange(Widget w, _Xconst char **list, int nitems, int longest,
|
||||
XawListChange(Widget w, String *list, int nitems, int longest,
|
||||
#if NeedWidePrototypes
|
||||
int resize_it
|
||||
#else
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
lib_LTLIBRARIES =
|
||||
|
||||
#
|
||||
# This doesn't appear to be used on any
|
||||
# current systems -- it requires SUNSHLIB and !SHAREDCODE,
|
||||
# but only sunLib.rules defines SUNSHLIB and that file also
|
||||
# always defines SHAREDCODE. Go figure
|
||||
#
|
||||
# SHAREDLIB_SOURCES = sharedlib.c
|
||||
|
||||
COMMON_SOURCES = \
|
||||
Actions.c \
|
||||
AllWidgets.c \
|
||||
|
@ -138,5 +130,3 @@ endif
|
|||
endif
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST = sharedlib.c
|
||||
|
|
|
@ -306,6 +306,7 @@ XAW6_LIBS = @XAW6_LIBS@
|
|||
XAW7_CFLAGS = @XAW7_CFLAGS@
|
||||
XAW7_LIBS = @XAW7_LIBS@
|
||||
XMLTO = @XMLTO@
|
||||
XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@
|
||||
XORG_MAN_PAGE = @XORG_MAN_PAGE@
|
||||
XORG_SGML_PATH = @XORG_SGML_PATH@
|
||||
XSLTPROC = @XSLTPROC@
|
||||
|
@ -364,14 +365,6 @@ top_build_prefix = @top_build_prefix@
|
|||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
lib_LTLIBRARIES = $(am__append_1) $(am__append_2)
|
||||
|
||||
#
|
||||
# This doesn't appear to be used on any
|
||||
# current systems -- it requires SUNSHLIB and !SHAREDCODE,
|
||||
# but only sunLib.rules defines SUNSHLIB and that file also
|
||||
# always defines SHAREDCODE. Go figure
|
||||
#
|
||||
# SHAREDLIB_SOURCES = sharedlib.c
|
||||
COMMON_SOURCES = \
|
||||
Actions.c \
|
||||
AllWidgets.c \
|
||||
|
@ -453,7 +446,6 @@ AM_CPPFLAGS = \
|
|||
|
||||
@BUILD_XAW7_TRUE@libXaw7_la_LDFLAGS = -version-info 7:0:0 -no-undefined
|
||||
@BUILD_XAW7_TRUE@libXaw7_la_LIBADD = $(XAW7_LIBS)
|
||||
EXTRA_DIST = sharedlib.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
|
|
@ -128,7 +128,10 @@ MenuButtonClassRec menuButtonClassRec = {
|
|||
},
|
||||
/* simple */
|
||||
{
|
||||
XtInheritChangeSensitive /* change_sensitive */
|
||||
XtInheritChangeSensitive, /* change_sensitive */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* label */
|
||||
{
|
||||
|
@ -208,7 +211,9 @@ PopupMenu(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal
|
|||
int menu_x, menu_y, menu_width, menu_height, button_height;
|
||||
Position button_x, button_y;
|
||||
|
||||
temp = w;
|
||||
if ((temp = w) == NULL)
|
||||
return;
|
||||
|
||||
while(temp != NULL) {
|
||||
menu = XtNameToWidget(temp, mbw->menu_button.menu_name);
|
||||
if (menu == NULL)
|
||||
|
|
|
@ -551,7 +551,6 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx,
|
|||
TextWidget ctx = (TextWidget)XtParent(w);
|
||||
Widget source = ctx->text.source;
|
||||
XawTextPosition idx, pos;
|
||||
wchar_t c;
|
||||
XFontSetExtents *ext = XExtentsOfFontSet(fontset);
|
||||
XawTextBlock blk;
|
||||
int i, rWidth;
|
||||
|
@ -559,6 +558,8 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx,
|
|||
pos = XawTextSourceRead(source, fromPos, &blk, (int)(toPos - fromPos));
|
||||
rWidth = 0;
|
||||
for (i = 0, idx = fromPos; idx < toPos; i++, idx++) {
|
||||
wchar_t c;
|
||||
|
||||
if (i >= blk.length) {
|
||||
i = 0;
|
||||
XawTextSourceRead(source, pos, &blk, (int)(toPos - pos));
|
||||
|
@ -656,15 +657,15 @@ GetGC(MultiSinkObject sink)
|
|||
{
|
||||
XtGCMask valuemask = (GCGraphicsExposures | GCClipXOrigin |
|
||||
GCForeground | GCBackground);
|
||||
XGCValues values;
|
||||
XGCValues values = {
|
||||
/* XXX We dont want to share a gc that will change the clip-mask */
|
||||
.clip_x_origin = (int)(long)sink,
|
||||
.clip_mask = None,
|
||||
.graphics_exposures = False,
|
||||
|
||||
/* XXX We dont want do share a gc that will change the clip-mask */
|
||||
values.clip_x_origin = (int)(long)sink;
|
||||
values.clip_mask = None;
|
||||
values.graphics_exposures = False;
|
||||
|
||||
values.foreground = sink->text_sink.foreground;
|
||||
values.background = sink->text_sink.background;
|
||||
.foreground = sink->text_sink.foreground,
|
||||
.background = sink->text_sink.background
|
||||
};
|
||||
|
||||
sink->multi_sink.normgc = XtAllocateGC((Widget)sink, 0, valuemask, &values,
|
||||
GCFont | GCClipMask, 0);
|
||||
|
|
|
@ -75,6 +75,10 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
#define O_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
#define MAGIC_VALUE ((XawTextPosition)-1)
|
||||
#define streq(a, b) (strcmp((a), (b)) == 0)
|
||||
|
||||
|
@ -331,7 +335,7 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
|
|||
text->firstPos = (int)pos;
|
||||
text->ptr = (char *)(piece->text + (pos - start));
|
||||
count = piece->used - (pos - start);
|
||||
text->length = (Max(0, (length > count) ? count : length));
|
||||
text->length = (int)(Max(0, (length > count) ? count : length));
|
||||
|
||||
return (pos + text->length);
|
||||
}
|
||||
|
@ -404,12 +408,15 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos,
|
|||
if (src->text_src.edit_mode == XawtextRead)
|
||||
return (XawEditError);
|
||||
|
||||
start_piece = FindPiece(src, startPos, &start_first);
|
||||
end_piece = FindPiece(src, endPos, &end_first);
|
||||
if ((start_piece = FindPiece(src, startPos, &start_first)) == NULL)
|
||||
return XawEditError;
|
||||
if ((end_piece = FindPiece(src, endPos, &end_first)) == NULL)
|
||||
return XawEditError;
|
||||
|
||||
/* STEP 3: remove the empty pieces... */
|
||||
if (start_piece != end_piece) {
|
||||
temp_piece = start_piece->next;
|
||||
if ((temp_piece = start_piece->next) == NULL)
|
||||
return XawEditError;
|
||||
|
||||
/* If empty and not the only piece then remove it */
|
||||
if (((start_piece->used = startPos - start_first) == 0)
|
||||
|
@ -587,7 +594,6 @@ Scan(Widget w, register XawTextPosition position, XawTextScanType type,
|
|||
if (piece == NULL) /* Beginning of text */
|
||||
return (0);
|
||||
ptr = piece->text + piece->used - 1;
|
||||
c = *ptr;
|
||||
}
|
||||
else if (ptr >= piece->text + piece->used) {
|
||||
piece = piece->next;
|
||||
|
@ -869,7 +875,7 @@ static void
|
|||
XawMultiSrcGetValuesHook(Widget w, ArgList args, Cardinal *num_args)
|
||||
{
|
||||
MultiSrcObject src = (MultiSrcObject)w;
|
||||
unsigned int i;
|
||||
Cardinal i;
|
||||
|
||||
if (src->multi_src.type == XawAsciiString) {
|
||||
for (i = 0; i < *num_args ; i++) {
|
||||
|
@ -1034,13 +1040,10 @@ Bool
|
|||
_XawMultiSaveAsFile(Widget w, _Xconst char* name)
|
||||
{
|
||||
MultiSrcObject src = (MultiSrcObject)w;
|
||||
char * mb_string;
|
||||
Bool ret;
|
||||
|
||||
mb_string = StorePiecesInString(src);
|
||||
char *mb_string = StorePiecesInString(src);
|
||||
|
||||
if (mb_string != 0) {
|
||||
ret = WriteToFile(mb_string, (String)name);
|
||||
Bool ret = WriteToFile(mb_string, (String)name);
|
||||
XtFree(mb_string);
|
||||
|
||||
return (ret);
|
||||
|
@ -1089,7 +1092,7 @@ WriteToFile(String string, String name)
|
|||
int fd;
|
||||
Bool result = True;
|
||||
|
||||
if ((fd = creat(name, 0666)) == -1)
|
||||
if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666)) == -1)
|
||||
return (False);
|
||||
|
||||
if (write(fd, string, strlen(string)) == -1)
|
||||
|
@ -1215,7 +1218,7 @@ InitStringOrFile(MultiSrcObject src, Bool newString)
|
|||
XtErrorMsg("NoFile", "multiSourceCreate", "XawError",
|
||||
"Creating a read only disk widget and no file specified.",
|
||||
NULL, 0);
|
||||
open_mode = O_RDONLY;
|
||||
open_mode = O_RDONLY | O_CLOEXEC;
|
||||
fdopen_mode = "r";
|
||||
break;
|
||||
case XawtextAppend:
|
||||
|
@ -1225,9 +1228,9 @@ InitStringOrFile(MultiSrcObject src, Bool newString)
|
|||
src->multi_src.is_tempfile = True;
|
||||
}
|
||||
else {
|
||||
/* O_NOFOLLOW is a BSD & Linux extension */
|
||||
/* O_NOFOLLOW was a FreeBSD & Linux extension, now adopted by POSIX */
|
||||
#ifdef O_NOFOLLOW
|
||||
open_mode = O_RDWR | O_NOFOLLOW;
|
||||
open_mode = O_RDWR | O_NOFOLLOW | O_CLOEXEC;
|
||||
#else
|
||||
open_mode = O_RDWR; /* unsafe; subject to race conditions */
|
||||
#endif
|
||||
|
@ -1323,7 +1326,7 @@ LoadPieces(MultiSrcObject src, FILE *file, char *string)
|
|||
else {
|
||||
if (src->multi_src.length != 0) {
|
||||
temp_mb_holder =
|
||||
XtMalloc(((size_t)(src->multi_src.length + 1) * sizeof(unsigned char)));
|
||||
XtMalloc((Cardinal)((size_t)(src->multi_src.length + 1) * sizeof(unsigned char)));
|
||||
fseek(file, 0, SEEK_SET);
|
||||
src->multi_src.length = (XawTextPosition)fread(temp_mb_holder,
|
||||
sizeof(unsigned char),
|
||||
|
|
|
@ -466,6 +466,10 @@ PanedClassRec panedClassRec = {
|
|||
XawPanedPaneSetValues, /* set_values */
|
||||
NULL, /* extension */
|
||||
},
|
||||
/* paned */
|
||||
{
|
||||
NULL, /* extension */
|
||||
}
|
||||
};
|
||||
|
||||
WidgetClass panedWidgetClass = (WidgetClass)&panedClassRec;
|
||||
|
@ -506,7 +510,7 @@ AdjustPanedSize(PanedWidget pw, unsigned int off_size,
|
|||
int size = Max(PaneInfo(*childP)->size, (int)PaneInfo(*childP)->min);
|
||||
|
||||
AssignMin(size, (int)PaneInfo(*childP)->max);
|
||||
newsize = (newsize + (size + pw->paned.internal_bw));
|
||||
newsize = (Dimension)(newsize + (size + pw->paned.internal_bw));
|
||||
}
|
||||
newsize = (Dimension)(newsize - pw->paned.internal_bw);
|
||||
|
||||
|
@ -792,9 +796,7 @@ static void
|
|||
CommitNewLocations(PanedWidget pw)
|
||||
{
|
||||
Widget *childP;
|
||||
XWindowChanges changes;
|
||||
|
||||
changes.stack_mode = Above;
|
||||
XWindowChanges changes = { .stack_mode = Above };
|
||||
|
||||
ForAllPanes(pw, childP) {
|
||||
Pane pane = PaneInfo(*childP);
|
||||
|
@ -910,7 +912,7 @@ static void
|
|||
_DrawInternalBorders(PanedWidget pw, GC gc)
|
||||
{
|
||||
Widget *childP;
|
||||
int on_loc, off_loc;
|
||||
int off_loc;
|
||||
unsigned int on_size, off_size;
|
||||
|
||||
/*
|
||||
|
@ -925,7 +927,7 @@ _DrawInternalBorders(PanedWidget pw, GC gc)
|
|||
on_size = (unsigned int)pw->paned.internal_bw;
|
||||
|
||||
ForAllPanes(pw, childP) {
|
||||
on_loc = IsVert(pw) ? XtY(*childP) : XtX(*childP);
|
||||
int on_loc = IsVert(pw) ? XtY(*childP) : XtX(*childP);
|
||||
on_loc -= (int)on_size;
|
||||
|
||||
_DrawRect(pw, gc, on_loc, off_loc, on_size, off_size);
|
||||
|
@ -1041,7 +1043,6 @@ static void
|
|||
StartGripAdjustment(PanedWidget pw, Widget grip, Direction dir)
|
||||
{
|
||||
Widget *childP;
|
||||
Cursor cursor;
|
||||
|
||||
pw->paned.whichadd = pw->paned.whichsub = NULL;
|
||||
|
||||
|
@ -1054,6 +1055,8 @@ StartGripAdjustment(PanedWidget pw, Widget grip, Direction dir)
|
|||
* Change the cursor
|
||||
*/
|
||||
if (XtIsRealized(grip)) {
|
||||
Cursor cursor;
|
||||
|
||||
if (IsVert(pw)) {
|
||||
if (dir == UpLeftPane)
|
||||
cursor = pw->paned.adjust_upper_cursor;
|
||||
|
@ -1122,11 +1125,17 @@ MoveGripAdjustment(PanedWidget pw, Widget grip, Direction dir, int loc)
|
|||
if (dir == ThisBorderOnly) {
|
||||
int old_add_size = add_size, old_sub_size;
|
||||
|
||||
if (pw->paned.whichadd == NULL)
|
||||
return;
|
||||
|
||||
AssignMax(add_size, (int)PaneInfo(pw->paned.whichadd)->min);
|
||||
AssignMin(add_size, (int)PaneInfo(pw->paned.whichadd)->max);
|
||||
if (add_size != old_add_size)
|
||||
sub_size += old_add_size - add_size;
|
||||
|
||||
if (pw->paned.whichsub == NULL)
|
||||
return;
|
||||
|
||||
old_sub_size = sub_size;
|
||||
AssignMax(sub_size, (int)PaneInfo(pw->paned.whichsub)->min);
|
||||
AssignMin(sub_size, (int)PaneInfo(pw->paned.whichsub)->max);
|
||||
|
@ -1452,7 +1461,6 @@ ChangeAllGripCursors(PanedWidget pw)
|
|||
Widget *childP;
|
||||
|
||||
ForAllPanes(pw, childP) {
|
||||
Arg arglist[1];
|
||||
Cursor cursor;
|
||||
|
||||
if ((cursor = pw->paned.grip_cursor) == None) {
|
||||
|
@ -1463,6 +1471,8 @@ ChangeAllGripCursors(PanedWidget pw)
|
|||
}
|
||||
|
||||
if (HasGrip(*childP)) {
|
||||
Arg arglist[1];
|
||||
|
||||
XtSetArg(arglist[0], XtNcursor, cursor);
|
||||
XtSetValues(PaneInfo(*childP)->grip, arglist, 1);
|
||||
}
|
||||
|
|
|
@ -39,12 +39,7 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include <X11/Xaw/PannerP.h>
|
||||
#include <X11/Xaw/XawInit.h>
|
||||
#include "Private.h"
|
||||
|
||||
#if defined(ISC) && __STDC__ && !defined(ISC30)
|
||||
extern double atof(char *);
|
||||
#else
|
||||
#include <stdlib.h> /* for atof() */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Class Methods
|
||||
|
@ -342,7 +337,7 @@ WidgetClass pannerWidgetClass = (WidgetClass) &pannerClassRec;
|
|||
static void
|
||||
reset_shadow_gc(PannerWidget pw)
|
||||
{
|
||||
XtGCMask valuemask = GCForeground;
|
||||
XtGCMask valuemask;
|
||||
XGCValues values;
|
||||
unsigned long pixels[3];
|
||||
|
||||
|
@ -981,11 +976,11 @@ ActionPage(Widget gw, XEvent *event, String *params, Cardinal *num_params)
|
|||
y += pw->panner.knob_y;
|
||||
|
||||
if (isin) { /* if in, then use move */
|
||||
XEvent ev;
|
||||
|
||||
ev.xbutton.type = ButtonPress;
|
||||
ev.xbutton.x = x;
|
||||
ev.xbutton.y = y;
|
||||
XEvent ev = {
|
||||
.xbutton.type = ButtonPress,
|
||||
.xbutton.x = x,
|
||||
.xbutton.y = y
|
||||
};
|
||||
ActionMove(gw, &ev, NULL, &zero);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -469,14 +469,15 @@ _XawFindCache(XawCache *xaw,
|
|||
static XawCache *
|
||||
_XawGetCache(XawCache *xaw, Screen *screen, Colormap colormap, int depth)
|
||||
{
|
||||
XawCache *s_cache, *c_cache, *d_cache, *cache, *pcache;
|
||||
XawCache *cache;
|
||||
|
||||
cache = _XawFindCache(xaw, screen, colormap, depth, FIND_ALL);
|
||||
|
||||
if (!cache)
|
||||
{
|
||||
s_cache = _XawFindCache(xaw,
|
||||
screen, colormap, depth, FIND_SCREEN);
|
||||
XawCache *c_cache, *d_cache, *pcache;
|
||||
XawCache *s_cache = _XawFindCache(xaw,
|
||||
screen, colormap, depth, FIND_SCREEN);
|
||||
if (!s_cache)
|
||||
{
|
||||
pcache = (XawCache *)XtMalloc(sizeof(XawCache));
|
||||
|
@ -664,7 +665,7 @@ GetResourcePixmapPath(Display *display)
|
|||
XrmRepresentation rep_type;
|
||||
XrmValue value;
|
||||
static char *default_path =
|
||||
"%H/%T/%N:%P/include/X11/%T/%N:/usr/X11R6/include/X11/%T/%N:/usr/include/X11/%T/%N:%N";
|
||||
(char*)"%H/%T/%N:%P/include/X11/%T/%N:/usr/X11R6/include/X11/%T/%N:/usr/include/X11/%T/%N:%N";
|
||||
|
||||
xrm_name[0] = XrmPermStringToQuark("pixmapFilePath");
|
||||
xrm_name[1] = NULLQUARK;
|
||||
|
@ -707,7 +708,6 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth,
|
|||
{
|
||||
Pixel fg, bg;
|
||||
XColor color, exact;
|
||||
Pixmap pixmap;
|
||||
unsigned int width, height;
|
||||
unsigned char *data = NULL;
|
||||
int hotX, hotY;
|
||||
|
@ -716,8 +716,8 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth,
|
|||
static SubstitutionRec sub[] = {
|
||||
{'H', NULL},
|
||||
{'N', NULL},
|
||||
{'T', "bitmaps"},
|
||||
{'P', PROJECT_ROOT},
|
||||
{'T', (_XtString) "bitmaps"},
|
||||
{'P', (_XtString) PROJECT_ROOT},
|
||||
};
|
||||
char *filename;
|
||||
|
||||
|
@ -747,7 +747,7 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth,
|
|||
{
|
||||
if (!sub[0].substitution)
|
||||
sub[0].substitution = getenv("HOME");
|
||||
sub[1].substitution = params->name;
|
||||
sub[1].substitution = (_XtString)params->name;
|
||||
if (pixmap_path == NULL)
|
||||
GetResourcePixmapPath(DisplayOfScreen(screen));
|
||||
filename = XtFindFile(pixmap_path, sub, XtNumber(sub), NULL);
|
||||
|
@ -755,15 +755,16 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth,
|
|||
return (FALSE);
|
||||
}
|
||||
else
|
||||
filename = params->name;
|
||||
filename = (char*)params->name;
|
||||
|
||||
if (XReadBitmapFileData(filename, &width, &height, &data,
|
||||
&hotX, &hotY) == BitmapSuccess)
|
||||
{
|
||||
pixmap = XCreatePixmapFromBitmapData(DisplayOfScreen(screen),
|
||||
RootWindowOfScreen(screen),
|
||||
(char *)data,
|
||||
width, height, fg, bg, (unsigned)depth);
|
||||
Pixmap pixmap =
|
||||
XCreatePixmapFromBitmapData(DisplayOfScreen(screen),
|
||||
RootWindowOfScreen(screen),
|
||||
(char *)data,
|
||||
width, height, fg, bg, (unsigned)depth);
|
||||
if (data)
|
||||
XFree(data);
|
||||
*pixmap_return = pixmap;
|
||||
|
@ -828,7 +829,7 @@ GradientLoader(XawParams *params, Screen *screen, Colormap colormap, int depth,
|
|||
|
||||
value = NULL;
|
||||
if ((argval = XawFindArgVal(params, "start")) != NULL)
|
||||
value = argval->value;
|
||||
value = (char*)argval->value;
|
||||
if (value && !XAllocNamedColor(DisplayOfScreen(screen), colormap, value,
|
||||
&start, &color))
|
||||
return (False);
|
||||
|
@ -839,7 +840,7 @@ GradientLoader(XawParams *params, Screen *screen, Colormap colormap, int depth,
|
|||
}
|
||||
value = NULL;
|
||||
if ((argval = XawFindArgVal(params, "end")) != NULL)
|
||||
value = argval->value;
|
||||
value = (char*)argval->value;
|
||||
if (value && !XAllocNamedColor(DisplayOfScreen(screen), colormap, value,
|
||||
&end, &color))
|
||||
return (False);
|
||||
|
@ -936,8 +937,8 @@ XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth _X
|
|||
static SubstitutionRec sub[] = {
|
||||
{'H', NULL},
|
||||
{'N', NULL},
|
||||
{'T', "pixmaps"},
|
||||
{'P', PROJECT_ROOT},
|
||||
{'T', (_XtString) "pixmaps"},
|
||||
{'P', (_XtString) PROJECT_ROOT},
|
||||
};
|
||||
const char *filename;
|
||||
|
||||
|
@ -949,7 +950,7 @@ XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth _X
|
|||
{
|
||||
if (!sub[0].substitution)
|
||||
sub[0].substitution = getenv("HOME");
|
||||
sub[1].substitution = params->name;
|
||||
sub[1].substitution = (_XtString)params->name;
|
||||
if (pixmap_path == NULL)
|
||||
GetResourcePixmapPath(DisplayOfScreen(screen));
|
||||
filename = XtFindFile(pixmap_path, sub, XtNumber(sub), NULL);
|
||||
|
|
|
@ -153,15 +153,15 @@ SendReport(PortholeWidget pw, unsigned int changed)
|
|||
Widget child = find_child(pw);
|
||||
|
||||
if (pw->porthole.report_callbacks && child) {
|
||||
XawPannerReport prep;
|
||||
|
||||
prep.changed = changed;
|
||||
prep.slider_x = (Position)(-XtX(child)); /* porthole is "inner" */
|
||||
prep.slider_y = (Position)(-XtY(child)); /* child is outer since it is larger */
|
||||
prep.slider_width = XtWidth(pw);
|
||||
prep.slider_height = XtHeight(pw);
|
||||
prep.canvas_width = XtWidth(child);
|
||||
prep.canvas_height = XtHeight(child);
|
||||
XawPannerReport prep = {
|
||||
.changed = changed,
|
||||
.slider_x = (Position)(-XtX(child)), /* porthole is "inner" */
|
||||
.slider_y = (Position)(-XtY(child)), /* child is outer since it is larger */
|
||||
.slider_width = XtWidth(pw),
|
||||
.slider_height = XtHeight(pw),
|
||||
.canvas_width = XtWidth(child),
|
||||
.canvas_height = XtHeight(child)
|
||||
};
|
||||
XtCallCallbackList((Widget)pw, pw->porthole.report_callbacks,
|
||||
(XtPointer)&prep);
|
||||
}
|
||||
|
@ -351,9 +351,8 @@ XawPortholeChangeManaged(Widget gw)
|
|||
|
||||
if (child) {
|
||||
if (!XtIsRealized (gw)) {
|
||||
XtWidgetGeometry geom, retgeom;
|
||||
XtWidgetGeometry geom = { .request_mode = 0 }, retgeom;
|
||||
|
||||
geom.request_mode = 0;
|
||||
if (XtWidth(pw) == 0) {
|
||||
geom.width = XtWidth(child);
|
||||
geom.request_mode |= CWWidth;
|
||||
|
|
|
@ -190,6 +190,9 @@ RepeaterClassRec repeaterClassRec = {
|
|||
/* simple */
|
||||
{
|
||||
XtInheritChangeSensitive, /* change_sensitive */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* label */
|
||||
{
|
||||
|
|
|
@ -316,6 +316,9 @@ ScrollbarClassRec scrollbarClassRec = {
|
|||
/* simple */
|
||||
{
|
||||
XtInheritChangeSensitive, /* change_sensitive */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* scrollbar */
|
||||
{
|
||||
|
|
|
@ -225,6 +225,9 @@ SimpleClassRec simpleClassRec = {
|
|||
/* simple */
|
||||
{
|
||||
ChangeSensitive, /* change_sensitive */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -272,6 +272,9 @@ static CompositeClassExtensionRec extension_rec = {
|
|||
XtCompositeExtensionVersion, /* version */
|
||||
sizeof(CompositeClassExtensionRec), /* record_size */
|
||||
True, /* accepts_objects */
|
||||
#ifndef OLDXAW
|
||||
False, /* allows_change_managed_set */
|
||||
#endif
|
||||
};
|
||||
|
||||
#define Superclass (&overrideShellClassRec)
|
||||
|
@ -1070,7 +1073,9 @@ CreateLabel(Widget w)
|
|||
*next_child = *child;
|
||||
next_child = child;
|
||||
}
|
||||
*child = (Widget)smw->simple_menu.label;
|
||||
|
||||
if (child != NULL)
|
||||
*child = (Widget)smw->simple_menu.label;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1105,8 +1110,6 @@ Layout(Widget w, Dimension *width_ret, Dimension *height_ret)
|
|||
short vadd, hadd, x_ins, y_ins;
|
||||
Dimension *widths;
|
||||
|
||||
height = 0;
|
||||
|
||||
if (XtIsSubclass(w, simpleMenuWidgetClass)) {
|
||||
smw = (SimpleMenuWidget)w;
|
||||
current_entry = NULL;
|
||||
|
@ -1196,7 +1199,7 @@ Layout(Widget w, Dimension *width_ret, Dimension *height_ret)
|
|||
++n;
|
||||
}
|
||||
|
||||
height = (tmp_h + smw->simple_menu.bottom_margin);
|
||||
height = (Dimension)(tmp_h + smw->simple_menu.bottom_margin);
|
||||
width = (Dimension)(width + tmp_w);
|
||||
|
||||
if (smw->simple_menu.label && width < XtWidth(smw->simple_menu.label)) {
|
||||
|
@ -1306,12 +1309,14 @@ AddPositionAction(XtAppContext app_con, XPointer data _X_UNUSED)
|
|||
static Widget
|
||||
FindMenu(Widget widget, String name)
|
||||
{
|
||||
Widget w, menu;
|
||||
Widget w;
|
||||
|
||||
for (w = widget; w != NULL; w = XtParent(w))
|
||||
if ((menu = XtNameToWidget(w, name)) != NULL)
|
||||
for (w = widget; w != NULL; w = XtParent(w)) {
|
||||
Widget menu = XtNameToWidget(w, name);
|
||||
|
||||
if (menu != NULL)
|
||||
return (menu);
|
||||
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
@ -1458,11 +1463,12 @@ static void
|
|||
MakeSetValuesRequest(Widget w, unsigned int width, unsigned int height)
|
||||
{
|
||||
SimpleMenuWidget smw = (SimpleMenuWidget)w;
|
||||
Arg arglist[2];
|
||||
Cardinal num_args = 0;
|
||||
|
||||
if (!smw->simple_menu.recursive_set_values) {
|
||||
if (XtWidth(smw) != width || XtHeight(smw) != height) {
|
||||
Arg arglist[2];
|
||||
Cardinal num_args = 0;
|
||||
|
||||
smw->simple_menu.recursive_set_values = True;
|
||||
XtSetArg(arglist[num_args], XtNwidth, width); num_args++;
|
||||
XtSetArg(arglist[num_args], XtNheight, height); num_args++;
|
||||
|
@ -1553,7 +1559,6 @@ GetEventEntry(Widget w, XEvent *event)
|
|||
*/
|
||||
if (x_root == WidthOfScreen(XtScreen(w)) - 1 &&
|
||||
XtX(w) + XtWidth(w) + (XtBorderWidth(w)) > x_root) {
|
||||
warp = -8;
|
||||
if (smw->simple_menu.entry_set) {
|
||||
entry = DoGetEventEntry(w,
|
||||
XtX(smw->simple_menu.entry_set)
|
||||
|
|
|
@ -705,15 +705,16 @@ static void
|
|||
CreateGCs(Widget w)
|
||||
{
|
||||
SmeBSBObject entry = (SmeBSBObject)w;
|
||||
XGCValues values;
|
||||
XtGCMask mask, mask_i18n;
|
||||
XGCValues values = {
|
||||
.foreground = XtParent(w)->core.background_pixel,
|
||||
.background = entry->sme_bsb.foreground,
|
||||
.font = entry->sme_bsb.font->fid,
|
||||
.graphics_exposures = False
|
||||
};
|
||||
|
||||
XtGCMask mask = GCForeground | GCBackground | GCGraphicsExposures | GCFont;
|
||||
XtGCMask mask_i18n = GCForeground | GCBackground | GCGraphicsExposures;
|
||||
|
||||
values.foreground = XtParent(w)->core.background_pixel;
|
||||
values.background = entry->sme_bsb.foreground;
|
||||
values.font = entry->sme_bsb.font->fid;
|
||||
values.graphics_exposures = False;
|
||||
mask = GCForeground | GCBackground | GCGraphicsExposures | GCFont;
|
||||
mask_i18n = GCForeground | GCBackground | GCGraphicsExposures;
|
||||
if (entry->sme.international == True)
|
||||
entry->sme_bsb.rev_gc = XtAllocateGC(w, 0, mask_i18n, &values, GCFont, 0);
|
||||
else
|
||||
|
|
|
@ -181,12 +181,12 @@ static void
|
|||
CreateGC(Widget w)
|
||||
{
|
||||
SmeLineObject entry = (SmeLineObject)w;
|
||||
XGCValues values;
|
||||
XtGCMask mask = GCForeground | GCGraphicsExposures | GCLineWidth;
|
||||
|
||||
values.foreground = entry->sme_line.foreground;
|
||||
values.graphics_exposures = False;
|
||||
values.line_width = entry->sme_line.line_width;
|
||||
XGCValues values = {
|
||||
.foreground = entry->sme_line.foreground,
|
||||
.graphics_exposures = False,
|
||||
.line_width = entry->sme_line.line_width
|
||||
};
|
||||
|
||||
if (entry->sme_line.stipple != XtUnspecifiedPixmap) {
|
||||
values.stipple = entry->sme_line.stipple;
|
||||
|
|
|
@ -318,7 +318,7 @@ static void
|
|||
draw_it(XtPointer client_data, XtIntervalId *id _X_UNUSED)
|
||||
{
|
||||
StripChartWidget w = (StripChartWidget)client_data;
|
||||
double value;
|
||||
double value = 0.0;
|
||||
|
||||
if (w->strip_chart.update > 0)
|
||||
w->strip_chart.interval_id =
|
||||
|
@ -385,7 +385,6 @@ draw_it(XtPointer client_data, XtIntervalId *id _X_UNUSED)
|
|||
static int
|
||||
repaint_window(StripChartWidget w, int left, int width)
|
||||
{
|
||||
int i, j;
|
||||
int next = w->strip_chart.interval;
|
||||
int scale = w->strip_chart.scale;
|
||||
int scalewidth = 0;
|
||||
|
@ -410,6 +409,7 @@ repaint_window(StripChartWidget w, int left, int width)
|
|||
}
|
||||
|
||||
if (XtIsRealized((Widget)w)) {
|
||||
int i;
|
||||
Display *dpy = XtDisplay(w);
|
||||
Window win = XtWindow(w);
|
||||
|
||||
|
@ -434,7 +434,7 @@ repaint_window(StripChartWidget w, int left, int width)
|
|||
|
||||
/* Draw graph reference lines */
|
||||
for (i = 1; i < w->strip_chart.scale; i++) {
|
||||
j = i * ((int)XtHeight(w) / w->strip_chart.scale);
|
||||
int j = i * ((int)XtHeight(w) / w->strip_chart.scale);
|
||||
XDrawLine(dpy, win, w->strip_chart.hiGC, left, j, scalewidth, j);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -474,9 +474,7 @@ static XtResource resources[] = {
|
|||
{ toVal->size = sizeof(type); toVal->addr = (XPointer)address; }
|
||||
|
||||
static XrmQuark QWrapNever, QWrapLine, QWrapWord;
|
||||
#ifndef notdef
|
||||
static XrmQuark QScrollNever, QScrollWhenNeeded, QScrollAlways;
|
||||
#endif
|
||||
static XrmQuark QJustifyLeft, QJustifyRight, QJustifyCenter, QJustifyFull;
|
||||
|
||||
/*ARGSUSED*/
|
||||
|
@ -795,7 +793,7 @@ CreateVScrollBar(TextWidget ctx)
|
|||
XtAddCallback(vbar, XtNscrollProc, VScroll, (XtPointer)ctx);
|
||||
XtAddCallback(vbar, XtNjumpProc, VJump, (XtPointer)ctx);
|
||||
|
||||
ctx->text.r_margin.left += (XtWidth(vbar) + XtBorderWidth(vbar));
|
||||
ctx->text.r_margin.left += (Position) (XtWidth(vbar) + XtBorderWidth(vbar));
|
||||
ctx->text.left_margin = ctx->text.margin.left = ctx->text.r_margin.left;
|
||||
|
||||
PositionVScrollBar(ctx);
|
||||
|
@ -950,7 +948,7 @@ XawTextInitialize(Widget request _X_UNUSED, Widget cnew,
|
|||
if (XtHeight(ctx) == DEFAULT_TEXT_HEIGHT) {
|
||||
XtHeight(ctx) = (Dimension)VMargins(ctx);
|
||||
if (ctx->text.sink != NULL)
|
||||
XtHeight(ctx) += XawTextSinkMaxHeight(ctx->text.sink, 1);
|
||||
XtHeight(ctx) += (Dimension) XawTextSinkMaxHeight(ctx->text.sink, 1);
|
||||
}
|
||||
|
||||
if (ctx->text.scroll_vert == XawtextScrollAlways)
|
||||
|
@ -1069,14 +1067,16 @@ void
|
|||
_XawTextNeedsUpdating(TextWidget ctx,
|
||||
XawTextPosition left, XawTextPosition right)
|
||||
{
|
||||
XmuSegment segment;
|
||||
|
||||
if (left >= right)
|
||||
return;
|
||||
else {
|
||||
XmuSegment segment = {
|
||||
.x1 = (int)left,
|
||||
.x2 = (int)right
|
||||
};
|
||||
|
||||
segment.x1 = (int)left;
|
||||
segment.x2 = (int)right;
|
||||
(void)XmuScanlineOrSegment(ctx->text.update, &segment);
|
||||
(void)XmuScanlineOrSegment(ctx->text.update, &segment);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1124,18 +1124,15 @@ _XawTextGetText(TextWidget ctx, XawTextPosition left, XawTextPosition right)
|
|||
char *
|
||||
_XawTextGetSTRING(TextWidget ctx, XawTextPosition left, XawTextPosition right)
|
||||
{
|
||||
unsigned char *s;
|
||||
unsigned char c;
|
||||
long i, j, n;
|
||||
wchar_t *ws, wc;
|
||||
|
||||
/* allow ESC in accordance with ICCCM */
|
||||
if (XawTextFormat(ctx, XawFmtWide)) {
|
||||
MultiSinkObject sink = (MultiSinkObject)ctx->text.sink;
|
||||
ws = (wchar_t *)_XawTextGetText(ctx, left, right);
|
||||
n = (long)wcslen(ws);
|
||||
wchar_t *ws = (wchar_t *)_XawTextGetText(ctx, left, right);
|
||||
long n = (long)wcslen(ws);
|
||||
long i, j;
|
||||
|
||||
for (j = 0, i = 0; j < n; j++) {
|
||||
wc = ws[j];
|
||||
wchar_t wc = ws[j];
|
||||
if (XwcTextEscapement (sink->multi_sink.fontset, &wc, 1)
|
||||
|| (wc == _Xaw_atowc(XawTAB)) || (wc == _Xaw_atowc(XawLF))
|
||||
|| (wc == _Xaw_atowc(XawESC)))
|
||||
|
@ -1145,12 +1142,13 @@ _XawTextGetSTRING(TextWidget ctx, XawTextPosition left, XawTextPosition right)
|
|||
return ((char *)ws);
|
||||
}
|
||||
else {
|
||||
s = (unsigned char *)_XawTextGetText(ctx, left, right);
|
||||
unsigned char *s = (unsigned char *)_XawTextGetText(ctx, left, right);
|
||||
/* only HT and NL control chars are allowed, strip out others */
|
||||
n = (long)strlen((char *)s);
|
||||
i = 0;
|
||||
long n = (long)strlen((char *)s);
|
||||
long i = 0, j;
|
||||
|
||||
for (j = 0; j < n; j++) {
|
||||
c = s[j];
|
||||
unsigned char c = s[j];
|
||||
if (((c >= 0x20) && c <= 0x7f)
|
||||
||(c >= 0xa0) || (c == XawTAB) || (c == XawLF)
|
||||
|| (c == XawESC)) {
|
||||
|
@ -1222,14 +1220,15 @@ static Bool
|
|||
LineAndXYForPosition(TextWidget ctx, XawTextPosition pos,
|
||||
int *line, int *x, int *y)
|
||||
{
|
||||
XawTextPosition linePos, endPos;
|
||||
Boolean visible;
|
||||
int realW, realH;
|
||||
|
||||
*line = 0;
|
||||
*x = ctx->text.left_margin;
|
||||
*y = ctx->text.margin.top + 1;
|
||||
if ((visible = IsPositionVisible(ctx, pos)) != False) {
|
||||
XawTextPosition linePos, endPos;
|
||||
int realW, realH;
|
||||
|
||||
*line = LineForPosition(ctx, pos);
|
||||
*y = ctx->text.lt.info[*line].y;
|
||||
linePos = ctx->text.lt.info[*line].position;
|
||||
|
@ -1252,12 +1251,11 @@ void
|
|||
_XawTextBuildLineTable(TextWidget ctx, XawTextPosition position,
|
||||
_XtBoolean force_rebuild)
|
||||
{
|
||||
Dimension height = 0;
|
||||
int lines = 0;
|
||||
Cardinal size;
|
||||
|
||||
if ((int)XtHeight(ctx) > VMargins(ctx)) {
|
||||
height = (Dimension)(XtHeight(ctx) - VMargins(ctx));
|
||||
Dimension height = (Dimension)(XtHeight(ctx) - VMargins(ctx));
|
||||
lines = XawTextSinkMaxLines(ctx->text.sink, height);
|
||||
}
|
||||
size = (Cardinal)(sizeof(XawTextLineTableEntry) * (size_t)(lines + 1));
|
||||
|
@ -1385,7 +1383,7 @@ _BuildLineTable(TextWidget ctx, XawTextPosition position, int line)
|
|||
if (lt->textWidth != (Cardinal)width) {
|
||||
if (lt->textWidth > (Cardinal)width)
|
||||
ctx->text.clear_to_eol = True;
|
||||
lt->textWidth = (unsigned)width;
|
||||
lt->textWidth = (Dimension)width;
|
||||
}
|
||||
y = (Position)(y + height);
|
||||
|
||||
|
@ -1486,9 +1484,11 @@ GetWidestLine(TextWidget ctx)
|
|||
void
|
||||
_XawTextSetScrollBars(TextWidget ctx)
|
||||
{
|
||||
float first, last, denom, widest;
|
||||
float first;
|
||||
|
||||
if (ctx->text.scroll_vert == XawtextScrollAlways) {
|
||||
float last;
|
||||
|
||||
if (ctx->text.lastPos == 0)
|
||||
first = 0.0;
|
||||
else
|
||||
|
@ -1504,7 +1504,10 @@ _XawTextSetScrollBars(TextWidget ctx)
|
|||
}
|
||||
|
||||
if (ctx->text.scroll_horiz == XawtextScrollAlways) {
|
||||
denom = (float)GetWidestLine(ctx);
|
||||
unsigned value = GetWidestLine(ctx);
|
||||
float denom = (float)value;
|
||||
float widest;
|
||||
|
||||
if (denom <= 0)
|
||||
denom = (float)((int)XtWidth(ctx) - RHMargins(ctx));
|
||||
if (denom <= 0)
|
||||
|
@ -1712,7 +1715,6 @@ XawTextScroll(TextWidget ctx, int vlines, int hpixels)
|
|||
else {
|
||||
update_from = lt->info[lt->lines - vlines].position;
|
||||
update_to = lt->info[lt->lines].position;
|
||||
y1 = lt->info[lt->lines - vlines].y;
|
||||
y2 = lt->info[vlines].y;
|
||||
DoCopyArea(ctx, ctx->text.r_margin.left, y2,
|
||||
(unsigned)vwidth, (unsigned)(lt->info[lt->lines].y - y2),
|
||||
|
@ -1762,10 +1764,11 @@ HJump(Widget w, XtPointer closure, XtPointer callData)
|
|||
{
|
||||
TextWidget ctx = (TextWidget)closure;
|
||||
float percent = *(float *)callData;
|
||||
unsigned value = GetWidestLine(ctx);
|
||||
long pixels;
|
||||
|
||||
pixels = ctx->text.left_margin -
|
||||
(ctx->text.r_margin.left - (int)(percent * (float)GetWidestLine(ctx)));
|
||||
(ctx->text.r_margin.left - (int)(percent * (float)value));
|
||||
|
||||
HScroll(w, (XtPointer)ctx, (XtPointer)pixels);
|
||||
}
|
||||
|
@ -1956,7 +1959,6 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
|
|||
TextWidget ctx = (TextWidget)w;
|
||||
Widget src = ctx->text.source;
|
||||
XawTextEditType edit_mode;
|
||||
Arg args[1];
|
||||
XawTextSelectionSalt *salt = NULL;
|
||||
XawTextSelection *s;
|
||||
|
||||
|
@ -1966,9 +1968,12 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
|
|||
|
||||
if (SrcCvtSel(src, selection, target, type, value, length, format))
|
||||
return (True);
|
||||
else {
|
||||
Arg args[1];
|
||||
|
||||
XtSetArg(args[0], XtNeditType, &edit_mode);
|
||||
XtGetValues(src, args, ONE);
|
||||
XtSetArg(args[0], XtNeditType, &edit_mode);
|
||||
XtGetValues(src, args, ONE);
|
||||
}
|
||||
|
||||
XmuConvertStandardSelection(w, ctx->text.time, selection,
|
||||
target, type, (XPointer*)&std_targets,
|
||||
|
@ -2045,20 +2050,21 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
|
|||
*length = strlen((char *)*value);
|
||||
}
|
||||
else {
|
||||
*value = XtMalloc(((size_t)(salt->length + 1) * sizeof(unsigned char)));
|
||||
*value = XtMalloc((Cardinal)((size_t)(salt->length + 1) * sizeof(unsigned char)));
|
||||
strcpy ((char *)*value, salt->contents);
|
||||
*length = (unsigned long)salt->length;
|
||||
}
|
||||
/* Got *value,*length, now in COMPOUND_TEXT format. */
|
||||
if (XawTextFormat(ctx, XawFmtWide) && *type == XA_STRING) {
|
||||
XTextProperty textprop;
|
||||
wchar_t **wlist;
|
||||
int count;
|
||||
XTextProperty textprop = {
|
||||
.encoding = XA_COMPOUND_TEXT(d),
|
||||
.value = (unsigned char *)*value,
|
||||
.nitems = strlen(*value),
|
||||
.format = 8
|
||||
};
|
||||
|
||||
textprop.encoding = XA_COMPOUND_TEXT(d);
|
||||
textprop.value = (unsigned char *)*value;
|
||||
textprop.nitems = strlen(*value);
|
||||
textprop.format = 8;
|
||||
if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count)
|
||||
< Success
|
||||
|| count < 1) {
|
||||
|
@ -2075,14 +2081,15 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
|
|||
*length = textprop.nitems;
|
||||
XwcFreeStringList(wlist);
|
||||
} else if (*type == XA_UTF8_STRING(d)) {
|
||||
XTextProperty textprop;
|
||||
char **list;
|
||||
int count;
|
||||
XTextProperty textprop = {
|
||||
.encoding = XA_COMPOUND_TEXT(d),
|
||||
.value = (unsigned char *)*value,
|
||||
.nitems = strlen(*value),
|
||||
.format = 8
|
||||
};
|
||||
|
||||
textprop.encoding = XA_COMPOUND_TEXT(d);
|
||||
textprop.value = (unsigned char *)*value;
|
||||
textprop.nitems = strlen(*value);
|
||||
textprop.format = 8;
|
||||
if (Xutf8TextPropertyToTextList(d, &textprop, &list, &count)
|
||||
< Success
|
||||
|| count < 1) {
|
||||
|
@ -2352,10 +2359,10 @@ _SetSelection(TextWidget ctx, XawTextPosition left, XawTextPosition right,
|
|||
|
||||
if (left < right) {
|
||||
Widget w = (Widget)ctx;
|
||||
int buffer;
|
||||
|
||||
while (count) {
|
||||
Atom selection = selections[--count];
|
||||
int buffer;
|
||||
|
||||
/*
|
||||
* If this is a cut buffer
|
||||
|
@ -2396,7 +2403,7 @@ _SetSelection(TextWidget ctx, XawTextPosition left, XawTextPosition right,
|
|||
while (len > max_len) {
|
||||
len -= max_len;
|
||||
tptr += max_len;
|
||||
amount = Min (len, max_len);
|
||||
amount = (unsigned) Min (len, max_len);
|
||||
XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0),
|
||||
selection, XA_STRING, 8, PropModeAppend,
|
||||
tptr, (int)amount);
|
||||
|
@ -2679,12 +2686,13 @@ OldDisplayText(Widget w, XawTextPosition left, XawTextPosition right)
|
|||
|
||||
TextWidget ctx = (TextWidget)w;
|
||||
int x, y, line;
|
||||
XawTextPosition start, end, last, final;
|
||||
XawTextPosition last;
|
||||
XmuScanline *scan;
|
||||
XmuSegment *seg;
|
||||
XmuArea *clip = NULL;
|
||||
Bool cleol = ctx->text.clear_to_eol;
|
||||
Bool has_selection = ctx->text.s.right > ctx->text.s.left;
|
||||
XawTextPosition start;
|
||||
|
||||
left = left < ctx->text.lt.top ? ctx->text.lt.top : left;
|
||||
|
||||
|
@ -2697,7 +2705,10 @@ OldDisplayText(Widget w, XawTextPosition left, XawTextPosition right)
|
|||
if (cleol)
|
||||
clip = XmuCreateArea();
|
||||
|
||||
for (start = left; start < right && line < ctx->text.lt.lines; line++) {
|
||||
for (start = left;
|
||||
start < right && line < ctx->text.lt.lines; line++) {
|
||||
XawTextPosition end, final;
|
||||
|
||||
if ((end = ctx->text.lt.info[line + 1].position) > right)
|
||||
end = right;
|
||||
|
||||
|
@ -2756,10 +2767,11 @@ DisplayText(Widget w, XawTextPosition left, XawTextPosition right)
|
|||
|
||||
TextWidget ctx = (TextWidget)w;
|
||||
int y, line;
|
||||
XawTextPosition from, to, lastPos;
|
||||
XawTextPosition lastPos;
|
||||
Bool cleol = ctx->text.clear_to_eol;
|
||||
Bool has_selection = ctx->text.s.right > ctx->text.s.left;
|
||||
XawTextPaintList *paint_list;
|
||||
XawTextPosition from;
|
||||
|
||||
left = left < ctx->text.lt.top ? ctx->text.lt.top : left;
|
||||
|
||||
|
@ -2773,8 +2785,11 @@ DisplayText(Widget w, XawTextPosition left, XawTextPosition right)
|
|||
|
||||
paint_list = ((TextSinkObject)ctx->text.sink)->text_sink.paint;
|
||||
|
||||
for (from = left; from < right && line < ctx->text.lt.lines; line++) {
|
||||
if ((to = ctx->text.lt.info[line + 1].position) > right)
|
||||
for (from = left;
|
||||
from < right && line < ctx->text.lt.lines; line++) {
|
||||
XawTextPosition to = ctx->text.lt.info[line + 1].position;
|
||||
|
||||
if (to > right)
|
||||
to = right;
|
||||
|
||||
if (to > lastPos)
|
||||
|
@ -2834,7 +2849,7 @@ static void
|
|||
DoSelection(TextWidget ctx, XawTextPosition pos, Time time, Bool motion)
|
||||
{
|
||||
XawTextPosition newLeft, newRight;
|
||||
XawTextSelectType newType, *sarray;
|
||||
XawTextSelectType newType;
|
||||
Widget src = ctx->text.source;
|
||||
|
||||
if (motion)
|
||||
|
@ -2842,7 +2857,8 @@ DoSelection(TextWidget ctx, XawTextPosition pos, Time time, Bool motion)
|
|||
else {
|
||||
if ((labs((long) time - (long) ctx->text.lasttime) < MULTI_CLICK_TIME)
|
||||
&& (pos >= ctx->text.s.left && pos <= ctx->text.s.right)) {
|
||||
sarray = ctx->text.sarray;
|
||||
XawTextSelectType *sarray = ctx->text.sarray;
|
||||
|
||||
for (; *sarray != XawselectNull && *sarray != ctx->text.s.type;
|
||||
sarray++)
|
||||
;
|
||||
|
@ -3062,7 +3078,7 @@ _XawTextClearAndCenterDisplay(TextWidget ctx)
|
|||
left_margin == ctx->text.left_margin) {
|
||||
int insert_line = LineForPosition(ctx, ctx->text.insertPos);
|
||||
int scroll_by = insert_line - (ctx->text.lt.lines >> 1);
|
||||
Boolean clear_to_eol = ctx->text.clear_to_eol;
|
||||
Boolean clear_to_eol;
|
||||
|
||||
XawTextScroll(ctx, scroll_by, 0);
|
||||
SinkClearToBG(ctx->text.sink, 0, 0, XtWidth(ctx), XtHeight(ctx));
|
||||
|
@ -3348,11 +3364,11 @@ CountLines(TextWidget ctx, XawTextPosition left, XawTextPosition right)
|
|||
if (ctx->text.wrap == XawtextWrapNever || left >= right)
|
||||
return (1);
|
||||
else {
|
||||
XawTextPosition tmp;
|
||||
int dim, lines = 0, wwidth = GetMaxTextWidth(ctx);
|
||||
|
||||
while (left < right) {
|
||||
tmp = left;
|
||||
XawTextPosition tmp = left;
|
||||
|
||||
XawTextSinkFindPosition(ctx->text.sink, left,
|
||||
ctx->text.left_margin,
|
||||
wwidth, ctx->text.wrap == XawtextWrapWord,
|
||||
|
|
|
@ -403,14 +403,14 @@ _SelectionReceived(Widget w, XtPointer client_data, Atom *selection _X_UNUSED,
|
|||
|
||||
StartAction(ctx, NULL);
|
||||
if (XawTextFormat(ctx, XawFmtWide)) {
|
||||
XTextProperty textprop;
|
||||
wchar_t **wlist;
|
||||
int count;
|
||||
|
||||
textprop.encoding = *type;
|
||||
textprop.value = (unsigned char *)value;
|
||||
textprop.nitems = strlen(value);
|
||||
textprop.format = 8;
|
||||
XTextProperty textprop = {
|
||||
.encoding = *type,
|
||||
.value = (unsigned char *)value,
|
||||
.nitems = strlen(value),
|
||||
.format = 8
|
||||
};
|
||||
|
||||
if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count)
|
||||
!= Success
|
||||
|
@ -421,7 +421,7 @@ _SelectionReceived(Widget w, XtPointer client_data, Atom *selection _X_UNUSED,
|
|||
fprintf(stderr, "Xaw Text Widget: An attempt was made to insert "
|
||||
"an illegal selection.\n");
|
||||
|
||||
textprop.value = (const unsigned char *)" >> ILLEGAL SELECTION << ";
|
||||
textprop.value = (unsigned char *)" >> ILLEGAL SELECTION << ";
|
||||
textprop.nitems = strlen((char *) textprop.value);
|
||||
if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count)
|
||||
!= Success
|
||||
|
@ -950,7 +950,6 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
|
|||
TextWidget ctx = (TextWidget)w;
|
||||
Widget src = ctx->text.source;
|
||||
XawTextEditType edit_mode;
|
||||
Arg args[1];
|
||||
XawTextSelectionSalt *salt = NULL;
|
||||
XawTextSelection *s;
|
||||
|
||||
|
@ -960,9 +959,12 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
|
|||
|
||||
if (SrcCvtSel(src, selection, target, type, value, length, format))
|
||||
return (True);
|
||||
else {
|
||||
Arg args[1];
|
||||
|
||||
XtSetArg(args[0], XtNeditType,&edit_mode);
|
||||
XtGetValues(src, args, 1);
|
||||
XtSetArg(args[0], XtNeditType,&edit_mode);
|
||||
XtGetValues(src, args, 1);
|
||||
}
|
||||
|
||||
XmuConvertStandardSelection(w, ctx->text.time, selection,
|
||||
target, type, (XPointer *)&std_targets,
|
||||
|
@ -1035,21 +1037,22 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
|
|||
*length = strlen(*value);
|
||||
}
|
||||
else {
|
||||
*value = XtMalloc(((size_t)(salt->length + 1) * sizeof(unsigned char)));
|
||||
*value = XtMalloc((Cardinal)((size_t)(salt->length + 1) * sizeof(unsigned char)));
|
||||
strcpy (*value, salt->contents);
|
||||
*length = (unsigned long)salt->length;
|
||||
}
|
||||
/* Got *value,*length, now in COMPOUND_TEXT format. */
|
||||
if (XawTextFormat(ctx, XawFmtWide)) {
|
||||
if (*type == XA_STRING) {
|
||||
XTextProperty textprop;
|
||||
wchar_t **wlist;
|
||||
int count;
|
||||
XTextProperty textprop = {
|
||||
.encoding = XA_COMPOUND_TEXT(d),
|
||||
.value = (unsigned char *)*value,
|
||||
.nitems = strlen(*value),
|
||||
.format = 8
|
||||
};
|
||||
|
||||
textprop.encoding = XA_COMPOUND_TEXT(d);
|
||||
textprop.value = (unsigned char *)*value;
|
||||
textprop.nitems = strlen(*value);
|
||||
textprop.format = 8;
|
||||
if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count)
|
||||
< Success
|
||||
|| count < 1) {
|
||||
|
@ -1067,14 +1070,15 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
|
|||
XwcFreeStringList((wchar_t**) wlist);
|
||||
}
|
||||
else if (*type == XA_UTF8_STRING(d)) {
|
||||
XTextProperty textprop;
|
||||
char **list;
|
||||
int count;
|
||||
XTextProperty textprop = {
|
||||
.encoding = XA_COMPOUND_TEXT(d),
|
||||
.value = (unsigned char *)*value,
|
||||
.nitems = strlen(*value),
|
||||
.format = 8
|
||||
};
|
||||
|
||||
textprop.encoding = XA_COMPOUND_TEXT(d);
|
||||
textprop.value = (unsigned char *)*value;
|
||||
textprop.nitems = strlen(*value);
|
||||
textprop.format = 8;
|
||||
if (Xutf8TextPropertyToTextList(d, &textprop, &list, &count)
|
||||
< Success
|
||||
|| count < 1) {
|
||||
|
@ -1194,7 +1198,7 @@ _LoseSelection(Widget w, Atom *selection, char **contents _X_UNUSED, int *length
|
|||
tail = kill_ring;
|
||||
kill_ring = kill_ring->next;
|
||||
}
|
||||
if (kill_ring->refcount == 0) {
|
||||
if (tail != NULL && kill_ring->refcount == 0) {
|
||||
--num_kill_rings;
|
||||
tail->next = NULL;
|
||||
XtFree(kill_ring->contents);
|
||||
|
@ -1289,16 +1293,24 @@ _DeleteOrKill(TextWidget ctx, XawTextPosition from, XawTextPosition to,
|
|||
if (!append)
|
||||
salt->contents = string;
|
||||
else {
|
||||
salt->contents = XtMalloc((length + size + 1));
|
||||
salt->contents = XtMalloc((Cardinal)(length + size + 1));
|
||||
if (from >= old_from) {
|
||||
strncpy(salt->contents, ring, (size_t)size);
|
||||
salt->contents[size] = '\0';
|
||||
if (ring != NULL) {
|
||||
strncpy(salt->contents, ring, (size_t)size);
|
||||
salt->contents[size] = '\0';
|
||||
} else {
|
||||
salt->contents[size = 0] = '\0';
|
||||
}
|
||||
strncat(salt->contents, string, (size_t)length);
|
||||
}
|
||||
else {
|
||||
strncpy(salt->contents, string, (size_t)length);
|
||||
salt->contents[length] = '\0';
|
||||
strncat(salt->contents, ring, (size_t)size);
|
||||
if (ring != NULL) {
|
||||
strncat(salt->contents, ring, (size_t)size);
|
||||
} else {
|
||||
size = 0;
|
||||
}
|
||||
}
|
||||
salt->contents[length + size] = '\0';
|
||||
XtFree(ring);
|
||||
|
@ -1330,7 +1342,7 @@ _DeleteOrKill(TextWidget ctx, XawTextPosition from, XawTextPosition to,
|
|||
text.firstPos = 0;
|
||||
|
||||
text.format = (unsigned long)_XawTextFormat(ctx);
|
||||
text.ptr = "";
|
||||
text.ptr = (char*)"";
|
||||
|
||||
if (_XawTextReplace(ctx, from, to, &text)) {
|
||||
XBell(XtDisplay(ctx), 50);
|
||||
|
@ -1399,7 +1411,8 @@ DeleteChar(Widget w, XEvent *event, XawTextScanDirection dir)
|
|||
short mul = MULT(ctx);
|
||||
|
||||
if (mul < 0) {
|
||||
ctx->text.mult = mul = (short)(-mul);
|
||||
mul = -mul;
|
||||
ctx->text.mult = mul;
|
||||
dir = dir == XawsdLeft ? XawsdRight : XawsdLeft;
|
||||
}
|
||||
DeleteOrKill(ctx, event, dir, XawstPositions, True, False);
|
||||
|
@ -1600,11 +1613,10 @@ StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right,
|
|||
|
||||
text.firstPos = 0;
|
||||
text.format = XawFmt8Bit;
|
||||
text.ptr = " ";
|
||||
text.ptr = (char*)" ";
|
||||
text.length = 1;
|
||||
|
||||
position = XawTextSourceRead(ctx->text.source, position,
|
||||
&block, (int)(right - left));
|
||||
XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left));
|
||||
done = False;
|
||||
space = False;
|
||||
/* convert tabs and returns to spaces */
|
||||
|
@ -1637,11 +1649,10 @@ StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right,
|
|||
done = True;
|
||||
}
|
||||
|
||||
text.ptr = "";
|
||||
text.ptr = (char*)"";
|
||||
text.length = 0;
|
||||
position = tmp = left;
|
||||
position = XawTextSourceRead(ctx->text.source, position,
|
||||
&block, (int)(right - left));
|
||||
XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left));
|
||||
ipos = ctx->text.insertPos;
|
||||
done = False;
|
||||
while (!done) {
|
||||
|
@ -1717,12 +1728,11 @@ Tabify(TextWidget ctx, XawTextPosition left, XawTextPosition right,
|
|||
int tab_index = 0, tab_column = 0, TAB_SIZE = DEFAULT_TAB_SIZE;
|
||||
|
||||
text.firstPos = 0;
|
||||
text.ptr = "\t";
|
||||
text.ptr = (char*)"\t";
|
||||
text.format = XawFmt8Bit;
|
||||
text.length = 1;
|
||||
|
||||
position = XawTextSourceRead(ctx->text.source, position,
|
||||
&block, (int)(right - left));
|
||||
XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left));
|
||||
ipos = ctx->text.insertPos;
|
||||
done = zero = False;
|
||||
if (tab_count)
|
||||
|
@ -1859,14 +1869,13 @@ Untabify(TextWidget ctx, XawTextPosition left, XawTextPosition right,
|
|||
short *char_tabs = sink->text_sink.char_tabs;
|
||||
int tab_count = sink->text_sink.tab_count;
|
||||
int tab_index = 0, tab_column = 0, tab_base = 0;
|
||||
static char *tabs = " ";
|
||||
static char *tabs = (char*)" ";
|
||||
|
||||
text.firstPos = 0;
|
||||
text.format = XawFmt8Bit;
|
||||
text.ptr = tabs;
|
||||
|
||||
position = XawTextSourceRead(ctx->text.source, position,
|
||||
&block, (int)(right - left));
|
||||
XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left));
|
||||
ipos = ctx->text.insertPos;
|
||||
done = False;
|
||||
zero = False;
|
||||
|
@ -2182,7 +2191,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level,
|
|||
position = tmp;
|
||||
if (position > left && position - left > ctx->text.left_column
|
||||
&& position != right) {
|
||||
text.ptr = "\n";
|
||||
text.ptr = (char*)"\n";
|
||||
text.length = 1;
|
||||
CHECK_SAVE();
|
||||
if (_XawTextReplace(ctx, position, position + 1, &text))
|
||||
|
@ -2235,7 +2244,6 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level,
|
|||
}
|
||||
XawStackFree(text.ptr, buf);
|
||||
position += count;
|
||||
right += count;
|
||||
if (num_pos) {
|
||||
for (cpos = 0; cpos < num_pos; cpos++)
|
||||
if (pos[cpos] > left)
|
||||
|
@ -2297,7 +2305,6 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level,
|
|||
inc += ii;
|
||||
}
|
||||
position += count;
|
||||
right += count;
|
||||
XawStackFree(text.ptr, buf);
|
||||
}
|
||||
break;
|
||||
|
@ -2322,18 +2329,17 @@ Indent(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _
|
|||
TextWidget ctx = (TextWidget)w;
|
||||
TextSrcObject src = (TextSrcObject)ctx->text.source;
|
||||
XawTextPosition from, to, tmp, end = 0, *pos, *posbuf[32];
|
||||
char buf[32];
|
||||
XawTextBlock text;
|
||||
int i, spaces = MULT(ctx);
|
||||
char *lbuf = NULL, *rbuf;
|
||||
unsigned llen = 0, rlen, size;
|
||||
unsigned llen = 0;
|
||||
Bool undo = src->textSrc.enable_undo && src->textSrc.undo_state == False;
|
||||
Bool format = ctx->text.auto_fill
|
||||
&& ctx->text.left_column < ctx->text.right_column;
|
||||
|
||||
text.firstPos = 0;
|
||||
text.format = XawFmt8Bit;
|
||||
text.ptr = "";
|
||||
text.ptr = (char*)"";
|
||||
|
||||
StartAction(ctx, event);
|
||||
|
||||
|
@ -2370,6 +2376,8 @@ Indent(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _
|
|||
tmp = from;
|
||||
|
||||
if (spaces > 0) {
|
||||
char buf[32];
|
||||
|
||||
text.ptr = XawStackAlloc((unsigned)spaces, buf);
|
||||
for (i = 0; i < spaces; i++)
|
||||
text.ptr[i] = ' ';
|
||||
|
@ -2424,7 +2432,9 @@ Indent(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _
|
|||
Tabify(ctx, from, to, pos, (int)src->textSrc.num_text, NULL);
|
||||
|
||||
if (undo) {
|
||||
rlen = (unsigned)(llen + (ctx->text.lastPos - end));
|
||||
unsigned rlen = (unsigned)(llen + (ctx->text.lastPos - end));
|
||||
unsigned size;
|
||||
|
||||
rbuf = _XawTextGetText(ctx, from, from + rlen);
|
||||
|
||||
text.format = (unsigned long)_XawTextFormat(ctx);
|
||||
|
@ -2601,7 +2611,7 @@ InsertNewLineAndIndent(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n
|
|||
char *ptr;
|
||||
|
||||
length = (int)strlen(line_to_ip);
|
||||
text.ptr = XtMalloc(((size_t)(2 + length) * sizeof(char)));
|
||||
text.ptr = XtMalloc((Cardinal)((size_t)(2 + length) * sizeof(char)));
|
||||
ptr = text.ptr;
|
||||
ptr[0] = XawLF;
|
||||
strcpy(++ptr, line_to_ip);
|
||||
|
@ -3020,7 +3030,7 @@ AutoFill(TextWidget ctx)
|
|||
return;
|
||||
|
||||
text.format = XawFmt8Bit;
|
||||
text.ptr = "\n";
|
||||
text.ptr = (char*)"\n";
|
||||
}
|
||||
text.length = 1;
|
||||
text.firstPos = 0;
|
||||
|
@ -3295,7 +3305,7 @@ InsertString(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||
|
||||
StartAction(ctx, event);
|
||||
for (i = (int)*num_params; i; i--, params++) { /* DO FOR EACH PARAMETER */
|
||||
text.ptr = IfHexConvertHexElseReturnParam(*params, &text.length);
|
||||
text.ptr = IfHexConvertHexElseReturnParam((char*) *params, &text.length);
|
||||
|
||||
if (text.length == 0)
|
||||
continue;
|
||||
|
@ -3370,7 +3380,7 @@ DisplayCaret(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||
|
||||
if (*num_params > 0) { /* default arg is "True" */
|
||||
XrmValue from, to;
|
||||
from.size = (unsigned)strlen(from.addr = params[0]);
|
||||
from.size = (unsigned)strlen(from.addr = (char*)params[0]);
|
||||
XtConvert(w, XtRString, &from, XtRBoolean, &to);
|
||||
|
||||
if (to.addr != NULL)
|
||||
|
@ -3416,7 +3426,6 @@ Numeric(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||
return;
|
||||
}
|
||||
else if (mult == 32767) {
|
||||
mult = ctx->text.mult = (short)(- (params[0][0] - '0'));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
@ -3520,19 +3529,20 @@ static XawTextPosition
|
|||
StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to,
|
||||
XawTextPosition *pos, int num_pos)
|
||||
{
|
||||
XawTextPosition startPos, endPos, eop_begin, eop_end, temp;
|
||||
XawTextPosition startPos, endPos, eop_begin, eop_end;
|
||||
Widget src = ctx->text.source;
|
||||
XawTextBlock text;
|
||||
char *buf;
|
||||
static wchar_t wc_two_spaces[3];
|
||||
int idx;
|
||||
|
||||
/* Initialize our TextBlock with two spaces. */
|
||||
text.firstPos = 0;
|
||||
text.format = (unsigned long)_XawTextFormat(ctx);
|
||||
if (text.format == XawFmt8Bit)
|
||||
text.ptr= " ";
|
||||
else {
|
||||
if (text.format == XawFmt8Bit) {
|
||||
text.ptr= (char*)" ";
|
||||
} else {
|
||||
static wchar_t wc_two_spaces[3];
|
||||
|
||||
wc_two_spaces[0] = _Xaw_atowc(XawSP);
|
||||
wc_two_spaces[1] = _Xaw_atowc(XawSP);
|
||||
wc_two_spaces[2] = 0;
|
||||
|
@ -3540,11 +3550,13 @@ StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to,
|
|||
}
|
||||
|
||||
/* Strip out CR's. */
|
||||
eop_begin = eop_end = startPos = endPos = from;
|
||||
eop_begin = eop_end = startPos = from;
|
||||
|
||||
/* CONSTCOND */
|
||||
while (TRUE) {
|
||||
endPos=SrcScan(src, startPos, XawstEOL, XawsdRight, 1, False);
|
||||
XawTextPosition temp;
|
||||
|
||||
endPos = SrcScan(src, startPos, XawstEOL, XawsdRight, 1, False);
|
||||
|
||||
temp = SrcScan(src, endPos, XawstWhiteSpace, XawsdLeft, 1, False);
|
||||
temp = SrcScan(src, temp, XawstWhiteSpace, XawsdRight,1, False);
|
||||
|
@ -3626,19 +3638,19 @@ static void
|
|||
InsertNewCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to,
|
||||
XawTextPosition *pos, int num_pos)
|
||||
{
|
||||
XawTextPosition startPos, endPos, space, eol;
|
||||
XawTextPosition startPos;
|
||||
XawTextBlock text;
|
||||
int i, width, height, len, wwidth, idx;
|
||||
char *buf;
|
||||
static wchar_t wide_CR[2];
|
||||
int i, width, height, wwidth, idx;
|
||||
|
||||
text.firstPos = 0;
|
||||
text.length = 1;
|
||||
text.format = (unsigned long)_XawTextFormat(ctx);
|
||||
|
||||
if (text.format == XawFmt8Bit)
|
||||
text.ptr = "\n";
|
||||
else {
|
||||
if (text.format == XawFmt8Bit) {
|
||||
text.ptr = (char*)"\n";
|
||||
} else {
|
||||
static wchar_t wide_CR[2];
|
||||
|
||||
wide_CR[0] = _Xaw_atowc(XawLF);
|
||||
wide_CR[1] = 0;
|
||||
text.ptr = (char*)wide_CR;
|
||||
|
@ -3657,6 +3669,10 @@ InsertNewCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to,
|
|||
|
||||
/* CONSTCOND */
|
||||
while (TRUE) {
|
||||
int len;
|
||||
char *buf;
|
||||
XawTextPosition endPos, space, eol;
|
||||
|
||||
XawTextSinkFindPosition(ctx->text.sink, startPos,
|
||||
(int)ctx->text.r_margin.left, wwidth,
|
||||
True, &eol, &width, &height);
|
||||
|
@ -3735,14 +3751,12 @@ FormRegion(TextWidget ctx, XawTextPosition from, XawTextPosition to,
|
|||
ctx->text.justify == XawjustifyFull) {
|
||||
Untabify(ctx, from, to, pos, num_pos, NULL);
|
||||
to += ctx->text.lastPos - len;
|
||||
len = ctx->text.insertPos;
|
||||
(void)BlankLine((Widget)ctx, from, &inc);
|
||||
if (from + inc >= to)
|
||||
return (XawEditDone);
|
||||
}
|
||||
if (!StripSpaces(ctx, from + inc, to, pos, num_pos, NULL))
|
||||
return (XawReplaceError);
|
||||
to += ctx->text.lastPos - len;
|
||||
|
||||
FormatText(ctx, from, ctx->text.justify != XawjustifyFull, pos, num_pos);
|
||||
}
|
||||
|
|
|
@ -61,6 +61,12 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include <X11/Xaw/Toggle.h>
|
||||
#include "XawI18n.h"
|
||||
|
||||
#ifdef O_CLOEXEC
|
||||
#define FOPEN_CLOEXEC "e"
|
||||
#else
|
||||
#define FOPEN_CLOEXEC ""
|
||||
#endif
|
||||
|
||||
static _Xconst char* INSERT_FILE = "Enter Filename:";
|
||||
static _Xconst char* SEARCH_LABEL_1 = "Use <Tab> to change fields.";
|
||||
static _Xconst char* SEARCH_LABEL_2 = "Use ^q<Tab> for <Tab>.";
|
||||
|
@ -305,7 +311,8 @@ InsertFileNamed(Widget tw, String str)
|
|||
XawTextBlock text;
|
||||
XawTextPosition pos;
|
||||
|
||||
if (str == NULL || strlen(str) == 0 || (file = fopen(str, "r")) == NULL)
|
||||
if (str == NULL || strlen(str) == 0 ||
|
||||
(file = fopen(str, "r" FOPEN_CLOEXEC)) == NULL)
|
||||
return (False);
|
||||
|
||||
pos = XawTextGetInsertionPoint(tw);
|
||||
|
|
|
@ -198,6 +198,9 @@ TextSinkClassRec textSinkClassRec = {
|
|||
MaxHeight, /* MaxHeight */
|
||||
SetTabs, /* SetTabs */
|
||||
GetCursorBounds, /* GetCursorBounds */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -423,10 +426,10 @@ ClearToBackground(Widget w, int x, int y,
|
|||
TextWidget xaw = (TextWidget)XtParent(w);
|
||||
Position x1, y1, x2, y2;
|
||||
|
||||
x1 = (XawMax(x, xaw->text.r_margin.left));
|
||||
y1 = (XawMax(y, xaw->text.r_margin.top));
|
||||
x2 = (XawMin(x + (int)width, (int)XtWidth(xaw) - xaw->text.r_margin.right));
|
||||
y2 = (XawMin(y + (int)height, (int)XtHeight(xaw) - xaw->text.r_margin.bottom));
|
||||
x1 = (Position) (XawMax(x, xaw->text.r_margin.left));
|
||||
y1 = (Position) (XawMax(y, xaw->text.r_margin.top));
|
||||
x2 = (Position) (XawMin(x + (int)width, (int)XtWidth(xaw) - xaw->text.r_margin.right));
|
||||
y2 = (Position) (XawMin(y + (int)height, (int)XtHeight(xaw) - xaw->text.r_margin.bottom));
|
||||
|
||||
x = (int)x1;
|
||||
y = (int)y1;
|
||||
|
@ -939,15 +942,6 @@ XawTextSinkPreparePaint(Widget w, int y, int line, XawTextPosition from,
|
|||
(w, y, line, from, to, highlight);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
PreparePaint(Widget w, int y, int line, XawTextPosition from, XawTextPosition to,
|
||||
Bool highlight)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
XawTextSinkDoPaint(Widget w)
|
||||
{
|
||||
|
@ -956,14 +950,6 @@ XawTextSinkDoPaint(Widget w)
|
|||
(*cclass->text_sink_class.extension->DoPaint)(w);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
DoPaint(Widget w)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
Bool
|
||||
XawTextSinkEndPaint(Widget w)
|
||||
{
|
||||
|
|
|
@ -231,6 +231,9 @@ TextSrcClassRec textSrcClassRec = {
|
|||
Search, /* Search */
|
||||
SetSelection, /* SetSelection */
|
||||
ConvertSelection, /* ConvertSelection */
|
||||
#ifndef OLDXAW
|
||||
NULL, /* extension */
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -238,7 +241,7 @@ WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec;
|
|||
|
||||
static XrmQuark QRead, QAppend, QEdit;
|
||||
#ifndef OLDXAW
|
||||
static char *SrcNL = "\n";
|
||||
static char *SrcNL = (char*)"\n";
|
||||
static wchar_t SrcWNL[2];
|
||||
#endif
|
||||
|
||||
|
@ -732,6 +735,7 @@ XawTextSourceReplace(Widget w, XawTextPosition left,
|
|||
Bool enable_undo;
|
||||
XawTextPosition start, end;
|
||||
int i, error, lines = 0;
|
||||
Cardinal j;
|
||||
|
||||
if (src->textSrc.edit_mode == XawtextRead)
|
||||
return (XawEditError);
|
||||
|
@ -751,9 +755,9 @@ XawTextSourceReplace(Widget w, XawTextPosition left,
|
|||
if (left < right) {
|
||||
Widget ctx = NULL;
|
||||
|
||||
for (i = 0; i < src->textSrc.num_text; i++)
|
||||
if (XtIsSubclass(src->textSrc.text[i], textWidgetClass)) {
|
||||
ctx = src->textSrc.text[i];
|
||||
for (j = 0; j < src->textSrc.num_text; j++)
|
||||
if (XtIsSubclass(src->textSrc.text[j], textWidgetClass)) {
|
||||
ctx = src->textSrc.text[j];
|
||||
break;
|
||||
}
|
||||
l_state->buffer = _XawTextGetText((TextWidget)ctx, left, right);
|
||||
|
@ -823,8 +827,8 @@ XawTextSourceReplace(Widget w, XawTextPosition left,
|
|||
*/
|
||||
if (left > LARGE_VALUE) {
|
||||
start = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 2, False);
|
||||
for (i = 0; i < src->textSrc.num_text; i++) {
|
||||
TextWidget tw = (TextWidget)src->textSrc.text[i];
|
||||
for (j = 0; j < src->textSrc.num_text; j++) {
|
||||
TextWidget tw = (TextWidget)src->textSrc.text[j];
|
||||
|
||||
if (left <= tw->text.lt.top &&
|
||||
left + block->length - (right - left) > tw->text.lt.top)
|
||||
|
@ -983,7 +987,6 @@ XawTextSourceReplace(Widget w, XawTextPosition left,
|
|||
src->textSrc.changed = True;
|
||||
|
||||
if (error == XawEditDone) {
|
||||
XawTextPropertyInfo info;
|
||||
XawTextAnchor *anchor;
|
||||
|
||||
/* find anchor and index */
|
||||
|
@ -1051,7 +1054,7 @@ XawTextSourceReplace(Widget w, XawTextPosition left,
|
|||
offset = anchor->position + entity->offset + entity->length;
|
||||
|
||||
if (offset > right) {
|
||||
entity->length = (XawMin(entity->length, offset - right));
|
||||
entity->length = (Cardinal) (XawMin(entity->length, offset - right));
|
||||
goto exit_anchor_loop;
|
||||
}
|
||||
|
||||
|
@ -1183,10 +1186,15 @@ exit_anchor_loop:
|
|||
}
|
||||
}
|
||||
|
||||
info.left = left;
|
||||
info.right = right;
|
||||
info.block = block;
|
||||
XtCallCallbacks(w, XtNpropertyCallback, &info);
|
||||
{
|
||||
XawTextPropertyInfo info = {
|
||||
.left = left,
|
||||
.right = right,
|
||||
.block = block
|
||||
};
|
||||
|
||||
XtCallCallbacks(w, XtNpropertyCallback, &info);
|
||||
}
|
||||
|
||||
TellSourceChanged(src, left, right, block, lines);
|
||||
/* Call callbacks, we have changed the buffer */
|
||||
|
@ -1349,7 +1357,6 @@ FreeUndoBuffer(XawTextUndo *undo)
|
|||
static void
|
||||
UndoGC(XawTextUndo *undo)
|
||||
{
|
||||
unsigned i;
|
||||
XawTextUndoList *head = undo->head, *redo = head->redo;
|
||||
|
||||
if (head == undo->pointer || head == undo->end_mark
|
||||
|
@ -1362,6 +1369,8 @@ UndoGC(XawTextUndo *undo)
|
|||
|
||||
--head->left->refcount;
|
||||
if (--head->right->refcount == 0) {
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < undo->num_undo; i+= 2)
|
||||
if (head->left == undo->undo[i] || head->left == undo->undo[i+1]) {
|
||||
if (head->left == undo->undo[i+1]) {
|
||||
|
@ -1673,13 +1682,15 @@ XawTextAnchor *
|
|||
XawTextSourceFindAnchor(Widget w, XawTextPosition position)
|
||||
{
|
||||
TextSrcObject src = (TextSrcObject)w;
|
||||
int i = 0, left, right, nmemb = src->textSrc.num_anchors;
|
||||
XawTextAnchor *anchor, **anchors = src->textSrc.anchors;
|
||||
int left, right, nmemb = src->textSrc.num_anchors;
|
||||
XawTextAnchor **anchors = src->textSrc.anchors;
|
||||
|
||||
left = 0;
|
||||
right = nmemb - 1;
|
||||
while (left <= right) {
|
||||
anchor = anchors[i = (left + right) >> 1];
|
||||
int i = (left + right) >> 1;
|
||||
XawTextAnchor *anchor = anchors[i];
|
||||
|
||||
if (anchor->position == position)
|
||||
return (anchor);
|
||||
else if (position < anchor->position)
|
||||
|
@ -1701,7 +1712,6 @@ XawTextSourceAnchorAndEntity(Widget w, XawTextPosition position,
|
|||
{
|
||||
XawTextAnchor *anchor = XawTextSourceFindAnchor(w, position);
|
||||
XawTextEntity *pentity, *entity;
|
||||
XawTextPosition offset;
|
||||
Bool next_anchor = True, retval = False;
|
||||
|
||||
if (anchor->cache && anchor->position + anchor->cache->offset +
|
||||
|
@ -1710,7 +1720,7 @@ XawTextSourceAnchorAndEntity(Widget w, XawTextPosition position,
|
|||
else
|
||||
pentity = entity = anchor->entities;
|
||||
while (entity) {
|
||||
offset = anchor->position + entity->offset;
|
||||
XawTextPosition offset = anchor->position + entity->offset;
|
||||
|
||||
if (offset > position) {
|
||||
retval = next_anchor = False;
|
||||
|
@ -1899,7 +1909,6 @@ XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right
|
|||
XawTextAnchor *anchor = XawTextSourceFindAnchor(w, left);
|
||||
XawTextEntity *entity, *eprev, *enext;
|
||||
XawTextPosition offset;
|
||||
int length;
|
||||
|
||||
while (anchor && anchor->entities == NULL)
|
||||
anchor = XawTextSourceRemoveAnchor(w, anchor);
|
||||
|
@ -1928,7 +1937,7 @@ XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right
|
|||
|
||||
offset = anchor->position + entity->offset;
|
||||
if (offset <= left) {
|
||||
length = (XawMin(entity->length, left - offset));
|
||||
int length = (int) (XawMin(entity->length, left - offset));
|
||||
|
||||
if (length <= 0) {
|
||||
enext = entity->next;
|
||||
|
@ -1963,7 +1972,7 @@ XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right
|
|||
if (offset > right) {
|
||||
anchor->cache = NULL;
|
||||
entity->offset = XawMax(entity->offset, right - anchor->position);
|
||||
entity->length = (XawMin(entity->length, offset - right));
|
||||
entity->length = (Cardinal) (XawMin(entity->length, offset - right));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -330,13 +330,13 @@ XawTipExpose(Widget w, XEvent *event, Region region)
|
|||
Position ksy = (Position)tip->tip.top_margin;
|
||||
XFontSetExtents *ext = XExtentsOfFontSet(tip->tip.fontset);
|
||||
|
||||
ksy = (ksy + XawAbs(ext->max_ink_extent.y));
|
||||
ksy = (Position) (ksy + XawAbs(ext->max_ink_extent.y));
|
||||
|
||||
while ((nl = strchr(label, '\n')) != NULL) {
|
||||
XmbDrawString(XtDisplay(w), XtWindow(w), tip->tip.fontset,
|
||||
gc, tip->tip.left_margin, ksy, label,
|
||||
(int)(nl - label));
|
||||
ksy = (ksy + ext->max_ink_extent.height);
|
||||
ksy = (Position) (ksy + ext->max_ink_extent.height);
|
||||
label = nl + 1;
|
||||
}
|
||||
len = (int)strlen(label);
|
||||
|
@ -380,12 +380,13 @@ XawTipSetValues(Widget current, Widget request _X_UNUSED, Widget cnew,
|
|||
|
||||
if (curtip->tip.font->fid != newtip->tip.font->fid ||
|
||||
curtip->tip.foreground != newtip->tip.foreground) {
|
||||
XGCValues values;
|
||||
XGCValues values = {
|
||||
.foreground = newtip->tip.foreground,
|
||||
.background = newtip->core.background_pixel,
|
||||
.font = newtip->tip.font->fid,
|
||||
.graphics_exposures = False
|
||||
};
|
||||
|
||||
values.foreground = newtip->tip.foreground;
|
||||
values.background = newtip->core.background_pixel;
|
||||
values.font = newtip->tip.font->fid;
|
||||
values.graphics_exposures = False;
|
||||
XtReleaseGC(cnew, curtip->tip.gc);
|
||||
newtip->tip.gc = XtAllocateGC(cnew, 0, GCForeground | GCBackground |
|
||||
GCFont | GCGraphicsExposures, &values,
|
||||
|
@ -454,10 +455,10 @@ TipLayout(XawTipInfo *info)
|
|||
XTextWidth16(fs, (_Xconst XChar2b*)label, (int)(strlen(label) >> 1)) :
|
||||
XTextWidth(fs, label, (int)strlen(label));
|
||||
}
|
||||
XtWidth(info->tip) = (width + info->tip->tip.left_margin +
|
||||
info->tip->tip.right_margin);
|
||||
XtHeight(info->tip) = (height + info->tip->tip.top_margin +
|
||||
info->tip->tip.bottom_margin);
|
||||
XtWidth(info->tip) = (Dimension) (width + info->tip->tip.left_margin +
|
||||
info->tip->tip.right_margin);
|
||||
XtHeight(info->tip) = (Dimension) (height + info->tip->tip.top_margin +
|
||||
info->tip->tip.bottom_margin);
|
||||
}
|
||||
|
||||
#define DEFAULT_TIP_Y_OFFSET 12
|
||||
|
@ -526,7 +527,7 @@ FindTipInfo(Widget w)
|
|||
Screen *screen = XtScreenOfObject(w);
|
||||
|
||||
if (tip == NULL)
|
||||
return (first_tip = tip = CreateTipInfo(w));
|
||||
return (first_tip = CreateTipInfo(w));
|
||||
|
||||
for (ptip = tip; tip; ptip = tip, tip = tip->next)
|
||||
if (tip->screen == screen)
|
||||
|
|
|
@ -159,6 +159,9 @@ ToggleClassRec toggleClassRec = {
|
|||
/* simple */
|
||||
{
|
||||
XtInheritChangeSensitive, /* change_sensitive */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* label */
|
||||
{
|
||||
|
@ -489,7 +492,6 @@ void
|
|||
XawToggleChangeRadioGroup(Widget w, Widget radio_group)
|
||||
{
|
||||
ToggleWidget tw = (ToggleWidget)w;
|
||||
RadioGroup *group;
|
||||
|
||||
RemoveFromRadioGroup(w);
|
||||
|
||||
|
@ -502,7 +504,9 @@ XawToggleChangeRadioGroup(Widget w, Widget radio_group)
|
|||
XawToggleUnsetCurrent(radio_group);
|
||||
|
||||
if (radio_group != NULL) {
|
||||
if ((group = GetRadioGroup(radio_group)) == NULL)
|
||||
RadioGroup *group = GetRadioGroup(radio_group);
|
||||
|
||||
if (group == NULL)
|
||||
CreateRadioGroup(w, radio_group);
|
||||
else
|
||||
AddToRadioGroup(group, w);
|
||||
|
@ -611,12 +615,13 @@ XawToggleSetCurrent(Widget radio_group, XtPointer radio_data)
|
|||
void
|
||||
XawToggleUnsetCurrent(Widget radio_group)
|
||||
{
|
||||
ToggleWidgetClass cclass;
|
||||
ToggleWidget local_tog = (ToggleWidget)radio_group;
|
||||
|
||||
/* Special Case no radio group */
|
||||
|
||||
if (local_tog->command.set) {
|
||||
ToggleWidgetClass cclass;
|
||||
|
||||
cclass = (ToggleWidgetClass)local_tog->core.widget_class;
|
||||
cclass->toggle_class.Unset(radio_group, NULL, NULL, NULL);
|
||||
Notify(radio_group, NULL, NULL, NULL);
|
||||
|
|
|
@ -206,9 +206,6 @@ WidgetClass treeWidgetClass = (WidgetClass) &treeClassRec;
|
|||
static void
|
||||
initialize_dimensions(Dimension **listp, int *sizep, int n)
|
||||
{
|
||||
int i;
|
||||
Dimension *l;
|
||||
|
||||
if (!*listp) {
|
||||
*listp = (Dimension *) XtCalloc ((unsigned int) n,
|
||||
(unsigned int) sizeof(Dimension));
|
||||
|
@ -221,9 +218,14 @@ initialize_dimensions(Dimension **listp, int *sizep, int n)
|
|||
if (!*listp) {
|
||||
*sizep = 0;
|
||||
return;
|
||||
} else {
|
||||
int i;
|
||||
Dimension *l;
|
||||
|
||||
for (i = *sizep, l = (*listp) + i; i < n; i++, l++)
|
||||
*l = 0;
|
||||
*sizep = n;
|
||||
}
|
||||
for (i = *sizep, l = (*listp) + i; i < n; i++, l++) *l = 0;
|
||||
*sizep = n;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -282,7 +284,8 @@ static void
|
|||
delete_node(Widget parent, Widget node)
|
||||
{
|
||||
TreeConstraints pc;
|
||||
int pos, i;
|
||||
int pos;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Make sure the parent exists.
|
||||
|
@ -587,6 +590,8 @@ static void
|
|||
XawTreeRedisplay(Widget gw, XEvent *event _X_UNUSED, Region region _X_UNUSED)
|
||||
{
|
||||
TreeWidget tw = (TreeWidget) gw;
|
||||
Cardinal i;
|
||||
int j;
|
||||
|
||||
#ifndef OLDXAW
|
||||
if (tw->tree.display_list)
|
||||
|
@ -597,8 +602,6 @@ XawTreeRedisplay(Widget gw, XEvent *event _X_UNUSED, Region region _X_UNUSED)
|
|||
* If the Tree widget is visible, visit each managed child.
|
||||
*/
|
||||
if (tw->core.visible) {
|
||||
Cardinal i;
|
||||
int j;
|
||||
Display *dpy = XtDisplay (tw);
|
||||
Window w = XtWindow (tw);
|
||||
|
||||
|
@ -722,10 +725,10 @@ static void
|
|||
compute_bounding_box_subtree(TreeWidget tree, Widget w, int depth)
|
||||
{
|
||||
TreeConstraints tc = TREE_CONSTRAINT(w); /* info attached to all kids */
|
||||
int i;
|
||||
Bool horiz = IsHorizontal (tree);
|
||||
Dimension newwidth, newheight;
|
||||
Dimension bw2 = (Dimension)(w->core.border_width * 2);
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Set the max-size per level.
|
||||
|
@ -792,10 +795,9 @@ compute_bounding_box_subtree(TreeWidget tree, Widget w, int depth)
|
|||
static void
|
||||
set_positions(TreeWidget tw, Widget w, int level)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (w) {
|
||||
TreeConstraints tc = TREE_CONSTRAINT(w);
|
||||
int i;
|
||||
|
||||
if (level > 0) {
|
||||
/*
|
||||
|
@ -832,15 +834,13 @@ static void
|
|||
arrange_subtree(TreeWidget tree, Widget w, int depth, int x, int y)
|
||||
{
|
||||
TreeConstraints tc = TREE_CONSTRAINT(w); /* info attached to all kids */
|
||||
TreeConstraints firstcc, lastcc;
|
||||
int i;
|
||||
int newx, newy;
|
||||
Bool horiz = IsHorizontal (tree);
|
||||
Widget child = NULL;
|
||||
Dimension tmp;
|
||||
Dimension bw2 = (Dimension)(w->core.border_width * 2);
|
||||
Bool relayout = True;
|
||||
|
||||
int i;
|
||||
|
||||
/*
|
||||
* If no children, then just lay out where requested.
|
||||
|
@ -903,10 +903,10 @@ arrange_subtree(TreeWidget tree, Widget w, int depth, int x, int y)
|
|||
/*
|
||||
* now layout parent between first and last children
|
||||
*/
|
||||
if (relayout) {
|
||||
if (relayout && (child != NULL)) {
|
||||
Position adjusted;
|
||||
firstcc = TREE_CONSTRAINT (tc->tree.children[0]);
|
||||
lastcc = TREE_CONSTRAINT (child);
|
||||
TreeConstraints firstcc = TREE_CONSTRAINT (tc->tree.children[0]);
|
||||
TreeConstraints lastcc = TREE_CONSTRAINT (child);
|
||||
|
||||
/* Adjustments are disallowed if they result in a position above
|
||||
* or to the left of the originally requested position, because
|
||||
|
|
|
@ -204,7 +204,7 @@ externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = {
|
|||
}
|
||||
};
|
||||
|
||||
#if !defined(__UNIXOS2__) && !defined(__APPLE__)
|
||||
#if !defined(__APPLE__)
|
||||
externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass =
|
||||
(WidgetClass) (&vendorShellClassRec);
|
||||
#endif
|
||||
|
@ -280,16 +280,16 @@ XawCvtCompoundTextToString(Display *dpy, XrmValuePtr args _X_UNUSED, Cardinal *n
|
|||
XrmValue *fromVal, XrmValue *toVal,
|
||||
XtPointer *cvt_data _X_UNUSED)
|
||||
{
|
||||
XTextProperty prop;
|
||||
char **list;
|
||||
int count;
|
||||
static char *mbs = NULL;
|
||||
int len;
|
||||
|
||||
prop.value = (unsigned char *)fromVal->addr;
|
||||
prop.encoding = XA_COMPOUND_TEXT(dpy);
|
||||
prop.format = 8;
|
||||
prop.nitems = fromVal->size;
|
||||
XTextProperty prop = {
|
||||
.value = (unsigned char *)fromVal->addr,
|
||||
.encoding = XA_COMPOUND_TEXT(dpy),
|
||||
.format = 8,
|
||||
.nitems = fromVal->size
|
||||
};
|
||||
|
||||
if(XmbTextPropertyToTextList(dpy, &prop, &list, &count) < Success) {
|
||||
XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
|
||||
|
@ -330,11 +330,11 @@ XawVendorShellClassPartInit(WidgetClass cclass)
|
|||
CompositeClassExtension ext;
|
||||
VendorShellWidgetClass vsclass = (VendorShellWidgetClass)cclass;
|
||||
|
||||
if ((ext = (CompositeClassExtension)
|
||||
XtGetClassExtension (cclass,
|
||||
XtOffsetOf(CompositeClassRec,
|
||||
composite_class.extension),
|
||||
NULLQUARK, 1L, (Cardinal) 0)) == NULL) {
|
||||
if (((CompositeClassExtension)
|
||||
XtGetClassExtension (cclass,
|
||||
XtOffsetOf(CompositeClassRec,
|
||||
composite_class.extension),
|
||||
NULLQUARK, 1L, (Cardinal) 0)) == NULL) {
|
||||
ext = (CompositeClassExtension) XtNew (CompositeClassExtensionRec);
|
||||
if (ext != NULL) {
|
||||
ext->next_extension = vsclass->composite_class.extension;
|
||||
|
@ -348,8 +348,8 @@ XawVendorShellClassPartInit(WidgetClass cclass)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(__osf__) || defined(__UNIXOS2__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__)
|
||||
/* stupid OSF/1 shared libraries have the wrong semantics */
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__)
|
||||
/* shared libraries on these platforms have the wrong semantics */
|
||||
/* symbols do not get resolved external to the shared library */
|
||||
void _XawFixupVendorShell()
|
||||
{
|
||||
|
|
|
@ -216,6 +216,9 @@ ViewportClassRec viewportClassRec = {
|
|||
/* form */
|
||||
{
|
||||
Layout, /* layout */
|
||||
#ifndef OLDXAW
|
||||
NULL,
|
||||
#endif
|
||||
},
|
||||
/* viewport */
|
||||
{
|
||||
|
@ -441,10 +444,6 @@ XawViewportChangeManaged(Widget widget)
|
|||
((FormWidget)w, XtWidth(w), XtHeight(w), True /* True? */);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
(*Superclass->composite_class.change_managed)(widget);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -472,19 +471,18 @@ RedrawThumbs(ViewportWidget w)
|
|||
static void
|
||||
SendReport(ViewportWidget w, unsigned int changed)
|
||||
{
|
||||
XawPannerReport rep;
|
||||
|
||||
if (w->viewport.report_callbacks) {
|
||||
Widget child = w->viewport.child;
|
||||
Widget clip = w->viewport.clip;
|
||||
|
||||
rep.changed = changed;
|
||||
rep.slider_x = (Position) -XtX(child); /* child is canvas */
|
||||
rep.slider_y = (Position) -XtY(child); /* clip is slider */
|
||||
rep.slider_width = XtWidth(clip);
|
||||
rep.slider_height = XtHeight(clip);
|
||||
rep.canvas_width = XtWidth(child);
|
||||
rep.canvas_height = XtHeight(child);
|
||||
XawPannerReport rep = {
|
||||
.changed = changed,
|
||||
.slider_x = (Position) -XtX(child), /* child is canvas */
|
||||
.slider_y = (Position) -XtY(child), /* clip is slider */
|
||||
.slider_width = XtWidth(clip),
|
||||
.slider_height = XtHeight(clip),
|
||||
.canvas_width = XtWidth(child),
|
||||
.canvas_height = XtHeight(child)
|
||||
};
|
||||
XtCallCallbackList((Widget)w, w->viewport.report_callbacks,
|
||||
(XtPointer)&rep);
|
||||
}
|
||||
|
|
|
@ -76,20 +76,6 @@ _Xaw_atowc(unsigned char c)
|
|||
return (wc);
|
||||
}
|
||||
|
||||
#ifdef NCR
|
||||
int
|
||||
_Xaw_iswspace(wchar_t w)
|
||||
{
|
||||
int ret = 0;
|
||||
wchar_t s = _Xaw_atowc(' ');
|
||||
|
||||
if (s == w)
|
||||
ret = 1;
|
||||
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
_Xaw_iswalnum(wchar_t ch)
|
||||
{
|
||||
|
|
|
@ -38,29 +38,6 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#if defined(AIXV3) || defined(__SCO__)
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifdef NCR
|
||||
#define iswspace(c) _Xaw_iswspace(c)
|
||||
int _Xaw_iswspace
|
||||
(
|
||||
wchar_t c
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef sony
|
||||
#ifndef SVR4
|
||||
#include <jctype.h>
|
||||
#define iswspace(c) jisspace(c)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef QNX4
|
||||
#define toascii( c ) ((unsigned)(c) & 0x007f)
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef USE_XWCHAR_STRING
|
||||
|
@ -103,10 +80,16 @@ wchar_t _Xaw_atowc
|
|||
);
|
||||
|
||||
#ifndef HAS_ISW_FUNCS
|
||||
#include <ctype.h>
|
||||
#ifndef iswspace
|
||||
#define iswspace(c) (isascii(c) && isspace(toascii(c)))
|
||||
#endif
|
||||
# include <ctype.h>
|
||||
# ifndef isascii
|
||||
# define isascii(c) ((unsigned char)(c) < 127)
|
||||
# endif
|
||||
# ifndef toascii
|
||||
# define toascii(c) ((c) & 0x7f)
|
||||
# endif
|
||||
# ifndef iswspace
|
||||
# define iswspace(c) (isascii(c) && isspace(toascii(c)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(iswalnum) && !defined(HAVE_ISWALNUM)
|
||||
|
|
|
@ -80,6 +80,18 @@ in this Software without prior written authorization from The Open Group.
|
|||
|
||||
#define Offset(field) (XtOffsetOf(XawIcTablePart, field))
|
||||
|
||||
#define ADD_IC(value) ic_a[ic_cnt] = (XPointer) value; ic_cnt++
|
||||
#define USE_IC(count) (ic_cnt > count) ? ic_a[count] : NULL
|
||||
#define END_IC() ic_a[ic_cnt] = (XPointer) NULL
|
||||
|
||||
#define ADD_PE(value) pe_a[pe_cnt] = (XPointer) value; pe_cnt++
|
||||
#define USE_PE(count) (pe_cnt > count) ? pe_a[count] : NULL
|
||||
#define END_PE() pe_a[pe_cnt] = (XPointer) NULL
|
||||
|
||||
#define ADD_ST(value) st_a[st_cnt] = (XPointer) value; st_cnt++
|
||||
#define USE_ST(count) (st_cnt > count) ? st_a[count] : NULL
|
||||
#define END_ST() st_a[st_cnt] = (XPointer) NULL
|
||||
|
||||
/*****************************************************
|
||||
*
|
||||
* Forward reference prototypes
|
||||
|
@ -264,18 +276,19 @@ GetInputStyleOfIC(XawVendorShellExtPart *ve)
|
|||
static void
|
||||
ConfigureCB(Widget w, XtPointer closure _X_UNUSED, XEvent *event, Boolean *unused _X_UNUSED)
|
||||
{
|
||||
XawIcTableList p;
|
||||
XawVendorShellExtPart *ve;
|
||||
VendorShellWidget vw;
|
||||
XVaNestedList pe_attr;
|
||||
XRectangle pe_area;
|
||||
XawTextMargin *margin;
|
||||
|
||||
if (event->type != ConfigureNotify) return;
|
||||
|
||||
if ((vw = SearchVendorShell(w)) == NULL) return;
|
||||
|
||||
if ((ve = GetExtPart(vw)) != NULL) {
|
||||
XawIcTableList p;
|
||||
XVaNestedList pe_attr;
|
||||
XRectangle pe_area;
|
||||
XawTextMargin *margin;
|
||||
|
||||
if (IsSharedIC(ve)) return;
|
||||
if ((ve->im.xim == NULL) ||
|
||||
((p = GetIcTableShared(w, ve)) == NULL) ||
|
||||
|
@ -314,20 +327,6 @@ static Widget SetErrCnxt(Widget w, XIM xim)
|
|||
return(contextErrData->widget);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static Widget
|
||||
GetErrCnxt(XIM error_im)
|
||||
{
|
||||
contextErrDataRec *contextErrData;
|
||||
|
||||
if (XFindContext(XDisplayOfIM(error_im), (Window)error_im, errContext,
|
||||
(XPointer*)&contextErrData)) {
|
||||
return(NULL);
|
||||
}
|
||||
return(contextErrData->widget);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
CloseIM(XawVendorShellExtPart *ve)
|
||||
{
|
||||
|
@ -426,31 +425,15 @@ VendorShellDestroyed(Widget w, XtPointer cl_data _X_UNUSED, XtPointer ca_data _X
|
|||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
IOErrorHandler(XIM error_im)
|
||||
{
|
||||
VendorShellWidget vw;
|
||||
XawVendorShellExtPart * ve;
|
||||
|
||||
if ((vw = (VendorShellWidget)GetErrCnxt(error_im)) == NULL
|
||||
|| (ve = GetExtPart(vw)) == NULL) return(0);
|
||||
|
||||
DestroyAllIM(ve);
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Attempt to open an input method
|
||||
*/
|
||||
|
||||
static void
|
||||
OpenIM(XawVendorShellExtPart *ve)
|
||||
{
|
||||
int i;
|
||||
_Xconst char *s, *ns, *end;
|
||||
char *p, *pbuf, buf[32];
|
||||
char *p, buf[32];
|
||||
XIM xim = NULL;
|
||||
XIMStyles *xim_styles;
|
||||
XIMStyle input_style = 0;
|
||||
|
@ -462,6 +445,8 @@ OpenIM(XawVendorShellExtPart *ve)
|
|||
if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
|
||||
xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL);
|
||||
} else {
|
||||
char *pbuf;
|
||||
|
||||
/* no fragment can be longer than the whole string */
|
||||
Cardinal len = (Cardinal)strlen (ve->im.input_method) + 5;
|
||||
|
||||
|
@ -496,7 +481,7 @@ OpenIM(XawVendorShellExtPart *ve)
|
|||
if (pbuf != buf) XtFree (pbuf);
|
||||
}
|
||||
if (xim == NULL) {
|
||||
if ((p = XSetLocaleModifiers("")) != NULL) {
|
||||
if (XSetLocaleModifiers("") != NULL) {
|
||||
xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -513,7 +498,7 @@ OpenIM(XawVendorShellExtPart *ve)
|
|||
return;
|
||||
}
|
||||
found = False;
|
||||
for(ns = s = ve->im.preedit_type; s && !found;) {
|
||||
for (s = ve->im.preedit_type; s && !found;) {
|
||||
while (*s && isspace((unsigned char)*s)) s++;
|
||||
if (!*s) break;
|
||||
if ((ns = end = strchr(s, ',')) == NULL)
|
||||
|
@ -720,18 +705,18 @@ SizeNegotiation(XawIcTableList p, unsigned int width, unsigned int height)
|
|||
|
||||
if (p->input_style & XIMPreeditArea) {
|
||||
pe_attr = XVaCreateNestedList(0, XNAreaNeeded, &pe_area_needed, NULL);
|
||||
ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++;
|
||||
ADD_IC(XNPreeditAttributes);
|
||||
ADD_IC(pe_attr);
|
||||
}
|
||||
if (p->input_style & XIMStatusArea) {
|
||||
st_attr = XVaCreateNestedList(0, XNAreaNeeded, &st_area_needed, NULL);
|
||||
ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++;
|
||||
ADD_IC(XNStatusAttributes);
|
||||
ADD_IC(st_attr);
|
||||
}
|
||||
ic_a[ic_cnt] = (XPointer) NULL;
|
||||
END_IC();
|
||||
|
||||
if (ic_cnt > 0) {
|
||||
XGetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], NULL);
|
||||
XGetICValues(p->xic, USE_IC(0), USE_IC(1), USE_IC(2), USE_IC(3), NULL);
|
||||
if (pe_attr) XFree(pe_attr);
|
||||
if (st_attr) XFree(st_attr);
|
||||
if (p->xic == NULL) {
|
||||
|
@ -752,8 +737,8 @@ SizeNegotiation(XawIcTableList p, unsigned int width, unsigned int height)
|
|||
|
||||
XFree(st_area_needed);
|
||||
st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL);
|
||||
ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++;
|
||||
ADD_IC(XNStatusAttributes);
|
||||
ADD_IC(st_attr);
|
||||
}
|
||||
if (p->input_style & XIMPreeditArea) {
|
||||
if (p->input_style & XIMStatusArea) {
|
||||
|
@ -767,11 +752,11 @@ SizeNegotiation(XawIcTableList p, unsigned int width, unsigned int height)
|
|||
XFree(pe_area_needed);
|
||||
pe_area.y = (short)(height - pe_area.height);
|
||||
pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
|
||||
ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++;
|
||||
ADD_IC(XNPreeditAttributes);
|
||||
ADD_IC(pe_attr);
|
||||
}
|
||||
ic_a[ic_cnt] = (XPointer) NULL;
|
||||
XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], NULL);
|
||||
END_IC();
|
||||
XSetICValues(p->xic, USE_IC(0), USE_IC(1), USE_IC(2), USE_IC(3), NULL);
|
||||
if (pe_attr) XFree(pe_attr);
|
||||
if (st_attr) XFree(st_attr);
|
||||
if (p->xic == NULL) {
|
||||
|
@ -791,7 +776,6 @@ CreateIC(Widget w, XawVendorShellExtPart *ve)
|
|||
XPointer ic_a[20], pe_a[20], st_a[20];
|
||||
Dimension height = 0;
|
||||
int ic_cnt = 0, pe_cnt = 0, st_cnt = 0;
|
||||
XawTextMargin *margin;
|
||||
|
||||
if (!XtIsRealized(w)) return;
|
||||
if (((ve->im.xim == NULL) || (p = GetIcTableShared(w, ve)) == NULL) ||
|
||||
|
@ -804,10 +788,10 @@ CreateIC(Widget w, XawVendorShellExtPart *ve)
|
|||
|
||||
if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) {
|
||||
if (p->flg & CIFontSet) {
|
||||
pe_a[pe_cnt] = (XPointer) XNFontSet; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) p->font_set; pe_cnt++;
|
||||
st_a[st_cnt] = (XPointer) XNFontSet; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) p->font_set; st_cnt++;
|
||||
ADD_PE(XNFontSet);
|
||||
ADD_PE(p->font_set);
|
||||
ADD_ST(XNFontSet);
|
||||
ADD_ST(p->font_set);
|
||||
if (p->font_set) {
|
||||
height = (Dimension)(maxAscentOfFontSet(p->font_set)
|
||||
+ maxDescentOfFontSet(p->font_set));
|
||||
|
@ -815,39 +799,43 @@ CreateIC(Widget w, XawVendorShellExtPart *ve)
|
|||
height = (Dimension)SetVendorShellHeight(ve, height);
|
||||
}
|
||||
if (p->flg & CIFg) {
|
||||
pe_a[pe_cnt] = (XPointer) XNForeground; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) p->foreground; pe_cnt++;
|
||||
st_a[st_cnt] = (XPointer) XNForeground; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) p->foreground; st_cnt++;
|
||||
ADD_PE(XNForeground);
|
||||
ADD_PE(p->foreground);
|
||||
ADD_ST(XNForeground);
|
||||
ADD_ST(p->foreground);
|
||||
}
|
||||
if (p->flg & CIBg) {
|
||||
pe_a[pe_cnt] = (XPointer) XNBackground; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) p->background; pe_cnt++;
|
||||
st_a[st_cnt] = (XPointer) XNBackground; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) p->background; st_cnt++;
|
||||
ADD_PE(XNBackground);
|
||||
ADD_PE(p->background);
|
||||
ADD_ST(XNBackground);
|
||||
ADD_ST(p->background);
|
||||
}
|
||||
if (p->flg & CIBgPixmap) {
|
||||
pe_a[pe_cnt] = (XPointer) XNBackgroundPixmap; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) p->bg_pixmap; pe_cnt++;
|
||||
st_a[st_cnt] = (XPointer) XNBackgroundPixmap; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) p->bg_pixmap; st_cnt++;
|
||||
ADD_PE(XNBackgroundPixmap);
|
||||
ADD_PE(p->bg_pixmap);
|
||||
ADD_ST(XNBackgroundPixmap);
|
||||
ADD_ST(p->bg_pixmap);
|
||||
}
|
||||
if (p->flg & CILineS) {
|
||||
pe_a[pe_cnt] = (XPointer) XNLineSpace; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) p->line_spacing; pe_cnt++;
|
||||
st_a[st_cnt] = (XPointer) XNLineSpace; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) p->line_spacing; st_cnt++;
|
||||
ADD_PE(XNLineSpace);
|
||||
ADD_PE(p->line_spacing);
|
||||
ADD_ST(XNLineSpace);
|
||||
ADD_ST(p->line_spacing);
|
||||
}
|
||||
}
|
||||
|
||||
if (p->input_style & XIMPreeditArea) {
|
||||
pe_area.x = 0;
|
||||
pe_area.y = (short)(ve->parent->core.height - height);
|
||||
pe_area.width = ve->parent->core.width;
|
||||
pe_area.height = height;
|
||||
pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) &pe_area; pe_cnt++;
|
||||
ADD_PE(XNArea);
|
||||
ADD_PE(&pe_area);
|
||||
}
|
||||
|
||||
if (p->input_style & XIMPreeditPosition) {
|
||||
XawTextMargin *margin;
|
||||
|
||||
pe_area.x = 0;
|
||||
pe_area.y = 0;
|
||||
pe_area.width = w->core.width;
|
||||
|
@ -857,59 +845,58 @@ CreateIC(Widget w, XawVendorShellExtPart *ve)
|
|||
pe_area.y = (short)(pe_area.y + margin->top);
|
||||
pe_area.width = (unsigned short)(pe_area.width - (margin->left + margin->right - 1));
|
||||
pe_area.height = (unsigned short)(pe_area.height - (margin->top + margin->bottom - 1));
|
||||
pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) &pe_area; pe_cnt++;
|
||||
ADD_PE(XNArea);
|
||||
ADD_PE(&pe_area);
|
||||
if (p->flg & CICursorP) {
|
||||
_XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y);
|
||||
} else {
|
||||
position.x = position.y = 0;
|
||||
}
|
||||
pe_a[pe_cnt] = (XPointer) XNSpotLocation; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) &position; pe_cnt++;
|
||||
ADD_PE(XNSpotLocation);
|
||||
ADD_PE(&position);
|
||||
}
|
||||
if (p->input_style & XIMStatusArea) {
|
||||
st_area.x = 0;
|
||||
st_area.y = (short)(ve->parent->core.height - height);
|
||||
st_area.width = ve->parent->core.width;
|
||||
st_area.height = height;
|
||||
st_a[st_cnt] = (XPointer) XNArea; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) &st_area; st_cnt++;
|
||||
ADD_ST(XNArea);
|
||||
ADD_ST(&st_area);
|
||||
}
|
||||
|
||||
ic_a[ic_cnt] = (XPointer) XNInputStyle; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) p->input_style; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) XNClientWindow; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) XtWindow(ve->parent); ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) XNFocusWindow; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) XtWindow(w); ic_cnt++;
|
||||
ADD_IC(XNInputStyle);
|
||||
ADD_IC(p->input_style);
|
||||
ADD_IC(XNClientWindow);
|
||||
ADD_IC(XtWindow(ve->parent));
|
||||
ADD_IC(XNFocusWindow);
|
||||
ADD_IC(XtWindow(w));
|
||||
|
||||
if (pe_cnt > 0) {
|
||||
pe_a[pe_cnt] = (XPointer) NULL;
|
||||
pe_attr = XVaCreateNestedList(0, pe_a[0], pe_a[1], pe_a[2], pe_a[3],
|
||||
pe_a[4], pe_a[5], pe_a[6], pe_a[7], pe_a[8],
|
||||
pe_a[9], pe_a[10], pe_a[11], pe_a[12],
|
||||
pe_a[13], pe_a[14], pe_a[15], pe_a[16],
|
||||
pe_a[17], pe_a[18], NULL);
|
||||
ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++;
|
||||
END_PE();
|
||||
pe_attr = XVaCreateNestedList(0, USE_PE(0), USE_PE(1), USE_PE(2),
|
||||
USE_PE(3), USE_PE(4), USE_PE(5),
|
||||
USE_PE(6), USE_PE(7), USE_PE(8),
|
||||
USE_PE(9), USE_PE(10), USE_PE(11),
|
||||
USE_PE(12), USE_PE(13), USE_PE(14),
|
||||
USE_PE(15), NULL);
|
||||
ADD_IC(XNPreeditAttributes);
|
||||
ADD_IC(pe_attr);
|
||||
}
|
||||
|
||||
if (st_cnt > 0) {
|
||||
st_a[st_cnt] = (XPointer) NULL;
|
||||
st_attr = XVaCreateNestedList(0, st_a[0], st_a[1], st_a[2], st_a[3],
|
||||
st_a[4], st_a[5], st_a[6], st_a[7], st_a[8],
|
||||
st_a[9], st_a[10], st_a[11], st_a[12],
|
||||
st_a[13], st_a[14], st_a[15], st_a[16],
|
||||
st_a[17], st_a[18], NULL);
|
||||
ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++;
|
||||
END_ST();
|
||||
st_attr = XVaCreateNestedList(0, USE_ST(0), USE_ST(1), USE_ST(2),
|
||||
USE_ST(3), USE_ST(4), USE_ST(5),
|
||||
USE_ST(6), USE_ST(7), USE_ST(8),
|
||||
USE_ST(9), USE_ST(10), USE_ST(11), NULL);
|
||||
ADD_IC(XNStatusAttributes);
|
||||
ADD_IC(st_attr);
|
||||
}
|
||||
ic_a[ic_cnt] = (XPointer) NULL;
|
||||
END_IC();
|
||||
|
||||
p->xic = XCreateIC(ve->im.xim, ic_a[0], ic_a[1], ic_a[2], ic_a[3],
|
||||
ic_a[4], ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9],
|
||||
ic_a[10], ic_a[11], ic_a[12], ic_a[13], ic_a[14],
|
||||
ic_a[15], ic_a[16], ic_a[17], ic_a[18], NULL);
|
||||
p->xic = XCreateIC(ve->im.xim, USE_IC(0), USE_IC(1), USE_IC(2), USE_IC(3),
|
||||
USE_IC(4), USE_IC(5), USE_IC(6), USE_IC(7), USE_IC(8),
|
||||
USE_IC(9), NULL);
|
||||
if (pe_attr) XtFree(pe_attr);
|
||||
if (st_attr) XtFree(st_attr);
|
||||
|
||||
|
@ -963,46 +950,46 @@ SetICValues(Widget w, XawVendorShellExtPart *ve, Bool focus)
|
|||
|
||||
if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) {
|
||||
if (p->flg & CIFontSet) {
|
||||
pe_a[pe_cnt] = (XPointer) XNFontSet; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) p->font_set; pe_cnt++;
|
||||
st_a[st_cnt] = (XPointer) XNFontSet; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) p->font_set; st_cnt++;
|
||||
ADD_PE(XNFontSet);
|
||||
ADD_PE(p->font_set);
|
||||
ADD_ST(XNFontSet);
|
||||
ADD_ST(p->font_set);
|
||||
if (p->font_set) {
|
||||
height = maxAscentOfFontSet(p->font_set)
|
||||
+ maxDescentOfFontSet(p->font_set);
|
||||
+ maxDescentOfFontSet(p->font_set);
|
||||
}
|
||||
height = (int)SetVendorShellHeight(ve, (unsigned)height);
|
||||
SetVendorShellHeight(ve, (unsigned)height);
|
||||
}
|
||||
if (p->flg & CIFg) {
|
||||
pe_a[pe_cnt] = (XPointer) XNForeground; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) p->foreground; pe_cnt++;
|
||||
st_a[st_cnt] = (XPointer) XNForeground; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) p->foreground; st_cnt++;
|
||||
ADD_PE(XNForeground);
|
||||
ADD_PE(p->foreground);
|
||||
ADD_ST(XNForeground);
|
||||
ADD_ST(p->foreground);
|
||||
}
|
||||
if (p->flg & CIBg) {
|
||||
pe_a[pe_cnt] = (XPointer) XNBackground; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) p->background; pe_cnt++;
|
||||
st_a[st_cnt] = (XPointer) XNBackground; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) p->background; st_cnt++;
|
||||
ADD_PE(XNBackground);
|
||||
ADD_PE(p->background);
|
||||
ADD_ST(XNBackground);
|
||||
ADD_ST(p->background);
|
||||
}
|
||||
if (p->flg & CIBgPixmap) {
|
||||
pe_a[pe_cnt] = (XPointer) XNBackgroundPixmap; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) p->bg_pixmap; pe_cnt++;
|
||||
st_a[st_cnt] = (XPointer) XNBackgroundPixmap; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) p->bg_pixmap; st_cnt++;
|
||||
ADD_PE(XNBackgroundPixmap);
|
||||
ADD_PE(p->bg_pixmap);
|
||||
ADD_ST(XNBackgroundPixmap);
|
||||
ADD_ST(p->bg_pixmap);
|
||||
}
|
||||
if (p->flg & CILineS) {
|
||||
pe_a[pe_cnt] = (XPointer) XNLineSpace; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) p->line_spacing; pe_cnt++;
|
||||
st_a[st_cnt] = (XPointer) XNLineSpace; st_cnt++;
|
||||
st_a[st_cnt] = (XPointer) p->line_spacing; st_cnt++;
|
||||
ADD_PE(XNLineSpace);
|
||||
ADD_PE(p->line_spacing);
|
||||
ADD_ST(XNLineSpace);
|
||||
ADD_ST(p->line_spacing);
|
||||
}
|
||||
}
|
||||
if (p->input_style & XIMPreeditPosition) {
|
||||
if (p->flg & CICursorP) {
|
||||
_XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y);
|
||||
pe_a[pe_cnt] = (XPointer) XNSpotLocation; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) &position; pe_cnt++;
|
||||
ADD_PE(XNSpotLocation);
|
||||
ADD_PE(&position);
|
||||
}
|
||||
}
|
||||
if (IsSharedIC(ve)) {
|
||||
|
@ -1016,41 +1003,38 @@ SetICValues(Widget w, XawVendorShellExtPart *ve, Bool focus)
|
|||
pe_area.y = (short)(pe_area.y + margin->top);
|
||||
pe_area.width = (unsigned short)(pe_area.width - (margin->left + margin->right - 1));
|
||||
pe_area.height = (unsigned short)(pe_area.height - (margin->top + margin->bottom - 1));
|
||||
pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++;
|
||||
pe_a[pe_cnt] = (XPointer) &pe_area; pe_cnt++;
|
||||
ADD_PE(XNArea);
|
||||
ADD_PE(&pe_area);
|
||||
}
|
||||
}
|
||||
|
||||
if (pe_cnt > 0) {
|
||||
pe_a[pe_cnt] = (XPointer) NULL;
|
||||
pe_attr = XVaCreateNestedList(0, pe_a[0], pe_a[1], pe_a[2], pe_a[3],
|
||||
pe_a[4], pe_a[5], pe_a[6], pe_a[7],
|
||||
pe_a[8], pe_a[9], pe_a[10], pe_a[11],
|
||||
pe_a[12], pe_a[13], pe_a[14], pe_a[15],
|
||||
pe_a[16], pe_a[17], pe_a[18], NULL);
|
||||
ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++;
|
||||
END_PE();
|
||||
pe_attr = XVaCreateNestedList(0, USE_PE(0), USE_PE(1), USE_PE(2),
|
||||
USE_PE(3), USE_PE(4), USE_PE(5),
|
||||
USE_PE(6), USE_PE(7), USE_PE(8),
|
||||
USE_PE(9), USE_PE(10), USE_PE(11),
|
||||
USE_PE(12), USE_PE(13), NULL);
|
||||
ADD_IC(XNPreeditAttributes);
|
||||
ADD_IC(pe_attr);
|
||||
}
|
||||
if (st_cnt > 0) {
|
||||
st_a[st_cnt] = (XPointer) NULL;
|
||||
st_attr = XVaCreateNestedList(0, st_a[0], st_a[1], st_a[2], st_a[3],
|
||||
st_a[4], st_a[5], st_a[6], st_a[7],
|
||||
st_a[8], st_a[9], st_a[10], st_a[11],
|
||||
st_a[12], st_a[13], st_a[14], st_a[15],
|
||||
st_a[16], st_a[17], st_a[18], NULL);
|
||||
ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++;
|
||||
END_ST();
|
||||
st_attr = XVaCreateNestedList(0, USE_ST(0), USE_ST(1), USE_ST(2),
|
||||
USE_ST(3), USE_ST(4), USE_ST(5),
|
||||
USE_ST(6), USE_ST(7), USE_ST(8),
|
||||
USE_ST(9), NULL);
|
||||
ADD_IC(XNStatusAttributes);
|
||||
ADD_IC(st_attr);
|
||||
}
|
||||
if (focus == TRUE) {
|
||||
ic_a[ic_cnt] = (XPointer) XNFocusWindow; ic_cnt++;
|
||||
ic_a[ic_cnt] = (XPointer) XtWindow(w); ic_cnt++;
|
||||
ADD_IC(XNFocusWindow);
|
||||
ADD_IC(XtWindow(w));
|
||||
}
|
||||
if (ic_cnt > 0) {
|
||||
ic_a[ic_cnt] = (XPointer) NULL;
|
||||
XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4],
|
||||
ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9], ic_a[10],
|
||||
ic_a[11], ic_a[12], ic_a[13], ic_a[14], ic_a[15],
|
||||
ic_a[16], ic_a[17], ic_a[18], NULL);
|
||||
END_IC();
|
||||
XSetICValues(p->xic, USE_IC(0), USE_IC(1), USE_IC(2), USE_IC(3),
|
||||
USE_IC(4), USE_IC(5), NULL);
|
||||
if (pe_attr) XtFree(pe_attr);
|
||||
if (st_attr) XtFree(st_attr);
|
||||
}
|
||||
|
@ -1085,13 +1069,13 @@ CurrentSharedIcTable(XawVendorShellExtPart *ve)
|
|||
static void
|
||||
SetICFocus(Widget w, XawVendorShellExtPart *ve)
|
||||
{
|
||||
XawIcTableList p, pp;
|
||||
XawIcTableList p;
|
||||
|
||||
if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) ||
|
||||
(p->xic == NULL)) return;
|
||||
|
||||
if (IsSharedIC(ve)) {
|
||||
pp = CurrentSharedIcTable(ve);
|
||||
XawIcTableList pp = CurrentSharedIcTable(ve);
|
||||
if (pp == NULL || pp->widget != w) {
|
||||
SharedICChangeFocusWindow(w, ve, p);
|
||||
}
|
||||
|
@ -1232,10 +1216,12 @@ UnsetFocus(Widget inwidg)
|
|||
{
|
||||
XawVendorShellExtPart *ve;
|
||||
VendorShellWidget vw;
|
||||
XawIcTableList p;
|
||||
|
||||
if ((vw = SearchVendorShell(inwidg)) == NULL) return;
|
||||
|
||||
if ((ve = GetExtPart(vw)) != NULL) {
|
||||
XawIcTableList p;
|
||||
|
||||
if ((p = GetIcTableShared(inwidg, ve)) == NULL) return;
|
||||
if (p->flg & CIICFocus) {
|
||||
p->flg &= (unsigned long)(~CIICFocus);
|
||||
|
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright 1991, 1994, 1998 The Open Group
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
*/
|
||||
|
||||
#if defined(SUNSHLIB) && !defined(SHAREDCODE)
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <X11/IntrinsicP.h>
|
||||
#include <X11/Xaw/AsciiSinkP.h>
|
||||
#include <X11/Xaw/AsciiSrcP.h>
|
||||
#include <X11/Xaw/AsciiTextP.h>
|
||||
#include <X11/Xaw/MultiSinkP.h>
|
||||
#include <X11/Xaw/MultiSrcP.h>
|
||||
#include <X11/Xaw/BoxP.h>
|
||||
#include <X11/Xaw/CommandP.h>
|
||||
#include <X11/Xaw/DialogP.h>
|
||||
#include <X11/Xaw/FormP.h>
|
||||
#include <X11/Xaw/GripP.h>
|
||||
#include <X11/Xaw/LabelP.h>
|
||||
#include <X11/Xaw/ListP.h>
|
||||
#include <X11/Xaw/MenuButtoP.h>
|
||||
#include <X11/Xaw/PanedP.h>
|
||||
#include <X11/Xaw/PannerP.h>
|
||||
#include <X11/Xaw/PortholeP.h>
|
||||
#include <X11/Xaw/RepeaterP.h>
|
||||
#include <X11/Xaw/ScrollbarP.h>
|
||||
#include <X11/Xaw/SimpleP.h>
|
||||
#include <X11/Xaw/SimpleMenP.h>
|
||||
#include <X11/Xaw/SmeP.h>
|
||||
#include <X11/Xaw/SmeBSBP.h>
|
||||
#include <X11/Xaw/SmeLineP.h>
|
||||
#include <X11/Xaw/StripCharP.h>
|
||||
#include <X11/Xaw/TextP.h>
|
||||
#include <X11/Xaw/TextSinkP.h>
|
||||
#include <X11/Xaw/TextSrcP.h>
|
||||
#include <X11/Xaw/ToggleP.h>
|
||||
#include <X11/Xaw/TreeP.h>
|
||||
#include <X11/VendorP.h>
|
||||
#include <X11/Xaw/ViewportP.h>
|
||||
|
||||
extern AsciiSinkClassRec asciiSinkClassRec;
|
||||
WidgetClass asciiSinkObjectClass = (WidgetClass)&asciiSinkClassRec;
|
||||
|
||||
extern AsciiSrcClassRec asciiSrcClassRec;
|
||||
WidgetClass asciiSrcObjectClass = (WidgetClass)&asciiSrcClassRec;
|
||||
|
||||
extern AsciiTextClassRec asciiTextClassRec;
|
||||
WidgetClass asciiTextWidgetClass = (WidgetClass)&asciiTextClassRec;
|
||||
|
||||
#ifdef ASCII_STRING
|
||||
extern AsciiStringClassRec asciiStringClassRec;
|
||||
WidgetClass asciiStringWidgetClass = (WidgetClass)&asciiStringClassRec;
|
||||
#endif
|
||||
|
||||
#ifdef ASCII_DISK
|
||||
extern AsciiDiskClassRec asciiDiskClassRec;
|
||||
WidgetClass asciiDiskWidgetClass = (WidgetClass)&asciiDiskClassRec;
|
||||
#endif
|
||||
|
||||
extern MultiSinkClassRec multiSinkClassRec;
|
||||
WidgetClass multiSinkObjectClass = (WidgetClass)&multiSinkClassRec;
|
||||
|
||||
extern MultiSrcClassRec multiSrcClassRec;
|
||||
WidgetClass multiSrcObjectClass = (WidgetClass)&multiSrcClassRec;
|
||||
|
||||
extern BoxClassRec boxClassRec;
|
||||
WidgetClass boxWidgetClass = (WidgetClass)&boxClassRec;
|
||||
|
||||
extern CommandClassRec commandClassRec;
|
||||
WidgetClass commandWidgetClass = (WidgetClass) &commandClassRec;
|
||||
|
||||
extern DialogClassRec dialogClassRec;
|
||||
WidgetClass dialogWidgetClass = (WidgetClass)&dialogClassRec;
|
||||
|
||||
extern FormClassRec formClassRec;
|
||||
WidgetClass formWidgetClass = (WidgetClass)&formClassRec;
|
||||
|
||||
extern GripClassRec gripClassRec;
|
||||
WidgetClass gripWidgetClass = (WidgetClass) &gripClassRec;
|
||||
|
||||
extern LabelClassRec labelClassRec;
|
||||
WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec;
|
||||
|
||||
extern ListClassRec listClassRec;
|
||||
WidgetClass listWidgetClass = (WidgetClass)&listClassRec;
|
||||
|
||||
extern MenuButtonClassRec menuButtonClassRec;
|
||||
WidgetClass menuButtonWidgetClass = (WidgetClass) &menuButtonClassRec;
|
||||
|
||||
extern PanedClassRec panedClassRec;
|
||||
WidgetClass panedWidgetClass = (WidgetClass) &panedClassRec;
|
||||
WidgetClass vPanedWidgetClass = (WidgetClass) &panedClassRec;
|
||||
|
||||
extern PannerClassRec pannerClassRec;
|
||||
WidgetClass pannerWidgetClass = (WidgetClass) &pannerClassRec;
|
||||
|
||||
extern PortholeClassRec portholeClassRec;
|
||||
WidgetClass portholeWidgetClass = (WidgetClass) &portholeClassRec;
|
||||
|
||||
extern RepeaterClassRec repeaterClassRec;
|
||||
WidgetClass repeaterWidgetClass = (WidgetClass) &repeaterClassRec;
|
||||
|
||||
extern ScrollbarClassRec scrollbarClassRec;
|
||||
WidgetClass scrollbarWidgetClass = (WidgetClass)&scrollbarClassRec;
|
||||
|
||||
extern SimpleClassRec simpleClassRec;
|
||||
WidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec;
|
||||
|
||||
extern SimpleMenuClassRec simpleMenuClassRec;
|
||||
WidgetClass simpleMenuWidgetClass = (WidgetClass)&simpleMenuClassRec;
|
||||
|
||||
extern SmeClassRec smeClassRec;
|
||||
WidgetClass smeObjectClass = (WidgetClass) &smeClassRec;
|
||||
|
||||
extern SmeBSBClassRec smeBSBClassRec;
|
||||
WidgetClass smeBSBObjectClass = (WidgetClass) &smeBSBClassRec;
|
||||
|
||||
extern SmeLineClassRec smeLineClassRec;
|
||||
WidgetClass smeLineObjectClass = (WidgetClass) &smeLineClassRec;
|
||||
|
||||
extern StripChartClassRec stripChartClassRec;
|
||||
WidgetClass stripChartWidgetClass = (WidgetClass) &stripChartClassRec;
|
||||
|
||||
extern TextClassRec textClassRec;
|
||||
WidgetClass textWidgetClass = (WidgetClass)&textClassRec;
|
||||
|
||||
unsigned long FMT8BIT = 0L;
|
||||
unsigned long XawFmt8Bit = 0L;
|
||||
unsigned long XawFmtWide = 0L;
|
||||
|
||||
extern TextSinkClassRec textSinkClassRec;
|
||||
WidgetClass textSinkObjectClass = (WidgetClass)&textSinkClassRec;
|
||||
|
||||
extern TextSrcClassRec textSrcClassRec;
|
||||
WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec;
|
||||
|
||||
extern ToggleClassRec toggleClassRec;
|
||||
WidgetClass toggleWidgetClass = (WidgetClass) &toggleClassRec;
|
||||
|
||||
extern TreeClassRec treeClassRec;
|
||||
WidgetClass treeWidgetClass = (WidgetClass) &treeClassRec;
|
||||
|
||||
extern VendorShellClassRec vendorShellClassRec;
|
||||
WidgetClass vendorShellWidgetClass = (WidgetClass) &vendorShellClassRec;
|
||||
|
||||
extern ViewportClassRec viewportClassRec;
|
||||
WidgetClass viewportWidgetClass = (WidgetClass)&viewportClassRec;
|
||||
|
||||
#endif /* SUNSHLIB */
|
Loading…
Add table
Add a link
Reference in a new issue