summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2019-07-15 19:58:35 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2019-07-15 19:58:35 -0400
commitc3ff775bfe4556ffbe920cbfbc860e471dfc7f07 (patch)
tree0fbeaafb2ec09955240bac3eb3a9bbe49a44f52e /src
parentf7a9ead69089a862fbd9aab6995980d3ecd290bf (diff)
fix gcc-normal compiler warnings, no object change
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src')
-rw-r--r--src/add_window.c50
-rw-r--r--src/cursor.c3
-rw-r--r--src/events.c58
-rw-r--r--src/gram.y12
-rw-r--r--src/iconmgr.c12
-rw-r--r--src/icons.c34
-rw-r--r--src/lex.l2
-rw-r--r--src/list.c6
-rw-r--r--src/menus.c153
-rw-r--r--src/parse.c18
-rw-r--r--src/resize.c48
-rw-r--r--src/session.c54
-rw-r--r--src/twm.c12
-rw-r--r--src/twm.h4
-rw-r--r--src/util.c160
15 files changed, 315 insertions, 311 deletions
diff --git a/src/add_window.c b/src/add_window.c
index 99481b0..74fd7bf 100644
--- a/src/add_window.c
+++ b/src/add_window.c
@@ -179,7 +179,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
}
tmp_win->w = w;
tmp_win->zoomed = ZOOM_NONE;
- tmp_win->iconmgr = iconm;
+ tmp_win->iconmgr = (short) iconm;
tmp_win->iconmgrp = iconp;
tmp_win->cmaps.number_cwins = 0;
@@ -266,7 +266,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
* fields in the WM_NORMAL_HINTS property.
*/
- tmp_win->transient = Transient(tmp_win->w, &tmp_win->transientfor);
+ tmp_win->transient = (short)Transient(tmp_win->w, &tmp_win->transientfor);
tmp_win->nameChanged = 0;
if (tmp_win->class.res_name == NULL)
@@ -275,7 +275,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
tmp_win->class.res_class = NoName;
tmp_win->full_name = strdup(tmp_win->name);
- namelen = strlen (tmp_win->name);
+ namelen = (int)strlen (tmp_win->name);
tmp_win->highlight = Scr->Highlight &&
(!(short)(long) LookInList(Scr->NoHighlight, tmp_win->full_name,
@@ -479,7 +479,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
tmp_win->name, namelen));
height = Scr->SizeFont.height + SIZE_VINDENT * 2;
- XResizeWindow (dpy, Scr->SizeWindow, width + SIZE_HINDENT, height);
+ XResizeWindow (dpy, Scr->SizeWindow, (unsigned)(width + SIZE_HINDENT), (unsigned)height);
XMapRaised(dpy, Scr->SizeWindow);
InstallRootColormap();
@@ -585,8 +585,8 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
Scr->SizeStringOffset = width +
MyFont_TextWidth(&Scr->SizeFont, ": ", 2);
- XResizeWindow (dpy, Scr->SizeWindow, Scr->SizeStringOffset +
- Scr->SizeStringWidth, height);
+ XResizeWindow (dpy, Scr->SizeWindow, (unsigned)(Scr->SizeStringOffset +
+ Scr->SizeStringWidth), (unsigned)height);
MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont,
Scr->NormalGC, width,
SIZE_VINDENT + Scr->SizeFont.ascent,
@@ -843,7 +843,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root,
gray_bits, gray_width, gray_height,
tmp_win->border_tile.fore, tmp_win->border_tile.back,
- Scr->d_depth);
+ (unsigned)Scr->d_depth);
SetBorder (tmp_win, False);
}
@@ -882,7 +882,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
XShapeQueryExtents (dpy, tmp_win->w,
&boundingShaped, &xws, &yws, &wws, &hws,
&clipShaped, &xbs, &ybs, &wbs, &hbs);
- tmp_win->wShaped = boundingShaped;
+ tmp_win->wShaped = (short)boundingShaped;
}
if (!tmp_win->iconmgr)
@@ -1023,7 +1023,7 @@ GrabButtons(TwmWindow *tmp_win)
/* twm used to do this grab on the application main window,
* tmp_win->w . This was not ICCCM complient and was changed.
*/
- XGrabButton(dpy, i, j, tmp_win->frame,
+ XGrabButton(dpy, (unsigned)i, (unsigned)j, tmp_win->frame,
True, ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None,
Scr->FrameCursor);
@@ -1048,29 +1048,29 @@ GrabKeys(TwmWindow *tmp_win)
switch (tmp->cont)
{
case C_WINDOW:
- XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->w, True,
+ XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->w, True,
GrabModeAsync, GrabModeAsync);
break;
case C_ICON:
if (tmp_win->icon_w)
- XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->icon_w, True,
+ XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->icon_w, True,
GrabModeAsync, GrabModeAsync);
case C_TITLE:
if (tmp_win->title_w)
- XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->title_w, True,
+ XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->title_w, True,
GrabModeAsync, GrabModeAsync);
break;
case C_NAME:
- XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->w, True,
+ XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->w, True,
GrabModeAsync, GrabModeAsync);
if (tmp_win->icon_w)
- XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->icon_w, True,
+ XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->icon_w, True,
GrabModeAsync, GrabModeAsync);
if (tmp_win->title_w)
- XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->title_w, True,
+ XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->title_w, True,
GrabModeAsync, GrabModeAsync);
break;
/*
@@ -1087,7 +1087,7 @@ GrabKeys(TwmWindow *tmp_win)
{
for (p = &Scr->iconmgr; p != NULL; p = p->next)
{
- XUngrabKey(dpy, tmp->keycode, tmp->mods, p->twm_win->w);
+ XUngrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, p->twm_win->w);
}
}
}
@@ -1125,8 +1125,8 @@ static Window CreateHighlightWindow (TwmWindow *tmp_win)
}
if (Scr->hilitePm) {
pm = XCreatePixmap (dpy, tmp_win->title_w,
- Scr->hilite_pm_width, Scr->hilite_pm_height,
- Scr->d_depth);
+ (unsigned)Scr->hilite_pm_width, (unsigned)Scr->hilite_pm_height,
+ (unsigned)Scr->d_depth);
gcv.foreground = tmp_win->title.fore;
gcv.background = tmp_win->title.back;
gcv.graphics_exposures = False;
@@ -1135,7 +1135,7 @@ static Window CreateHighlightWindow (TwmWindow *tmp_win)
&gcv);
if (gc) {
XCopyPlane (dpy, Scr->hilitePm, pm, gc, 0, 0,
- Scr->hilite_pm_width, Scr->hilite_pm_height,
+ (unsigned)Scr->hilite_pm_width, (unsigned)Scr->hilite_pm_height,
0, 0, 1);
XFreeGC (dpy, gc);
} else {
@@ -1287,14 +1287,14 @@ static void CreateWindowTitlebarButtons (TwmWindow *tmp_win)
tmp_win->titlebuttons = NULL;
nb = Scr->TBInfo.nleft + Scr->TBInfo.nright;
if (nb > 0) {
- tmp_win->titlebuttons = malloc (nb * sizeof(TBWindow));
+ tmp_win->titlebuttons = malloc ((size_t)nb * sizeof(TBWindow));
if (!tmp_win->titlebuttons) {
fprintf (stderr, "%s: unable to allocate %d titlebuttons\n",
ProgramName, nb);
} else {
TBWindow *tbw;
int boxwidth = (Scr->TBInfo.width + Scr->TBInfo.pad);
- unsigned int h = (Scr->TBInfo.width - Scr->TBInfo.border * 2);
+ unsigned h = (unsigned)(Scr->TBInfo.width - Scr->TBInfo.border * 2);
for (tb = Scr->TBInfo.head, tbw = tmp_win->titlebuttons; tb;
tb = tb->next, tbw++) {
@@ -1338,8 +1338,8 @@ SetHighlightPixmap (char *filename)
XFreePixmap (dpy, Scr->hilitePm);
}
Scr->hilitePm = pm;
- Scr->hilite_pm_width = JunkWidth;
- Scr->hilite_pm_height = JunkHeight;
+ Scr->hilite_pm_width = (int)JunkWidth;
+ Scr->hilite_pm_height = (int)JunkHeight;
}
}
@@ -1469,7 +1469,7 @@ FetchWmColormapWindows (TwmWindow *tmp)
}
if (i == number_cmap_windows) { /* not in list */
Window *new_cmap_windows =
- malloc (sizeof(Window) * (number_cmap_windows + 1));
+ malloc (sizeof(Window) * (size_t)(number_cmap_windows + 1));
if (!new_cmap_windows) {
fprintf (stderr,
@@ -1487,7 +1487,7 @@ FetchWmColormapWindows (TwmWindow *tmp)
number_cmap_windows++;
}
- cwins = malloc(sizeof(ColormapWindow *) * number_cmap_windows);
+ cwins = malloc(sizeof(ColormapWindow *) * (size_t)number_cmap_windows);
if (cwins) {
for (i = 0; i < number_cmap_windows; i++) {
diff --git a/src/cursor.c b/src/cursor.c
index bbe05f0..cfe0a09 100644
--- a/src/cursor.c
+++ b/src/cursor.c
@@ -167,5 +167,6 @@ NewBitmapCursor(Cursor *cp, char *source, char *mask)
return;
}
*cp = XCreatePixmapCursor(dpy, spm, mpm, &Scr->PointerForeground,
- &Scr->PointerBackground, hotx,hoty);
+ &Scr->PointerBackground,
+ (unsigned)hotx, (unsigned)hoty);
}
diff --git a/src/events.c b/src/events.c
index ac26d88..9f5d239 100644
--- a/src/events.c
+++ b/src/events.c
@@ -617,13 +617,13 @@ HandleKeyPress(void)
else
{
int matched = FALSE;
- len = strlen(key->win_name);
+ len = (int)strlen(key->win_name);
/* try and match the name first */
for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL;
Tmp_win = Tmp_win->next)
{
- if (!strncmp(key->win_name, Tmp_win->name, len))
+ if (!strncmp(key->win_name, Tmp_win->name, (size_t)len))
{
matched = TRUE;
ExecuteFunction(key->func, key->action, Tmp_win->frame,
@@ -637,7 +637,7 @@ HandleKeyPress(void)
for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL;
Tmp_win = Tmp_win->next)
{
- if (!strncmp(key->win_name, Tmp_win->class.res_name, len))
+ if (!strncmp(key->win_name, Tmp_win->class.res_name, (size_t)len))
{
matched = TRUE;
ExecuteFunction(key->func, key->action, Tmp_win->frame,
@@ -651,7 +651,7 @@ HandleKeyPress(void)
for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL;
Tmp_win = Tmp_win->next)
{
- if (!strncmp(key->win_name, Tmp_win->class.res_class, len))
+ if (!strncmp(key->win_name, Tmp_win->class.res_class, (size_t)len))
{
matched = TRUE;
ExecuteFunction(key->func, key->action, Tmp_win->frame,
@@ -780,7 +780,7 @@ HandlePropertyNotify(void)
Tmp_win->name_width = MyFont_TextWidth (&Scr->TitleBarFont,
Tmp_win->name,
- strlen (Tmp_win->name));
+ (int)strlen (Tmp_win->name));
SetupWindow (Tmp_win, Tmp_win->frame_x, Tmp_win->frame_y,
Tmp_win->frame_width, Tmp_win->frame_height, -1);
@@ -895,13 +895,13 @@ HandlePropertyNotify(void)
return;
}
- pm = XCreatePixmap (dpy, Scr->Root, Tmp_win->icon_width,
- Tmp_win->icon_height, Scr->d_depth);
+ pm = XCreatePixmap (dpy, Scr->Root, (unsigned)Tmp_win->icon_width,
+ (unsigned)Tmp_win->icon_height, (unsigned)Scr->d_depth);
FB(Tmp_win->iconc.fore, Tmp_win->iconc.back);
XCopyPlane(dpy, Tmp_win->wmhints->icon_pixmap, pm,
Scr->NormalGC,
- 0,0, Tmp_win->icon_width, Tmp_win->icon_height, 0, 0, 1 );
+ 0,0, (unsigned)Tmp_win->icon_width, (unsigned)Tmp_win->icon_height, 0, 0, 1 );
valuemask = CWBackPixmap;
attributes.background_pixmap = pm;
@@ -964,7 +964,7 @@ RedoIconName(void)
return;
Tmp_win->icon_w_width = MyFont_TextWidth(&Scr->IconFont,
- Tmp_win->icon_name, strlen(Tmp_win->icon_name));
+ Tmp_win->icon_name, (int)strlen(Tmp_win->icon_name));
Tmp_win->icon_w_width += 6;
if (Tmp_win->icon_w_width < Tmp_win->icon_width)
@@ -988,8 +988,8 @@ RedoIconName(void)
Tmp_win->icon_w_height = Tmp_win->icon_height + Scr->IconFont.height + 4;
Tmp_win->icon_y = Tmp_win->icon_height + Scr->IconFont.height;
- XResizeWindow(dpy, Tmp_win->icon_w, Tmp_win->icon_w_width,
- Tmp_win->icon_w_height);
+ XResizeWindow(dpy, Tmp_win->icon_w, (unsigned)Tmp_win->icon_w_width,
+ (unsigned)Tmp_win->icon_w_height);
if (Tmp_win->icon_bm_w)
{
XMoveWindow(dpy, Tmp_win->icon_bm_w, x, y);
@@ -1063,7 +1063,7 @@ HandleExpose(void)
{
MyFont_DrawString(dpy, Scr->InfoWindow, &Scr->DefaultFont,
Scr->NormalGC, 5, (i*height) + Scr->DefaultFont.y, Info[i],
- strlen(Info[i]));
+ (int)strlen(Info[i]));
}
flush_expose (Event.xany.window);
}
@@ -1076,7 +1076,7 @@ HandleExpose(void)
MyFont_DrawString (dpy, Tmp_win->title_w, &Scr->TitleBarFont,
Scr->NormalGC, Scr->TBInfo.titlex, Scr->TitleBarFont.y,
- Tmp_win->name, strlen(Tmp_win->name));
+ Tmp_win->name, (int)strlen(Tmp_win->name));
flush_expose (Event.xany.window);
}
else if (Event.xany.window == Tmp_win->icon_w)
@@ -1086,7 +1086,7 @@ HandleExpose(void)
MyFont_DrawString (dpy, Tmp_win->icon_w, &Scr->IconFont,
Scr->NormalGC, Tmp_win->icon_x, Tmp_win->icon_y,
- Tmp_win->icon_name, strlen(Tmp_win->icon_name));
+ Tmp_win->icon_name, (int)strlen(Tmp_win->icon_name));
flush_expose (Event.xany.window);
return;
} else if (Tmp_win->titlebuttons) {
@@ -1116,7 +1116,7 @@ HandleExpose(void)
MyFont_DrawString (dpy, Event.xany.window,
&Scr->IconManagerFont, Scr->NormalGC,
iconmgr_textx, Scr->IconManagerFont.y+4,
- Tmp_win->icon_name, strlen(Tmp_win->icon_name));
+ Tmp_win->icon_name, (int)strlen(Tmp_win->icon_name));
DrawIconManagerBorder(Tmp_win->list);
flush_expose (Event.xany.window);
return;
@@ -1126,7 +1126,7 @@ HandleExpose(void)
FB(Tmp_win->list->fore, Tmp_win->list->back);
XCopyPlane(dpy, Scr->siconifyPm, Tmp_win->list->icon,
Scr->NormalGC,
- 0,0, iconifybox_width, iconifybox_height, 0, 0, 1);
+ 0,0, (unsigned)iconifybox_width, (unsigned)iconifybox_height, 0, 0, 1);
flush_expose (Event.xany.window);
return;
}
@@ -1336,7 +1336,7 @@ HandleMapRequest(void)
zoom_save = Scr->DoZoom;
Scr->DoZoom = FALSE;
Iconify(Tmp_win, 0, 0);
- Scr->DoZoom = zoom_save;
+ Scr->DoZoom = (short)zoom_save;
break;
}
}
@@ -1443,7 +1443,7 @@ HandleUnmapNotify(void)
if (reparented) {
if (Tmp_win->old_bw) XSetWindowBorderWidth (dpy,
Event.xunmap.window,
- Tmp_win->old_bw);
+ (unsigned)Tmp_win->old_bw);
if (Tmp_win->wmhints && (Tmp_win->wmhints->flags & IconWindowHint))
XUnmapWindow (dpy, Tmp_win->wmhints->icon_window);
} else {
@@ -1635,11 +1635,11 @@ HandleButtonRelease(void)
mask = (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask);
switch (Event.xbutton.button)
{
- case Button1: mask &= ~Button1Mask; break;
- case Button2: mask &= ~Button2Mask; break;
- case Button3: mask &= ~Button3Mask; break;
- case Button4: mask &= ~Button4Mask; break;
- case Button5: mask &= ~Button5Mask; break;
+ case Button1: mask &= (unsigned)(~Button1Mask); break;
+ case Button2: mask &= (unsigned)(~Button2Mask); break;
+ case Button3: mask &= (unsigned)(~Button3Mask); break;
+ case Button4: mask &= (unsigned)(~Button4Mask); break;
+ case Button5: mask &= (unsigned)(~Button5Mask); break;
}
if (RootFunction != 0 ||
@@ -1755,7 +1755,7 @@ HandleButtonPress(void)
return;
}
else
- ButtonPressed = Event.xbutton.button;
+ ButtonPressed = (int)Event.xbutton.button;
if (ResizeWindow != None ||
DragWindow != None ||
@@ -1958,7 +1958,7 @@ typedef struct HENScanArgs {
} HENScanArgs;
static Bool
-HENQueueScanner(Display *dpy, XEvent *ev, char *args)
+HENQueueScanner(Display *dpy2, XEvent *ev, char *args)
{
if (ev->type == LeaveNotify) {
if (ev->xcrossing.window == ((HENScanArgs *) args)->w &&
@@ -2155,7 +2155,7 @@ typedef struct HLNScanArgs {
} HLNScanArgs;
static Bool
-HLNQueueScanner(Display *dpy, XEvent *ev, char *args)
+HLNQueueScanner(Display *dpy2, XEvent *ev, char *args)
{
if (ev->type == EnterNotify && ev->xcrossing.mode != NotifyGrab) {
((HLNScanArgs *) args)->enters = True;
@@ -2297,7 +2297,7 @@ HandleConfigureRequest(void)
xwc.width = cre->width;
xwc.height = cre->height;
xwc.border_width = cre->border_width;
- XConfigureWindow(dpy, Event.xany.window, xwcm, &xwc);
+ XConfigureWindow(dpy, Event.xany.window, (unsigned)xwcm, &xwc);
return;
}
@@ -2393,7 +2393,7 @@ HandleShapeNotify (void)
XShapeCombineMask (dpy, Tmp_win->frame, ShapeClip, 0, 0, None,
ShapeSet);
}
- Tmp_win->wShaped = sev->shaped;
+ Tmp_win->wShaped = (short)sev->shaped;
SetFrameShape (Tmp_win);
}
@@ -2600,7 +2600,7 @@ InstallRootColormap(void)
static Bool
-UninstallRootColormapQScanner(Display *dpy, XEvent *ev, char *args)
+UninstallRootColormapQScanner(Display *dpy2, XEvent *ev, char *args)
{
if (!*args) {
if (ev->type == EnterNotify) {
diff --git a/src/gram.y b/src/gram.y
index ca40d1c..d9fe680 100644
--- a/src/gram.y
+++ b/src/gram.y
@@ -159,7 +159,7 @@ stmt : error
| ZOOM number { if (Scr->FirstTime)
{
Scr->DoZoom = TRUE;
- Scr->ZoomCount = $2;
+ Scr->ZoomCount = (short)$2;
}
}
| ZOOM { if (Scr->FirstTime)
@@ -716,7 +716,7 @@ RemoveDQuote(char *str)
n = (n<<3) + (*i++ - '0');
count++;
}
- *o = n;
+ *o = (char)n;
break;
hex:
case 'x':
@@ -733,7 +733,7 @@ RemoveDQuote(char *str)
else
break;
}
- *o = n;
+ *o = (char)n;
break;
case '\n':
i++; /* punt */
@@ -769,7 +769,7 @@ static MenuRoot *GetRoot(const char *name, const char* fore, const char *back)
Scr->FirstTime = TRUE;
GetColor(COLOR, &tmp->hi_fore, fore);
GetColor(COLOR, &tmp->hi_back, back);
- Scr->FirstTime = save;
+ Scr->FirstTime = (short)save;
}
return tmp;
@@ -800,7 +800,7 @@ static void GotButton(int butt, int func)
Action = "";
pull = NULL;
cont = 0;
- mods_used |= mods;
+ mods_used |= (unsigned)mods;
mods = 0;
}
@@ -819,7 +819,7 @@ static void GotKey(char *key, int func)
Action = "";
pull = NULL;
cont = 0;
- mods_used |= mods;
+ mods_used |= (unsigned)mods;
mods = 0;
}
diff --git a/src/iconmgr.c b/src/iconmgr.c
index ca7b307..6764802 100644
--- a/src/iconmgr.c
+++ b/src/iconmgr.c
@@ -90,7 +90,7 @@ CreateIconManagers(void)
&background);
p->w = XCreateSimpleWindow(dpy, Scr->Root,
- JunkX, JunkY, p->width, p->height, 1,
+ JunkX, JunkY, (unsigned)p->width, (unsigned)p->height, 1,
Scr->Black, background);
snprintf(str, sizeof(str), "%s Icon Manager", p->name);
@@ -564,7 +564,7 @@ void DrawIconManagerBorder(WList *tmp)
{
XSetForeground(dpy, Scr->NormalGC, tmp->fore);
XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 2, 2,
- tmp->width-5, tmp->height-5);
+ (unsigned)(tmp->width-5), (unsigned)(tmp->height-5));
if (tmp->active && Scr->Highlight)
XSetForeground(dpy, Scr->NormalGC, tmp->highlight);
@@ -572,9 +572,9 @@ void DrawIconManagerBorder(WList *tmp)
XSetForeground(dpy, Scr->NormalGC, tmp->back);
XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 0, 0,
- tmp->width-1, tmp->height-1);
+ (unsigned)(tmp->width-1), (unsigned)(tmp->height-1));
XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 1, 1,
- tmp->width-3, tmp->height-3);
+ (unsigned)(tmp->width-3), (unsigned)(tmp->height-3));
}
}
@@ -659,7 +659,7 @@ void PackIconManager(IconMgr *ip)
if (tmp->x != new_x || tmp->y != new_y ||
tmp->width != wwidth || tmp->height != wheight)
{
- XMoveResizeWindow(dpy, tmp->w, new_x, new_y, wwidth, wheight);
+ XMoveResizeWindow(dpy, tmp->w, new_x, new_y, (unsigned)wwidth, (unsigned)wheight);
tmp->row = row-1;
tmp->col = col;
@@ -680,7 +680,7 @@ void PackIconManager(IconMgr *ip)
if (newwidth == 0)
newwidth = colinc;
- XResizeWindow(dpy, ip->w, newwidth, ip->height);
+ XResizeWindow(dpy, ip->w, (unsigned)newwidth, (unsigned)ip->height);
savewidth = ip->width;
if (ip->twm_win)
diff --git a/src/icons.c b/src/icons.c
index 617a1f7..ec9add9 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -378,12 +378,12 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
(unsigned int *) &tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height,
&JunkBW, &JunkDepth);
- pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width,
- tmp_win->icon_height, Scr->d_depth);
+ pm = XCreatePixmap(dpy, Scr->Root, (unsigned)tmp_win->icon_width,
+ (unsigned)tmp_win->icon_height, (unsigned)Scr->d_depth);
/* the copy plane works on color ! */
XCopyPlane(dpy, bm, pm, Scr->NormalGC,
- 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 );
+ 0,0, (unsigned)tmp_win->icon_width, (unsigned)tmp_win->icon_height, 0, 0, 1 );
tmp_win->forced = TRUE;
}
@@ -402,11 +402,11 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
(unsigned int *)&tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height, &JunkBW, &JunkDepth);
pm = XCreatePixmap(dpy, Scr->Root,
- tmp_win->icon_width, tmp_win->icon_height,
- Scr->d_depth);
+ (unsigned)tmp_win->icon_width, (unsigned)tmp_win->icon_height,
+ (unsigned)Scr->d_depth);
XCopyPlane(dpy, tmp_win->wmhints->icon_pixmap, pm, Scr->NormalGC,
- 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 );
+ 0,0, (unsigned)tmp_win->icon_width, (unsigned)tmp_win->icon_height, 0, 0, 1 );
}
/* if we still haven't got an icon, let's look in the Icon list
@@ -438,12 +438,12 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
(unsigned int *)&tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height,
&JunkBW, &JunkDepth);
- pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width,
- tmp_win->icon_height, Scr->d_depth);
+ pm = XCreatePixmap(dpy, Scr->Root, (unsigned)tmp_win->icon_width,
+ (unsigned)tmp_win->icon_height, (unsigned)Scr->d_depth);
/* the copy plane works on color ! */
XCopyPlane(dpy, bm, pm, Scr->NormalGC,
- 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 );
+ 0,0, (unsigned)tmp_win->icon_width, (unsigned)tmp_win->icon_height, 0, 0, 1 );
}
}
@@ -454,12 +454,12 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
tmp_win->icon_width = Scr->UnknownWidth;
tmp_win->icon_height = Scr->UnknownHeight;
- pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width,
- tmp_win->icon_height, Scr->d_depth);
+ pm = XCreatePixmap(dpy, Scr->Root, (unsigned)tmp_win->icon_width,
+ (unsigned)tmp_win->icon_height, (unsigned)Scr->d_depth);
/* the copy plane works on color ! */
XCopyPlane(dpy, Scr->UnknownPm, pm, Scr->NormalGC,
- 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 );
+ 0,0, (unsigned)tmp_win->icon_width, (unsigned)tmp_win->icon_height, 0, 0, 1 );
}
if (pm == None)
@@ -475,7 +475,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
}
tmp_win->icon_w_width = MyFont_TextWidth(&Scr->IconFont,
- tmp_win->icon_name, strlen(tmp_win->icon_name));
+ tmp_win->icon_name, (int)strlen(tmp_win->icon_name));
tmp_win->icon_w_width += 6;
if (tmp_win->icon_w_width < tmp_win->icon_width)
@@ -518,14 +518,14 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
{
tmp_win->icon_w = XCreateSimpleWindow(dpy, Scr->Root,
0,0,
- tmp_win->icon_w_width, tmp_win->icon_w_height,
- Scr->IconBorderWidth, tmp_win->icon_border, tmp_win->iconc.back);
+ (unsigned)tmp_win->icon_w_width, (unsigned)tmp_win->icon_w_height,
+ (unsigned)Scr->IconBorderWidth, tmp_win->icon_border, tmp_win->iconc.back);
event_mask = ExposureMask;
}
XSelectInput (dpy, tmp_win->icon_w,
- KeyPressMask | ButtonPressMask | ButtonReleaseMask |
- event_mask);
+ (long)(KeyPressMask | ButtonPressMask | ButtonReleaseMask |
+ event_mask));
tmp_win->icon_bm_w = None;
if (pm != None &&
diff --git a/src/lex.l b/src/lex.l
index 6323250..320d206 100644
--- a/src/lex.l
+++ b/src/lex.l
@@ -82,7 +82,7 @@ static int doinput (char *buf, int size)
if ((c = (*twmInputFunc)()) <= 0)
return (0);
- buf[0] = c;
+ buf[0] = (char)c;
return (1);
}
#define YY_NO_UNPUT
diff --git a/src/list.c b/src/list.c
index 3550716..2fa41d3 100644
--- a/src/list.c
+++ b/src/list.c
@@ -170,7 +170,7 @@ int GetColorFromList(name_list *list_head, const char *name, XClassHint *class,
save = Scr->FirstTime;
Scr->FirstTime = TRUE;
GetColor(Scr->Monochrome, ptr, nptr->ptr);
- Scr->FirstTime = save;
+ Scr->FirstTime = (short)save;
return (TRUE);
}
@@ -182,7 +182,7 @@ int GetColorFromList(name_list *list_head, const char *name, XClassHint *class,
save = Scr->FirstTime;
Scr->FirstTime = TRUE;
GetColor(Scr->Monochrome, ptr, nptr->ptr);
- Scr->FirstTime = save;
+ Scr->FirstTime = (short)save;
return (TRUE);
}
@@ -192,7 +192,7 @@ int GetColorFromList(name_list *list_head, const char *name, XClassHint *class,
save = Scr->FirstTime;
Scr->FirstTime = TRUE;
GetColor(Scr->Monochrome, ptr, nptr->ptr);
- Scr->FirstTime = save;
+ Scr->FirstTime = (short)save;
return (TRUE);
}
}
diff --git a/src/menus.c b/src/menus.c
index ada9c41..494cbde 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -171,12 +171,12 @@ InitMenus(void)
*
* \param name the name of the key
* \param cont the context to look for the key press in
- * \param mods modifier keys that need to be pressed
+ * \param mods2 modifier keys that need to be pressed
* \param func the function to perform
* \param win_name the window name (if any)
* \param action the action string associated with the function (if any)
*/
-Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
+Bool AddFuncKey (char *name, int cont, int mods2, int func, char *win_name,
char *action)
{
FuncKey *tmp;
@@ -198,7 +198,7 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
{
if (tmp->keysym == keysym &&
tmp->cont == cont &&
- tmp->mods == mods)
+ tmp->mods == mods2)
break;
}
@@ -213,7 +213,7 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
tmp->keysym = keysym;
tmp->keycode = keycode;
tmp->cont = cont;
- tmp->mods = mods;
+ tmp->mods = mods2;
tmp->func = func;
tmp->win_name = win_name;
tmp->action = action;
@@ -342,18 +342,18 @@ void InitTitlebarButtons (void)
}
}
- tb->dstx = (h - tb->width + 1) / 2;
+ tb->dstx = (int)(((unsigned)h - tb->width + 1) / 2);
if (tb->dstx < 0) { /* clip to minimize copying */
tb->srcx = -(tb->dstx);
- tb->width = h;
+ tb->width = (unsigned)h;
tb->dstx = 0;
} else {
tb->srcx = 0;
}
- tb->dsty = (h - tb->height + 1) / 2;
+ tb->dsty = (int)(((unsigned)h - tb->height + 1) / 2);
if (tb->dsty < 0) {
tb->srcy = -(tb->dsty);
- tb->height = h;
+ tb->height = (unsigned)h;
tb->dsty = 0;
} else {
tb->srcy = 0;
@@ -385,7 +385,7 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure)
XSetForeground(dpy, Scr->NormalGC, mi->hi_back);
XFillRectangle(dpy, mr->w, Scr->NormalGC, 0, y_offset,
- mr->width, Scr->EntryHeight);
+ (unsigned)mr->width, (unsigned)Scr->EntryHeight);
MyFont_ChangeGC(mi->hi_fore, mi->hi_back, &Scr->MenuFont);
@@ -401,7 +401,7 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure)
XSetForeground(dpy, Scr->NormalGC, mi->back);
XFillRectangle(dpy, mr->w, Scr->NormalGC, 0, y_offset,
- mr->width, Scr->EntryHeight);
+ (unsigned)mr->width, (unsigned)Scr->EntryHeight);
MyFont_ChangeGC(mi->fore, mi->back, &Scr->MenuFont);
gc = Scr->NormalGC;
@@ -422,8 +422,8 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure)
Scr->pullPm = CreateMenuIcon (Scr->MenuFont.height,
&Scr->pullW, &Scr->pullH);
}
- x = mr->width - Scr->pullW - 5;
- y = y_offset + ((Scr->MenuFont.height - Scr->pullH) / 2);
+ x = (int)((unsigned)mr->width - (Scr->pullW + 5));
+ y = (int)((unsigned)y_offset + (((unsigned)Scr->MenuFont.height - Scr->pullH) / 2));
XCopyPlane(dpy, Scr->pullPm, mr->w, gc, 0, 0,
Scr->pullW, Scr->pullH, x, y, 1);
}
@@ -436,7 +436,7 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure)
/* fill the rectangle with the title background color */
XFillRectangle(dpy, mr->w, Scr->NormalGC, 0, y_offset,
- mr->width, Scr->EntryHeight);
+ (unsigned)mr->width, (unsigned)Scr->EntryHeight);
{
XSetForeground(dpy, Scr->NormalGC, mi->fore);
@@ -713,19 +713,19 @@ AddToMenu(MenuRoot *menu, const char *item, const char *action,
menu->last = tmp;
tmp->item = item;
- tmp->strlen = strlen(item);
+ tmp->strlen = (short)strlen(item);
tmp->action = action;
tmp->next = NULL;
tmp->sub = NULL;
tmp->state = 0;
- tmp->func = func;
+ tmp->func = (short)func;
if (!Scr->HaveFonts) CreateFonts();
width = MyFont_TextWidth(&Scr->MenuFont, item, tmp->strlen);
if (width <= 0)
width = 1;
if (width > menu->width)
- menu->width = width;
+ menu->width = (short)width;
tmp->user_colors = FALSE;
if (Scr->Monochrome == COLOR && fore != NULL)
@@ -736,7 +736,7 @@ AddToMenu(MenuRoot *menu, const char *item, const char *action,
Scr->FirstTime = TRUE;
GetColor(COLOR, &tmp->fore, fore);
GetColor(COLOR, &tmp->back, back);
- Scr->FirstTime = save;
+ Scr->FirstTime = (short)save;
tmp->user_colors = TRUE;
}
if (sub != NULL)
@@ -787,7 +787,7 @@ MakeMenu(MenuRoot *mr)
{
if (mr->pull == TRUE)
{
- mr->width += 16 + 10;
+ mr->width = (short)(mr->width + (16 + 10));
}
width = mr->width + 10;
@@ -798,13 +798,13 @@ MakeMenu(MenuRoot *mr)
cur->x = 5;
else
{
- cur->x = width - MyFont_TextWidth(&Scr->MenuFont, cur->item,
- cur->strlen);
+ cur->x = (short)(width - MyFont_TextWidth(&Scr->MenuFont, cur->item,
+ cur->strlen));
cur->x /= 2;
}
}
- mr->height = mr->items * Scr->EntryHeight;
- mr->width += 10;
+ mr->height = (short)(mr->items * Scr->EntryHeight);
+ mr->width = (short)(mr->width + 10);
if (Scr->Shadow)
{
@@ -932,14 +932,15 @@ MakeMenu(MenuRoot *mr)
num -= 1;
for (i = 0, cur = start->next; i < num && cur; i++, cur = cur->next)
{
- f3.red += fred;
- f3.green += fgreen;
- f3.blue += fblue;
+#define AddColor(target,source) target = (unsigned short)(target + source)
+ AddColor(f3.red, fred);
+ AddColor(f3.green, fgreen);
+ AddColor(f3.blue, fblue);
save_fore = f3;
- b3.red += bred;
- b3.green += bgreen;
- b3.blue += bblue;
+ AddColor(b3.red, bred);
+ AddColor(b3.green, bgreen);
+ AddColor(b3.blue, bblue);
save_back = b3;
XAllocColor(dpy, cmap, &f3);
@@ -999,7 +1000,7 @@ PopUpMenu (MenuRoot *menu, int x, int y, Bool center)
WindowNameCount++;
if (WindowNameCount != 0)
{
- WindowNames = malloc(sizeof(TwmWindow *) * WindowNameCount);
+ WindowNames = malloc(sizeof(TwmWindow *) * (size_t)WindowNameCount);
WindowNames[0] = Scr->TwmRoot.next;
for(tmp_win = Scr->TwmRoot.next->next , WindowNameCount=1;
tmp_win != NULL;
@@ -1228,7 +1229,7 @@ resizeFromCenter(Window w, TwmWindow *tmp_win)
if (event.type == ButtonPress)
{
MenuEndResize(tmp_win);
- XMoveResizeWindow(dpy, w, AddingX, AddingY, AddingW, AddingH);
+ XMoveResizeWindow(dpy, w, AddingX, AddingY, (unsigned)AddingW, (unsigned)AddingH);
break;
}
@@ -1402,7 +1403,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
else
Bell(XkbBI_Info,0,tmp_win->w);
- Scr->SortIconMgr = save_sort;
+ Scr->SortIconMgr = (short)save_sort;
}
break;
@@ -1582,10 +1583,10 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
ConstMove = TRUE;
ConstMoveDir = MOVE_NONE;
- ConstMoveX = eventp->xbutton.x_root - DragX - JunkBW;
- ConstMoveY = eventp->xbutton.y_root - DragY - JunkBW;
- width = DragWidth + 2 * JunkBW;
- height = DragHeight + 2 * JunkBW;
+ ConstMoveX = (int)((unsigned)eventp->xbutton.x_root - (unsigned)DragX - JunkBW);
+ ConstMoveY = (int)((unsigned)eventp->xbutton.y_root - (unsigned)DragY - JunkBW);
+ width = (int)((unsigned)DragWidth + 2 * JunkBW);
+ height = (int)((unsigned)DragHeight + 2 * JunkBW);
ConstMoveXL = ConstMoveX + width/3;
ConstMoveXR = ConstMoveX + 2*(width/3);
ConstMoveYT = ConstMoveY + height/3;
@@ -1611,8 +1612,10 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
* MoveOutline's below.
*/
MoveOutline(rootw,
- origDragX - JunkBW, origDragY - JunkBW,
- DragWidth + 2 * JunkBW, DragHeight + 2 * JunkBW,
+ (int)((unsigned)origDragX - JunkBW),
+ (int)((unsigned)origDragY - JunkBW),
+ (int)((unsigned)DragWidth + 2 * JunkBW),
+ (int)((unsigned)DragHeight + 2 * JunkBW),
tmp_win->frame_bw,
moving_icon ? 0 : tmp_win->title_height);
/*
@@ -1692,7 +1695,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
WindowMoved = FALSE;
if (!Scr->OpaqueMove)
UninstallRootColormap();
- return TRUE; /* XXX should this be FALSE? */
+ return TRUE; /* XXX should this be FALSE? */
}
if (Event.type == releaseEvent)
{
@@ -1745,32 +1748,32 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
break;
case MOVE_VERT:
- ConstMoveY = eventp->xmotion.y_root - DragY - JunkBW;
+ ConstMoveY = (int)((unsigned)eventp->xmotion.y_root - (unsigned)DragY - JunkBW);
break;
case MOVE_HORIZ:
- ConstMoveX= eventp->xmotion.x_root - DragX - JunkBW;
+ ConstMoveX= (int)((unsigned)eventp->xmotion.x_root - (unsigned)DragX - JunkBW);
break;
}
if (ConstMoveDir != MOVE_NONE)
{
- int xl, yt, xr, yb, w, h;
+ int xl, yt, xr, yb, w2, h;
xl = ConstMoveX;
yt = ConstMoveY;
- w = DragWidth + 2 * JunkBW;
- h = DragHeight + 2 * JunkBW;
+ w2 = (int)((unsigned)DragWidth + 2 * JunkBW);
+ h = (int)((unsigned)DragHeight + 2 * JunkBW);
if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE)
{
- xr = xl + w;
+ xr = xl + w2;
yb = yt + h;
if (xl < 0)
xl = 0;
if (xr > Scr->MyDisplayWidth)
- xl = Scr->MyDisplayWidth - w;
+ xl = Scr->MyDisplayWidth - w2;
if (yt < 0)
yt = 0;
@@ -1782,34 +1785,34 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
if (Scr->OpaqueMove)
XMoveWindow(dpy, DragWindow, xl, yt);
else
- MoveOutline(eventp->xmotion.root, xl, yt, w, h,
+ MoveOutline(eventp->xmotion.root, xl, yt, w2, h,
tmp_win->frame_bw,
moving_icon ? 0 : tmp_win->title_height);
}
}
else if (DragWindow != None)
{
- int xl, yt, xr, yb, w, h;
+ int xl, yt, xr, yb, w2, h;
if (!menuFromFrameOrWindowOrTitlebar) {
- xl = eventp->xmotion.x_root - DragX - JunkBW;
- yt = eventp->xmotion.y_root - DragY - JunkBW;
+ xl = (int)((unsigned)eventp->xmotion.x_root - (unsigned)DragX - JunkBW);
+ yt = (int)((unsigned)eventp->xmotion.y_root - (unsigned)DragY - JunkBW);
}
else {
- xl = eventp->xmotion.x_root - (DragWidth / 2);
- yt = eventp->xmotion.y_root - (DragHeight / 2);
+ xl = (int)(eventp->xmotion.x_root - (DragWidth / 2));
+ yt = (int)(eventp->xmotion.y_root - (DragHeight / 2));
}
- w = DragWidth + 2 * JunkBW;
- h = DragHeight + 2 * JunkBW;
+ w2 = (int)((unsigned)DragWidth + 2 * JunkBW);
+ h = (int)((unsigned)DragHeight + 2 * JunkBW);
if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE)
{
- xr = xl + w;
+ xr = xl + w2;
yb = yt + h;
if (xl < 0)
xl = 0;
if (xr > Scr->MyDisplayWidth)
- xl = Scr->MyDisplayWidth - w;
+ xl = Scr->MyDisplayWidth - w2;
if (yt < 0)
yt = 0;
@@ -1822,7 +1825,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
if (Scr->OpaqueMove)
XMoveWindow(dpy, DragWindow, xl, yt);
else
- MoveOutline(eventp->xmotion.root, xl, yt, w, h,
+ MoveOutline(eventp->xmotion.root, xl, yt, w2, h,
tmp_win->frame_bw,
moving_icon ? 0 : tmp_win->title_height);
}
@@ -2000,7 +2003,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
case F_CUT:
strcpy(tmp, action);
strcat(tmp, "\n");
- XStoreBytes(dpy, tmp, strlen(tmp));
+ XStoreBytes(dpy, tmp, (int)strlen(tmp));
break;
case F_CUTFILE:
@@ -2012,7 +2015,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
if (ptr) {
fd = open (ptr, O_RDONLY);
if (fd >= 0) {
- count = read (fd, buff, MAX_FILE_SIZE - 1);
+ count = (int)read (fd, buff, MAX_FILE_SIZE - 1);
if (count > 0) XStoreBytes (dpy, buff, count);
close(fd);
} else {
@@ -2095,20 +2098,20 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
register TwmWindow *t;
int len;
- len = strlen(action);
+ len = (int)strlen(action);
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
- if (!strncmp(action, t->name, len))
+ if (!strncmp(action, t->name, (size_t)len))
if (WarpThere(t)) break;
}
if (!t) {
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
- if (!strncmp(action, t->class.res_name, len))
+ if (!strncmp(action, t->class.res_name, (size_t)len))
if (WarpThere(t)) break;
}
if (!t) {
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
- if (!strncmp(action, t->class.res_class, len))
+ if (!strncmp(action, t->class.res_class, (size_t)len))
if (WarpThere(t)) break;
}
}
@@ -2125,7 +2128,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
int len;
Window raisewin = None, iconwin = None;
- len = strlen(action);
+ len = (int)strlen(action);
if (len == 0) {
if (tmp_win && tmp_win->list) {
raisewin = tmp_win->list->iconmgr->twm_win->frame;
@@ -2136,7 +2139,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
}
} else {
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
- if (strncmp (action, t->icon_name, len) == 0) {
+ if (strncmp (action, t->icon_name, (size_t)len) == 0) {
if (t->list && t->list->iconmgr->twm_win->mapped) {
raisewin = t->list->iconmgr->twm_win->frame;
iconwin = t->list->icon;
@@ -2175,7 +2178,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
fd = open(ptr, O_RDONLY);
if (fd >= 0)
{
- count = read(fd, buff, MAX_FILE_SIZE - 1);
+ count = (int)read(fd, buff, MAX_FILE_SIZE - 1);
if (count > 0)
XStoreBytes(dpy, buff, count);
@@ -2501,7 +2504,7 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y)
XMapWindow(dpy, tmp_win->list->icon);
XGetWindowAttributes(dpy, tmp_win->w, &winattrs);
- eventMask = winattrs.your_event_mask;
+ eventMask = (unsigned long)winattrs.your_event_mask;
/* iconify transients first */
for (t = Scr->TwmRoot.next; t != NULL; t = t->next)
@@ -2521,9 +2524,9 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y)
* cause a transition to the Withdrawn state.
*/
t->mapped = FALSE;
- XSelectInput(dpy, t->w, eventMask & ~StructureNotifyMask);
+ XSelectInput(dpy, t->w, (long)(eventMask & (unsigned long)(~StructureNotifyMask)));
XUnmapWindow(dpy, t->w);
- XSelectInput(dpy, t->w, eventMask);
+ XSelectInput(dpy, t->w, (long)eventMask);
XUnmapWindow(dpy, t->frame);
if (t->icon_w)
XUnmapWindow(dpy, t->icon_w);
@@ -2549,9 +2552,9 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y)
* cause a transition to the Withdrawn state.
*/
tmp_win->mapped = FALSE;
- XSelectInput(dpy, tmp_win->w, eventMask & ~StructureNotifyMask);
+ XSelectInput(dpy, tmp_win->w, (long)(eventMask & (unsigned long)(~StructureNotifyMask)));
XUnmapWindow(dpy, tmp_win->w);
- XSelectInput(dpy, tmp_win->w, eventMask);
+ XSelectInput(dpy, tmp_win->w, (long)eventMask);
XUnmapWindow(dpy, tmp_win->frame);
SetMapStateProp(tmp_win, IconicState);
@@ -2619,7 +2622,7 @@ Identify (TwmWindow *t)
for (i = 0; i < n; i++)
{
twidth = MyFont_TextWidth(&Scr->DefaultFont, Info[i],
- strlen(Info[i]));
+ (int)strlen(Info[i]));
if (twidth > width)
width = twidth;
}
@@ -2639,7 +2642,7 @@ Identify (TwmWindow *t)
} else {
px = py = 0;
}
- XMoveResizeWindow(dpy, Scr->InfoWindow, px, py, width, height);
+ XMoveResizeWindow(dpy, Scr->InfoWindow, px, py, (unsigned)width, (unsigned)height);
XMapRaised(dpy, Scr->InfoWindow);
InfoLines = n;
}
@@ -2739,7 +2742,7 @@ BumpWindowColormap (TwmWindow *tmp, int inc)
if (!tmp) return;
if (inc && tmp->cmaps.number_cwins > 0) {
- cwins = malloc(sizeof(ColormapWindow *) * tmp->cmaps.number_cwins);
+ cwins = malloc(sizeof(ColormapWindow *) * (size_t)tmp->cmaps.number_cwins);
if (cwins) {
if ((previously_installed =
/* SUPPRESS 560 */(Scr->cmapInfo.cmaps == &tmp->cmaps &&
@@ -2917,8 +2920,8 @@ send_clientmessage (Window w, Atom a, Time timestamp)
ev.window = w;
ev.message_type = _XA_WM_PROTOCOLS;
ev.format = 32;
- ev.data.l[0] = a;
- ev.data.l[1] = timestamp;
+ ev.data.l[0] = (long)a;
+ ev.data.l[1] = (long)timestamp;
XSendEvent (dpy, w, False, 0L, (XEvent *) &ev);
}
diff --git a/src/parse.c b/src/parse.c
index 787e1b1..33e6938 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -179,7 +179,7 @@ int ParseTwmrc (char *filename)
if (!filename) {
home = getenv ("HOME");
if (home) {
- homelen = strlen (home);
+ homelen = (int)strlen (home);
cp = tmpfilename;
(void) snprintf (tmpfilename, sizeof(tmpfilename),
"%s/.twmrc.%d", home, Scr->screen);
@@ -246,7 +246,7 @@ static int twmFileInput(void)
return 0;
ptr = 0;
- len = strlen((char *) buff);
+ len = (int)strlen((char *) buff);
}
return ((int)buff[ptr++]);
}
@@ -261,7 +261,7 @@ static int twmStringListInput(void)
if (currentString) {
unsigned int c = (unsigned int) *currentString++;
- if (c) return c; /* if non-nul char */
+ if (c) return (int)c; /* if non-nul char */
currentString = *++stringListSource; /* advance to next bol */
return '\n'; /* but say that we hit last eol */
}
@@ -738,7 +738,7 @@ int do_string_keyword (int keyword, char *s)
fprintf (stderr,
"ignoring invalid UsePPosition argument \"%s\"\n", s);
} else {
- Scr->UsePPosition = ppos;
+ Scr->UsePPosition = (short)ppos;
}
return 1;
}
@@ -772,7 +772,7 @@ int do_string_keyword (int keyword, char *s)
return 1;
case kws_MaxWindowSize:
- JunkMask = XParseGeometry (s, &JunkX, &JunkY, &JunkWidth, &JunkHeight);
+ JunkMask = (unsigned)XParseGeometry (s, &JunkX, &JunkY, &JunkWidth, &JunkHeight);
if ((JunkMask & (WidthValue | HeightValue)) !=
(WidthValue | HeightValue)) {
twmrc_error_prefix();
@@ -784,8 +784,8 @@ int do_string_keyword (int keyword, char *s)
fprintf (stderr, "MaxWindowSize \"%s\" must be positive\n", s);
return 0;
}
- Scr->MaxWindowWidth = JunkWidth;
- Scr->MaxWindowHeight = JunkHeight;
+ Scr->MaxWindowWidth = (int)JunkWidth;
+ Scr->MaxWindowHeight = (int)JunkHeight;
return 1;
}
@@ -801,11 +801,11 @@ int do_number_keyword (int keyword, int num)
return 1;
case kwn_MoveDelta:
- Scr->MoveDelta = num;
+ Scr->MoveDelta = (short)num;
return 1;
case kwn_XorValue:
- if (Scr->FirstTime) Scr->XORvalue = num;
+ if (Scr->FirstTime) Scr->XORvalue = (unsigned long)num;
return 1;
case kwn_FramePadding:
diff --git a/src/resize.c b/src/resize.c
index 7cb4aa6..e59e190 100644
--- a/src/resize.c
+++ b/src/resize.c
@@ -174,8 +174,8 @@ StartResize(XEvent *evp, TwmWindow *tmp_win, Bool fromtitlebar)
Scr->SizeStringOffset = SIZE_HINDENT;
XResizeWindow (dpy, Scr->SizeWindow,
- Scr->SizeStringWidth + SIZE_HINDENT * 2,
- Scr->SizeFont.height + SIZE_VINDENT * 2);
+ (unsigned)(Scr->SizeStringWidth + SIZE_HINDENT * 2),
+ (unsigned)(Scr->SizeFont.height + SIZE_VINDENT * 2));
XMapRaised(dpy, Scr->SizeWindow);
InstallRootColormap();
last_width = 0;
@@ -208,8 +208,8 @@ MenuStartResize(TwmWindow *tmp_win, int x, int y, int w, int h)
last_height = 0;
Scr->SizeStringOffset = SIZE_HINDENT;
XResizeWindow (dpy, Scr->SizeWindow,
- Scr->SizeStringWidth + SIZE_HINDENT * 2,
- Scr->SizeFont.height + SIZE_VINDENT * 2);
+ (unsigned)(Scr->SizeStringWidth + SIZE_HINDENT * 2),
+ (unsigned)(Scr->SizeFont.height + SIZE_VINDENT * 2));
XMapRaised(dpy, Scr->SizeWindow);
DisplaySize(tmp_win, origWidth, origHeight);
MoveOutline (Scr->Root, dragx - tmp_win->frame_bw,
@@ -829,7 +829,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se
xwcm |= (CWX | CWY | CWBorderWidth);
}
- XConfigureWindow(dpy, tmp_win->title_w, xwcm, &xwc);
+ XConfigureWindow(dpy, tmp_win->title_w, (unsigned)xwcm, &xwc);
}
if (tmp_win->attr.width != w)
@@ -842,7 +842,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se
tmp_win->attr.height = h - tmp_win->title_height;
XMoveResizeWindow (dpy, tmp_win->w, 0, tmp_win->title_height,
- w, h - tmp_win->title_height);
+ (unsigned)w, (unsigned)(h - tmp_win->title_height));
/*
* fix up frame and assign size/location values in tmp_win
@@ -857,7 +857,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se
frame_wc.width = tmp_win->frame_width = w;
frame_wc.height = tmp_win->frame_height = h;
frame_mask |= (CWX | CWY | CWWidth | CWHeight);
- XConfigureWindow (dpy, tmp_win->frame, frame_mask, &frame_wc);
+ XConfigureWindow (dpy, tmp_win->frame, (unsigned)frame_mask, &frame_wc);
/*
* fix up highlight window
@@ -874,7 +874,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se
}
xwcm = CWX | CWWidth;
- XConfigureWindow(dpy, tmp_win->hilite_w, xwcm, &xwc);
+ XConfigureWindow(dpy, tmp_win->hilite_w, (unsigned)xwcm, &xwc);
}
if (HasShape && reShape) {
@@ -941,10 +941,10 @@ fullzoom(TwmWindow *tmp_win, int flag)
tmp_win->save_frame_y = dragy;
tmp_win->save_frame_width = dragWidth;
tmp_win->save_frame_height = dragHeight;
- tmp_win->zoomed = flag;
+ tmp_win->zoomed = (short)flag;
}
else
- tmp_win->zoomed = flag;
+ tmp_win->zoomed = (short)flag;
frame_bw_times_2 = 2*tmp_win->frame_bw;
@@ -1053,25 +1053,25 @@ SetFrameShape (TwmWindow *tmp)
* The frame_width and frame_height do *not* include borders.
*/
/* border */
- newBounding[0].x = tmp->title_x;
- newBounding[0].y = tmp->title_y;
- newBounding[0].width = tmp->title_width + fbw2;
- newBounding[0].height = tmp->title_height;
- newBounding[1].x = -tmp->frame_bw;
- newBounding[1].y = Scr->TitleHeight;
- newBounding[1].width = tmp->attr.width + fbw2;
- newBounding[1].height = tmp->attr.height + fbw2;
+ newBounding[0].x = (short)tmp->title_x;
+ newBounding[0].y = (short)tmp->title_y;
+ newBounding[0].width = (unsigned short)(tmp->title_width + fbw2);
+ newBounding[0].height = (unsigned short)tmp->title_height;
+ newBounding[1].x = (short)-tmp->frame_bw;
+ newBounding[1].y = (short)Scr->TitleHeight;
+ newBounding[1].width = (unsigned short)(tmp->attr.width + fbw2);
+ newBounding[1].height = (unsigned short)(tmp->attr.height + fbw2);
XShapeCombineRectangles (dpy, tmp->frame, ShapeBounding, 0, 0,
newBounding, 2, ShapeSet, YXBanded);
/* insides */
- newClip[0].x = tmp->title_x + tmp->frame_bw;
+ newClip[0].x = (short)(tmp->title_x + tmp->frame_bw);
newClip[0].y = 0;
- newClip[0].width = tmp->title_width;
- newClip[0].height = Scr->TitleHeight;
+ newClip[0].width = (unsigned short)tmp->title_width;
+ newClip[0].height = (unsigned short)Scr->TitleHeight;
newClip[1].x = 0;
- newClip[1].y = tmp->title_height;
- newClip[1].width = tmp->attr.width;
- newClip[1].height = tmp->attr.height;
+ newClip[1].y = (short)tmp->title_height;
+ newClip[1].width = (unsigned short)tmp->attr.width;
+ newClip[1].height = (unsigned short)tmp->attr.height;
XShapeCombineRectangles (dpy, tmp->frame, ShapeClip, 0, 0,
newClip, 2, ShapeSet, YXBanded);
} else {
diff --git a/src/session.c b/src/session.c
index e12a6c0..03b84a1 100644
--- a/src/session.c
+++ b/src/session.c
@@ -145,8 +145,8 @@ write_ushort (FILE *file, unsigned short s)
{
unsigned char file_short[2];
- file_short[0] = (s & (unsigned)0xff00) >> 8;
- file_short[1] = s & 0xff;
+ file_short[0] = (unsigned char)((s & (unsigned)0xff00) >> 8);
+ file_short[1] = (unsigned char)(s & 0xff);
if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1)
return 0;
return 1;
@@ -158,8 +158,8 @@ write_short (FILE *file, short s)
{
unsigned char file_short[2];
- file_short[0] = (s & (unsigned)0xff00) >> 8;
- file_short[1] = s & 0xff;
+ file_short[0] = (unsigned char)(((unsigned)s & (unsigned)0xff00) >> 8);
+ file_short[1] = (unsigned char)(s & 0xff);
if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1)
return 0;
return 1;
@@ -171,7 +171,7 @@ write_counted_string (FILE *file, char *string)
{
if (string)
{
- unsigned char count = strlen (string);
+ unsigned char count = (unsigned char)strlen (string);
if (write_byte (file, count) == 0)
return 0;
@@ -205,7 +205,7 @@ read_ushort (FILE *file, unsigned short *shortp)
if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1)
return 0;
- *shortp = file_short[0] * 256 + file_short[1];
+ *shortp = (unsigned short)(file_short[0] * 256 + file_short[1]);
return 1;
}
@@ -217,7 +217,7 @@ read_short (FILE *file, short *shortp)
if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1)
return 0;
- *shortp = file_short[0] * 256 + file_short[1];
+ *shortp = (short)(file_short[0] * 256 + file_short[1]);
return 1;
}
@@ -335,7 +335,7 @@ WriteWinConfigEntry (FILE *configFile, TwmWindow *theWindow,
}
else
{
- if (!write_byte (configFile, (char) wm_command_count))
+ if (!write_byte (configFile, (unsigned char) wm_command_count))
return 0;
for (i = 0; i < wm_command_count; i++)
if (!write_counted_string (configFile, wm_command[i]))
@@ -426,7 +426,7 @@ ReadWinConfigEntry (FILE *configFile, unsigned short version,
entry->wm_command = NULL;
else
{
- entry->wm_command = malloc (entry->wm_command_count *
+ entry->wm_command = malloc ((size_t)entry->wm_command_count *
sizeof (char *));
if (!entry->wm_command)
@@ -720,7 +720,7 @@ unique_filename (
static void
-SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData)
+SaveYourselfPhase2CB (SmcConn smcConn2, SmPointer clientData)
{
int scrnum;
ScreenInfo *theScreen;
@@ -749,7 +749,7 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData)
prop1.num_vals = 1;
prop1.vals = &prop1val;
prop1val.value = Argv[0];
- prop1val.length = strlen (Argv[0]);
+ prop1val.length = (int)strlen (Argv[0]);
snprintf (userId, sizeof(userId), "%ld", (long)getuid());
prop2.name = SmUserID;
@@ -757,7 +757,7 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData)
prop2.num_vals = 1;
prop2.vals = &prop2val;
prop2val.value = (SmPointer) userId;
- prop2val.length = strlen (userId);
+ prop2val.length = (int)strlen (userId);
prop3.name = SmRestartStyleHint;
prop3.type = SmCARD8;
@@ -770,7 +770,7 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData)
props[1] = &prop2;
props[2] = &prop3;
- SmcSetProperties (smcConn, 3, props);
+ SmcSetProperties (smcConn2, 3, props);
first_time = 0;
}
@@ -831,7 +831,7 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData)
prop1.name = SmRestartCommand;
prop1.type = SmLISTofARRAY8;
- prop1.vals = malloc ((Argc + 4) * sizeof (SmPropValue));
+ prop1.vals = malloc ((size_t)(Argc + 4) * sizeof (SmPropValue));
if (!prop1.vals)
{
@@ -851,7 +851,7 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData)
else
{
prop1.vals[numVals].value = (SmPointer) Argv[i];
- prop1.vals[numVals++].length = strlen (Argv[i]);
+ prop1.vals[numVals++].length = (int)strlen (Argv[i]);
}
}
@@ -859,13 +859,13 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData)
prop1.vals[numVals++].length = 9;
prop1.vals[numVals].value = (SmPointer) twm_clientId;
- prop1.vals[numVals++].length = strlen (twm_clientId);
+ prop1.vals[numVals++].length = (int)strlen (twm_clientId);
prop1.vals[numVals].value = (SmPointer) "-restore";
prop1.vals[numVals++].length = 8;
prop1.vals[numVals].value = (SmPointer) filename;
- prop1.vals[numVals++].length = strlen (filename);
+ prop1.vals[numVals++].length = (int)strlen (filename);
prop1.num_vals = numVals;
@@ -875,16 +875,16 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData)
prop2.num_vals = 1;
prop2.vals = &prop2val;
prop2val.value = (SmPointer) discardCommand;
- prop2val.length = strlen (discardCommand);
+ prop2val.length = (int)strlen (discardCommand);
props[0] = &prop1;
props[1] = &prop2;
- SmcSetProperties (smcConn, 2, props);
+ SmcSetProperties (smcConn2, 2, props);
free (prop1.vals);
bad:
- SmcSaveYourselfDone (smcConn, success);
+ SmcSaveYourselfDone (smcConn2, success);
sent_save_done = 1;
if (configFile)
@@ -898,16 +898,16 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData)
static void
SaveYourselfCB (
- SmcConn smcConn,
+ SmcConn smcConn2,
SmPointer clientData,
int saveType,
Bool shutdown,
int interactStyle,
Bool fast)
{
- if (!SmcRequestSaveYourselfPhase2 (smcConn, SaveYourselfPhase2CB, NULL))
+ if (!SmcRequestSaveYourselfPhase2 (smcConn2, SaveYourselfPhase2CB, NULL))
{
- SmcSaveYourselfDone (smcConn, False);
+ SmcSaveYourselfDone (smcConn2, False);
sent_save_done = 1;
}
else
@@ -917,9 +917,9 @@ SaveYourselfCB (
static void
-DieCB (SmcConn smcConn, SmPointer clientData)
+DieCB (SmcConn smcConn2, SmPointer clientData)
{
- SmcCloseConnection (smcConn, 0, NULL);
+ SmcCloseConnection (smcConn2, 0, NULL);
XtRemoveInput (iceInputId);
Done(NULL, NULL);
}
@@ -935,11 +935,11 @@ SaveCompleteCB (SmcConn smcConnm, SmPointer clientData)
static void
-ShutdownCancelledCB (SmcConn smcConn, SmPointer clientData)
+ShutdownCancelledCB (SmcConn smcConn2, SmPointer clientData)
{
if (!sent_save_done)
{
- SmcSaveYourselfDone (smcConn, False);
+ SmcSaveYourselfDone (smcConn2, False);
sent_save_done = 1;
}
}
diff --git a/src/twm.c b/src/twm.c
index 1a6ae95..ee1a3cf 100644
--- a/src/twm.c
+++ b/src/twm.c
@@ -320,7 +320,7 @@ main(int argc, char *argv[])
if (Home == NULL)
Home = "./";
- HomeLen = strlen(Home);
+ HomeLen = (int)strlen(Home);
NoClass.res_name = NoName;
NoClass.res_class = NoName;
@@ -375,7 +375,7 @@ main(int argc, char *argv[])
InfoLines = 0;
/* for simplicity, always allocate NumScreens ScreenInfo struct pointers */
- ScreenList = calloc (NumScreens, sizeof (ScreenInfo *));
+ ScreenList = calloc ((size_t)NumScreens, sizeof (ScreenInfo *));
if (ScreenList == NULL)
{
fprintf (stderr, "%s: Unable to allocate memory for screen list, exiting.\n",
@@ -927,7 +927,7 @@ sigHandler(int sig)
* cleanup and exit twm
*/
void
-Done(XtPointer client_data, XtSignalId *si)
+Done(XtPointer client_data, XtSignalId *si2)
{
if (dpy)
{
@@ -948,7 +948,7 @@ Bool ErrorOccurred = False;
XErrorEvent LastErrorEvent;
static int
-TwmErrorHandler(Display *dpy, XErrorEvent *event)
+TwmErrorHandler(Display *dpy2, XErrorEvent *event)
{
LastErrorEvent = *event;
ErrorOccurred = True;
@@ -957,13 +957,13 @@ TwmErrorHandler(Display *dpy, XErrorEvent *event)
event->error_code != BadWindow && /* watch for dead puppies */
(event->request_code != X_GetGeometry && /* of all styles */
event->error_code != BadDrawable))
- XmuPrintDefaultErrorMessage (dpy, event, stderr);
+ XmuPrintDefaultErrorMessage (dpy2, event, stderr);
return 0;
}
static int
-CatchRedirectError(Display *dpy, XErrorEvent *event)
+CatchRedirectError(Display *dpy2, XErrorEvent *event)
{
RedirectError = TRUE;
LastErrorEvent = *event;
diff --git a/src/twm.h b/src/twm.h
index 8fe2555..6e1e17c 100644
--- a/src/twm.h
+++ b/src/twm.h
@@ -212,8 +212,8 @@ typedef struct Colormaps
char *scoreboard; /* conflicts between installable colortables */
} Colormaps;
-#define ColormapsScoreboardLength(cm) ((cm)->number_cwins * \
- ((cm)->number_cwins - 1) / 2)
+#define ColormapsScoreboardLength(cm) (size_t)((cm)->number_cwins * \
+ ((cm)->number_cwins - 1) / 2)
/* for each window that is on the display, one of these structures
* is allocated and linked into a list
diff --git a/src/util.c b/src/util.c
index 303ccbf..13e4016 100644
--- a/src/util.c
+++ b/src/util.c
@@ -123,59 +123,59 @@ void MoveOutline(Window root, int x, int y, int width, int height, int bw, int t
xthird = (xinnerr - xinnerl) / 3; \
ythird = (yinnerb - yinnert) / 3; \
\
- r->x1 = xl; \
- r->y1 = yt; \
- r->x2 = xr; \
- r->y2 = yt; \
+ r->x1 = (short)(xl); \
+ r->y1 = (short)(yt); \
+ r->x2 = (short)(xr); \
+ r->y2 = (short)(yt); \
r++; \
\
- r->x1 = xl; \
- r->y1 = yb; \
- r->x2 = xr; \
- r->y2 = yb; \
+ r->x1 = (short)(xl); \
+ r->y1 = (short)(yb); \
+ r->x2 = (short)(xr); \
+ r->y2 = (short)(yb); \
r++; \
\
- r->x1 = xl; \
- r->y1 = yt; \
- r->x2 = xl; \
- r->y2 = yb; \
+ r->x1 = (short)(xl); \
+ r->y1 = (short)(yt); \
+ r->x2 = (short)(xl); \
+ r->y2 = (short)(yb); \
r++; \
\
- r->x1 = xr; \
- r->y1 = yt; \
- r->x2 = xr; \
- r->y2 = yb; \
+ r->x1 = (short)(xr); \
+ r->y1 = (short)(yt); \
+ r->x2 = (short)(xr); \
+ r->y2 = (short)(yb); \
r++; \
\
- r->x1 = xinnerl + xthird; \
- r->y1 = yinnert; \
- r->x2 = r->x1; \
- r->y2 = yinnerb; \
+ r->x1 = (short)(xinnerl + xthird); \
+ r->y1 = (short)(yinnert); \
+ r->x2 = (short)(r->x1); \
+ r->y2 = (short)(yinnerb); \
r++; \
\
- r->x1 = xinnerl + (2 * xthird); \
- r->y1 = yinnert; \
- r->x2 = r->x1; \
- r->y2 = yinnerb; \
+ r->x1 = (short)(xinnerl + (2 * xthird)); \
+ r->y1 = (short)(yinnert); \
+ r->x2 = (short)(r->x1); \
+ r->y2 = (short)(yinnerb); \
r++; \
\
- r->x1 = xinnerl; \
- r->y1 = yinnert + ythird; \
- r->x2 = xinnerr; \
- r->y2 = r->y1; \
+ r->x1 = (short)(xinnerl); \
+ r->y1 = (short)(yinnert + ythird); \
+ r->x2 = (short)(xinnerr); \
+ r->y2 = (short)(r->y1); \
r++; \
\
- r->x1 = xinnerl; \
- r->y1 = yinnert + (2 * ythird); \
- r->x2 = xinnerr; \
- r->y2 = r->y1; \
+ r->x1 = (short)(xinnerl); \
+ r->y1 = (short)(yinnert + (2 * ythird)); \
+ r->x2 = (short)(xinnerr); \
+ r->y2 = (short)(r->y1); \
r++; \
\
if (lastTH != 0) { \
- r->x1 = xl; \
- r->y1 = yt + lastTH; \
- r->x2 = xr; \
- r->y2 = r->y1; \
+ r->x1 = (short)(xl); \
+ r->y1 = (short)(yt + lastTH); \
+ r->x2 = (short)(xr); \
+ r->y2 = (short)(r->y1); \
r++; \
} \
}
@@ -198,7 +198,7 @@ void MoveOutline(Window root, int x, int y, int width, int height, int bw, int t
if (r != outline)
{
- XDrawSegments(dpy, root, Scr->DrawGC, outline, r - outline);
+ XDrawSegments(dpy, root, Scr->DrawGC, outline, (int)(r - outline));
}
}
@@ -262,11 +262,11 @@ ExpandFilename(const char *name)
if (name[0] != '~') return strdup(name);
- newname = malloc (HomeLen + strlen(name) + 2);
+ newname = malloc ((size_t)HomeLen + strlen(name) + 2);
if (!newname) {
fprintf (stderr,
"%s: unable to allocate %ld bytes to expand filename %s/%s\n",
- ProgramName, HomeLen + (unsigned long)strlen(name) + 2,
+ ProgramName, (unsigned long)HomeLen + (unsigned long)strlen(name) + 2,
Home, &name[1]);
} else {
(void) sprintf (newname, "%s/%s", Home, &name[1]);
@@ -523,13 +523,13 @@ GetColor(int kind, Pixel *what, const char *name)
if (stdcmap) {
color.pixel = (stdcmap->base_pixel +
((Pixel)(((float)color.red / 65535.0) *
- stdcmap->red_max + 0.5) *
+ (double)stdcmap->red_max + 0.5) *
stdcmap->red_mult) +
((Pixel)(((float)color.green /65535.0) *
- stdcmap->green_max + 0.5) *
+ (double)stdcmap->green_max + 0.5) *
stdcmap->green_mult) +
((Pixel)(((float)color.blue / 65535.0) *
- stdcmap->blue_max + 0.5) *
+ (double)stdcmap->blue_max + 0.5) *
stdcmap->blue_mult));
} else {
fprintf (stderr, "%s: unable to allocate color \"%s\"\n",
@@ -670,25 +670,25 @@ MyFont_TextWidth(MyFont *font, const char *string, int len)
}
void
-MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc,
+MyFont_DrawImageString(Display *dpy2, Drawable d, MyFont *font, GC gc,
int x, int y, const char *string, int len)
{
if (use_fontset) {
- XmbDrawImageString(dpy, d, font->fontset, gc, x, y, string, len);
+ XmbDrawImageString(dpy2, d, font->fontset, gc, x, y, string, len);
return;
}
- XDrawImageString (dpy, d, gc, x, y, string, len);
+ XDrawImageString (dpy2, d, gc, x, y, string, len);
}
void
-MyFont_DrawString(Display *dpy, Drawable d, MyFont *font, GC gc,
+MyFont_DrawString(Display *dpy2, Drawable d, MyFont *font, GC gc,
int x, int y, const char *string, int len)
{
if (use_fontset) {
- XmbDrawString(dpy, d, font->fontset, gc, x, y, string, len);
+ XmbDrawString(dpy2, d, font->fontset, gc, x, y, string, len);
return;
}
- XDrawString (dpy, d, gc, x, y, string, len);
+ XDrawString (dpy2, d, gc, x, y, string, len);
}
void
@@ -714,19 +714,19 @@ MyFont_ChangeGC(unsigned long fix_fore, unsigned long fix_back,
* not XFree().
*/
Status
-I18N_FetchName(Display *dpy, Window w, char **winname)
+I18N_FetchName(Display *dpy2, Window w, char **winname)
{
int status;
XTextProperty text_prop;
char **list;
int num;
- status = XGetWMName(dpy, w, &text_prop);
+ status = XGetWMName(dpy2, w, &text_prop);
if (!status || !text_prop.value || !text_prop.nitems) {
*winname = NULL;
return 0;
}
- status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num);
+ status = XmbTextPropertyToTextList(dpy2, &text_prop, &list, &num);
if (status < Success || !num || !*list) {
*winname = NULL;
return 0;
@@ -738,16 +738,16 @@ I18N_FetchName(Display *dpy, Window w, char **winname)
}
Status
-I18N_GetIconName(Display *dpy, Window w, char **iconname)
+I18N_GetIconName(Display *dpy2, Window w, char **iconname)
{
int status;
XTextProperty text_prop;
char **list;
int num;
- status = XGetWMIconName(dpy, w, &text_prop);
+ status = XGetWMIconName(dpy2, w, &text_prop);
if (!status || !text_prop.value || !text_prop.nitems) return 0;
- status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num);
+ status = XmbTextPropertyToTextList(dpy2, &text_prop, &list, &num);
if (status < Success || !num || !*list) return 0;
XFree(text_prop.value);
*iconname = (char *)strdup(*list);
@@ -786,10 +786,10 @@ CreateXLogoPixmap (unsigned *widthp, unsigned *heightp)
if (Scr->tbpm.xlogo == None) {
GC gc, gcBack;
- Scr->tbpm.xlogo = XCreatePixmap (dpy, Scr->Root, h, h, 1);
+ Scr->tbpm.xlogo = XCreatePixmap (dpy, Scr->Root, (unsigned)h, (unsigned)h, 1);
gc = XCreateGC (dpy, Scr->tbpm.xlogo, 0L, NULL);
XSetForeground (dpy, gc, 0);
- XFillRectangle (dpy, Scr->tbpm.xlogo, gc, 0, 0, h, h);
+ XFillRectangle (dpy, Scr->tbpm.xlogo, gc, 0, 0, (unsigned)h, (unsigned)h);
XSetForeground (dpy, gc, 1);
gcBack = XCreateGC (dpy, Scr->tbpm.xlogo, 0L, NULL);
XSetForeground (dpy, gcBack, 0);
@@ -798,8 +798,8 @@ CreateXLogoPixmap (unsigned *widthp, unsigned *heightp)
* draw the logo large so that it gets as dense as possible; then white
* out the edges so that they look crisp
*/
- XmuDrawLogo (dpy, Scr->tbpm.xlogo, gc, gcBack, -1, -1, h + 2, h + 2);
- XDrawRectangle (dpy, Scr->tbpm.xlogo, gcBack, 0, 0, h - 1, h - 1);
+ XmuDrawLogo (dpy, Scr->tbpm.xlogo, gc, gcBack, -1, -1, (unsigned)(h + 2), (unsigned)(h + 2));
+ XDrawRectangle (dpy, Scr->tbpm.xlogo, gcBack, 0, 0, (unsigned)(h - 1), (unsigned)(h - 1));
/*
* done drawing
@@ -827,34 +827,34 @@ CreateResizePixmap (unsigned *widthp, unsigned *heightp)
/*
* create the pixmap
*/
- Scr->tbpm.resize = XCreatePixmap (dpy, Scr->Root, h, h, 1);
+ Scr->tbpm.resize = XCreatePixmap (dpy, Scr->Root, (unsigned)h, (unsigned)h, 1);
gc = XCreateGC (dpy, Scr->tbpm.resize, 0L, NULL);
XSetForeground (dpy, gc, 0);
- XFillRectangle (dpy, Scr->tbpm.resize, gc, 0, 0, h, h);
+ XFillRectangle (dpy, Scr->tbpm.resize, gc, 0, 0, (unsigned)h, (unsigned)h);
XSetForeground (dpy, gc, 1);
lw = h / 16;
if (lw == 1)
lw = 0;
- XSetLineAttributes (dpy, gc, lw, LineSolid, CapButt, JoinMiter);
+ XSetLineAttributes (dpy, gc, (unsigned)lw, LineSolid, CapButt, JoinMiter);
/*
* draw the resize button,
*/
w = (h * 2) / 3;
- points[0].x = w;
+ points[0].x = (short)w;
points[0].y = 0;
- points[1].x = w;
- points[1].y = w;
+ points[1].x = (short)w;
+ points[1].y = (short)w;
points[2].x = 0;
- points[2].y = w;
+ points[2].y = (short)w;
XDrawLines (dpy, Scr->tbpm.resize, gc, points, 3, CoordModeOrigin);
w = w / 2;
- points[0].x = w;
+ points[0].x = (short)w;
points[0].y = 0;
- points[1].x = w;
- points[1].y = w;
+ points[1].x = (short)w;
+ points[1].y = (short)w;
points[2].x = 0;
- points[2].y = w;
+ points[2].y = (short)w;
XDrawLines (dpy, Scr->tbpm.resize, gc, points, 3, CoordModeOrigin);
/*
@@ -880,11 +880,11 @@ CreateDotPixmap (unsigned *widthp, unsigned *heightp)
GC gc;
Pixmap pix;
- pix = Scr->tbpm.delete = XCreatePixmap (dpy, Scr->Root, h, h, 1);
+ pix = Scr->tbpm.delete = XCreatePixmap (dpy, Scr->Root, (unsigned)h, (unsigned)h, 1);
gc = XCreateGC (dpy, pix, 0L, NULL);
- XSetLineAttributes (dpy, gc, h, LineSolid, CapRound, JoinRound);
+ XSetLineAttributes (dpy, gc, (unsigned)h, LineSolid, CapRound, JoinRound);
XSetForeground (dpy, gc, 0L);
- XFillRectangle (dpy, pix, gc, 0, 0, h, h);
+ XFillRectangle (dpy, pix, gc, 0, 0, (unsigned)h, (unsigned)h);
XSetForeground (dpy, gc, 1L);
XDrawLine (dpy, pix, gc, h/2, h/2, h/2, h/2);
XFreeGC (dpy, gc);
@@ -942,16 +942,16 @@ CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp)
h = 1;
if (w < 1)
w = 1;
- *widthp = w;
- *heightp = h;
+ *widthp = (unsigned)w;
+ *heightp = (unsigned)h;
if (Scr->tbpm.menu == None) {
Pixmap pix;
GC gc;
- pix = Scr->tbpm.menu = XCreatePixmap (dpy, Scr->Root, w, h, 1);
+ pix = Scr->tbpm.menu = XCreatePixmap (dpy, Scr->Root, (unsigned)w, (unsigned)h, 1);
gc = XCreateGC (dpy, pix, 0L, NULL);
XSetForeground (dpy, gc, 0L);
- XFillRectangle (dpy, pix, gc, 0, 0, w, h);
+ XFillRectangle (dpy, pix, gc, 0, 0, (unsigned)w, (unsigned)h);
XSetForeground (dpy, gc, 1L);
ix = 1;
iy = 1;
@@ -965,10 +965,10 @@ CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp)
bw = 1;
tw = mw - bw * 2;
th = mh - bw * 2;
- XFillRectangle (dpy, pix, gc, ix, iy, mw, mh);
- XFillRectangle (dpy, pix, gc, ix + iw - mw, iy + ih - mh, mw, mh);
+ XFillRectangle (dpy, pix, gc, ix, iy, (unsigned)mw, (unsigned)mh);
+ XFillRectangle (dpy, pix, gc, ix + iw - mw, iy + ih - mh, (unsigned)mw, (unsigned)mh);
XSetForeground (dpy, gc, 0L);
- XFillRectangle (dpy, pix, gc, ix+bw, iy+bw, tw, th);
+ XFillRectangle (dpy, pix, gc, ix+bw, iy+bw, (unsigned)tw, (unsigned)th);
XSetForeground (dpy, gc, 1L);
lw = tw / 2;
if ((tw & 1) ^ (lw & 1))
@@ -988,7 +988,7 @@ CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp)
dly = lh / (lines - 1);
while (lines--)
{
- XFillRectangle (dpy, pix, gc, lx, ly, lw, bw);
+ XFillRectangle (dpy, pix, gc, lx, ly, (unsigned)lw, (unsigned)bw);
ly += dly;
}
XFreeGC (dpy, gc);