Fix lots of warnings.
Incorporate changes from Andrey Mirtchovski.
This commit is contained in:
parent
64044a070a
commit
e62ba5ec0b
9 changed files with 58 additions and 25 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */
|
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
@ -124,7 +127,7 @@ top(Client *c)
|
||||||
}
|
}
|
||||||
l = &cc->next;
|
l = &cc->next;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "9wm: %x not on client list in top()\n", c);
|
fprintf(stderr, "9wm: %p not on client list in top()\n", c);
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
|
|
|
||||||
|
|
@ -144,5 +144,8 @@ extern int numhidden;
|
||||||
extern char *b3items[];
|
extern char *b3items[];
|
||||||
extern Menu b3menu;
|
extern Menu b3menu;
|
||||||
|
|
||||||
|
/* manage.c */
|
||||||
|
extern int isNew;
|
||||||
|
|
||||||
/* error.c */
|
/* error.c */
|
||||||
extern int ignore_badwindow;
|
extern int ignore_badwindow;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */
|
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
@ -35,9 +36,9 @@ handler(Display *d, XErrorEvent *e)
|
||||||
sprintf(number, "%d", e->request_code);
|
sprintf(number, "%d", e->request_code);
|
||||||
XGetErrorDatabaseText(d, "XRequest", number, "", req, sizeof(req));
|
XGetErrorDatabaseText(d, "XRequest", number, "", req, sizeof(req));
|
||||||
if (req[0] == '\0')
|
if (req[0] == '\0')
|
||||||
sprintf(req, "<request-code-%d>", e->request_code);
|
sprintf(req, "<request-code-%d>", (int)e->request_code);
|
||||||
|
|
||||||
fprintf(stderr, "9wm: %s(0x%x): %s\n", req, e->resourceid, msg);
|
fprintf(stderr, "9wm: %s(0x%x): %s\n", req, (int)e->resourceid, msg);
|
||||||
|
|
||||||
if (initting) {
|
if (initting) {
|
||||||
fprintf(stderr, "9wm: failure during initialisation; aborting\n");
|
fprintf(stderr, "9wm: failure during initialisation; aborting\n");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */
|
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
@ -90,6 +91,7 @@ mainloop(int shape_event)
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
case MapNotify:
|
case MapNotify:
|
||||||
case MappingNotify:
|
case MappingNotify:
|
||||||
|
case GraphicsExpose:
|
||||||
/* not interested */
|
/* not interested */
|
||||||
trace("ignore", 0, &ev);
|
trace("ignore", 0, &ev);
|
||||||
break;
|
break;
|
||||||
|
|
@ -173,8 +175,8 @@ mapreq(XMapRequestEvent *e)
|
||||||
|
|
||||||
if (c == 0 || c->window != e->window) {
|
if (c == 0 || c->window != e->window) {
|
||||||
/* workaround for stupid NCDware */
|
/* workaround for stupid NCDware */
|
||||||
fprintf(stderr, "9wm: bad mapreq c %x w %x, rescanning\n",
|
fprintf(stderr, "9wm: bad mapreq c %p w %x, rescanning\n",
|
||||||
c, e->window);
|
c, (int)e->window);
|
||||||
for (i = 0; i < num_screens; i++)
|
for (i = 0; i < num_screens; i++)
|
||||||
scanwins(&screens[i]);
|
scanwins(&screens[i]);
|
||||||
c = getclient(e->window, 0);
|
c = getclient(e->window, 0);
|
||||||
|
|
@ -305,11 +307,11 @@ clientmesg(XClientMessageEvent *e)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf(stderr, "9wm: WM_CHANGE_STATE: format %d data %d w 0x%x\n",
|
fprintf(stderr, "9wm: WM_CHANGE_STATE: format %d data %d w 0x%x\n",
|
||||||
e->format, e->data.l[0], e->window);
|
(int)e->format, (int)e->data.l[0], (int)e->window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "9wm: strange ClientMessage, type 0x%x window 0x%x\n",
|
fprintf(stderr, "9wm: strange ClientMessage, type 0x%x window 0x%x\n",
|
||||||
e->message_type, e->window);
|
(int)e->message_type, (int)e->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@
|
||||||
#define trace(s, c, e)
|
#define trace(s, c, e)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define setstate setstate9wm
|
||||||
|
|
||||||
|
|
||||||
/* color.c */
|
/* color.c */
|
||||||
unsigned long colorpixel(Display*, int, unsigned long);
|
unsigned long colorpixel(Display*, int, unsigned long);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ menuhit(XButtonEvent *e, Menu *m)
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
int i, n, cur, old, wide, high, status, drawn, warp;
|
int i, n, cur, old, wide, high, status, drawn, warp;
|
||||||
int x, y, dx, dy, xmax, ymax;
|
int x, y, dx, dy, xmax, ymax;
|
||||||
int tx, ty;
|
|
||||||
ScreenInfo *s;
|
ScreenInfo *s;
|
||||||
|
|
||||||
if (font == 0)
|
if (font == 0)
|
||||||
|
|
@ -231,10 +230,12 @@ sweepcalc(Client *c, int x, int y)
|
||||||
dx = x - c->x;
|
dx = x - c->x;
|
||||||
dy = y - c->y;
|
dy = y - c->y;
|
||||||
sx = sy = 1;
|
sx = sy = 1;
|
||||||
|
x += dx;
|
||||||
if (dx < 0) {
|
if (dx < 0) {
|
||||||
dx = -dx;
|
dx = -dx;
|
||||||
sx = -1;
|
sx = -1;
|
||||||
}
|
}
|
||||||
|
y += dy;
|
||||||
if (dy < 0) {
|
if (dy < 0) {
|
||||||
dy = -dy;
|
dy = -dy;
|
||||||
sy = -1;
|
sy = -1;
|
||||||
|
|
@ -268,8 +269,8 @@ sweepcalc(Client *c, int x, int y)
|
||||||
void
|
void
|
||||||
dragcalc(Client *c, int x, int y)
|
dragcalc(Client *c, int x, int y)
|
||||||
{
|
{
|
||||||
c->x = x;
|
c->x += x;
|
||||||
c->y = y;
|
c->y += y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -366,9 +367,12 @@ sweepdrag(Client *c, XButtonEvent *e0, void (*recalc)(Client*, int, int))
|
||||||
c->dx += 2*BORDER;
|
c->dx += 2*BORDER;
|
||||||
c->dy += 2*BORDER;
|
c->dy += 2*BORDER;
|
||||||
if (e0) {
|
if (e0) {
|
||||||
|
getmouse(&c->x, &c->y, c->screen);
|
||||||
|
/*
|
||||||
c->x = cx = e0->x;
|
c->x = cx = e0->x;
|
||||||
c->y = cy = e0->y;
|
c->y = cy = e0->y;
|
||||||
recalc(c, e0->x, e0->y);
|
recalc(c, e0->x, e0->y);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
getmouse(&cx, &cy, c->screen);
|
getmouse(&cx, &cy, c->screen);
|
||||||
|
|
@ -387,7 +391,10 @@ sweepdrag(Client *c, XButtonEvent *e0, void (*recalc)(Client*, int, int))
|
||||||
XGrabServer(dpy);
|
XGrabServer(dpy);
|
||||||
idle = 0;
|
idle = 0;
|
||||||
}
|
}
|
||||||
|
if(e0)
|
||||||
recalc(c, rx, ry);
|
recalc(c, rx, ry);
|
||||||
|
else
|
||||||
|
recalc(c, rx-cx, ry-cy);
|
||||||
cx = rx;
|
cx = rx;
|
||||||
cy = ry;
|
cy = ry;
|
||||||
drawbound(c, 1);
|
drawbound(c, 1);
|
||||||
|
|
@ -405,7 +412,6 @@ sweepdrag(Client *c, XButtonEvent *e0, void (*recalc)(Client*, int, int))
|
||||||
XUngrabServer(dpy);
|
XUngrabServer(dpy);
|
||||||
if (e->button != Button3 && c->init)
|
if (e->button != Button3 && c->init)
|
||||||
goto bad;
|
goto bad;
|
||||||
recalc(c, ev.xbutton.x, ev.xbutton.y);
|
|
||||||
if (c->dx < 0) {
|
if (c->dx < 0) {
|
||||||
c->x += c->dx;
|
c->x += c->dx;
|
||||||
c->dx = -c->dx;
|
c->dx = -c->dx;
|
||||||
|
|
@ -466,13 +472,6 @@ drag(Client *c)
|
||||||
ScreenInfo *s;
|
ScreenInfo *s;
|
||||||
|
|
||||||
s = c->screen;
|
s = c->screen;
|
||||||
if (c->init)
|
|
||||||
setmouse(c->x-BORDER, c->y-BORDER, s);
|
|
||||||
else {
|
|
||||||
getmouse(&c->x, &c->y, s); /* start at current mouse pos */
|
|
||||||
c->x += BORDER;
|
|
||||||
c->y += BORDER;
|
|
||||||
}
|
|
||||||
status = grab(s->root, s->root, ButtonMask, s->boxcurs, 0);
|
status = grab(s->root, s->root, ButtonMask, s->boxcurs, 0);
|
||||||
if (status != GrabSuccess) {
|
if (status != GrabSuccess) {
|
||||||
graberror("drag", status); /* */
|
graberror("drag", status); /* */
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
@ -47,7 +49,8 @@ Atom _9wm_hold_mode;
|
||||||
char *fontlist[] = {
|
char *fontlist[] = {
|
||||||
"lucm.latin1.9",
|
"lucm.latin1.9",
|
||||||
"blit",
|
"blit",
|
||||||
"lucidasanstypewriter-bold-10",
|
"*-lucidatypewriter-bold-*-14-*-75-*",
|
||||||
|
"*-lucidatypewriter-medium-*-12-*-75-*",
|
||||||
"9x15bold",
|
"9x15bold",
|
||||||
"fixed",
|
"fixed",
|
||||||
"*",
|
"*",
|
||||||
|
|
@ -66,8 +69,9 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, background, do_exit, do_restart;
|
int i, background, do_exit, do_restart;
|
||||||
char *fname;
|
char *fname;
|
||||||
int shape_event, dummy;
|
int shape_event;
|
||||||
|
|
||||||
|
shape_event = 0;
|
||||||
myargv = argv; /* for restart */
|
myargv = argv; /* for restart */
|
||||||
|
|
||||||
do_exit = do_restart = 0;
|
do_exit = do_restart = 0;
|
||||||
|
|
@ -195,6 +199,7 @@ main(int argc, char *argv[])
|
||||||
scanwins(&screens[i]);
|
scanwins(&screens[i]);
|
||||||
|
|
||||||
mainloop(shape_event);
|
mainloop(shape_event);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */
|
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
@ -9,6 +10,8 @@
|
||||||
#include "dat.h"
|
#include "dat.h"
|
||||||
#include "fns.h"
|
#include "fns.h"
|
||||||
|
|
||||||
|
int isNew;
|
||||||
|
|
||||||
int
|
int
|
||||||
manage(Client *c, int mapped)
|
manage(Client *c, int mapped)
|
||||||
{
|
{
|
||||||
|
|
@ -25,7 +28,11 @@ manage(Client *c, int mapped)
|
||||||
if (XGetClassHint(dpy, c->window, &class) != 0) { /* ``Success'' */
|
if (XGetClassHint(dpy, c->window, &class) != 0) { /* ``Success'' */
|
||||||
c->instance = class.res_name;
|
c->instance = class.res_name;
|
||||||
c->class = class.res_class;
|
c->class = class.res_class;
|
||||||
c->is9term = (strcmp(c->class, "9term") == 0);
|
c->is9term = 0;
|
||||||
|
if(isNew){
|
||||||
|
c->is9term = strstr(c->class, "term") || strstr(c->class, "Term");
|
||||||
|
isNew = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c->instance = 0;
|
c->instance = 0;
|
||||||
|
|
@ -257,7 +264,7 @@ gravitate(Client *c, int invert)
|
||||||
dy = 2*delta;
|
dy = 2*delta;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "9wm: bad window gravity %d for 0x%x\n", gravity, c->window);
|
fprintf(stderr, "9wm: bad window gravity %d for 0x%x\n", gravity, (int)c->window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dx += BORDER;
|
dx += BORDER;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */
|
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
@ -102,6 +105,13 @@ button(XButtonEvent *e)
|
||||||
void
|
void
|
||||||
spawn(ScreenInfo *s)
|
spawn(ScreenInfo *s)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* ugly dance to cause sweeping for terminals.
|
||||||
|
* the very next window created will require sweeping.
|
||||||
|
* hope it's created by the program we're about to
|
||||||
|
* exec!
|
||||||
|
*/
|
||||||
|
isNew = 1;
|
||||||
/*
|
/*
|
||||||
* ugly dance to avoid leaving zombies. Could use SIGCHLD,
|
* ugly dance to avoid leaving zombies. Could use SIGCHLD,
|
||||||
* but it's not very portable.
|
* but it's not very portable.
|
||||||
|
|
@ -206,7 +216,7 @@ unhide(int n, int map)
|
||||||
c = hiddenc[n];
|
c = hiddenc[n];
|
||||||
if (!hidden(c)) {
|
if (!hidden(c)) {
|
||||||
fprintf(stderr, "9wm: unhide: not hidden: %s(0x%x)\n",
|
fprintf(stderr, "9wm: unhide: not hidden: %s(0x%x)\n",
|
||||||
c->label, c->window);
|
c->label, (int)c->window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -237,7 +247,7 @@ unhidec(Client *c, int map)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "9wm: unhidec: not hidden: %s(0x%x)\n",
|
fprintf(stderr, "9wm: unhidec: not hidden: %s(0x%x)\n",
|
||||||
c->label, c->window);
|
c->label, (int)c->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue