diff options
-rw-r--r-- | src/cmd/rio/client.c | 5 | ||||
-rw-r--r-- | src/cmd/rio/dat.h | 3 | ||||
-rw-r--r-- | src/cmd/rio/error.c | 5 | ||||
-rw-r--r-- | src/cmd/rio/event.c | 10 | ||||
-rw-r--r-- | src/cmd/rio/fns.h | 3 | ||||
-rw-r--r-- | src/cmd/rio/grab.c | 23 | ||||
-rw-r--r-- | src/cmd/rio/main.c | 9 | ||||
-rw-r--r-- | src/cmd/rio/manage.c | 11 | ||||
-rw-r--r-- | src/cmd/rio/menu.c | 14 |
9 files changed, 58 insertions, 25 deletions
diff --git a/src/cmd/rio/client.c b/src/cmd/rio/client.c index 9e346558..f3f51073 100644 --- a/src/cmd/rio/client.c +++ b/src/cmd/rio/client.c @@ -1,5 +1,8 @@ /* Copyright (c) 1994-1996 David Hogan, see README for licence details */ #include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -124,7 +127,7 @@ top(Client *c) } 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 * diff --git a/src/cmd/rio/dat.h b/src/cmd/rio/dat.h index ac5ee155..3f1a246e 100644 --- a/src/cmd/rio/dat.h +++ b/src/cmd/rio/dat.h @@ -144,5 +144,8 @@ extern int numhidden; extern char *b3items[]; extern Menu b3menu; +/* manage.c */ +extern int isNew; + /* error.c */ extern int ignore_badwindow; diff --git a/src/cmd/rio/error.c b/src/cmd/rio/error.c index 731da9fc..40768119 100644 --- a/src/cmd/rio/error.c +++ b/src/cmd/rio/error.c @@ -1,5 +1,6 @@ /* Copyright (c) 1994-1996 David Hogan, see README for licence details */ #include <stdio.h> +#include <stdlib.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -35,9 +36,9 @@ handler(Display *d, XErrorEvent *e) sprintf(number, "%d", e->request_code); XGetErrorDatabaseText(d, "XRequest", number, "", req, sizeof(req)); 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) { fprintf(stderr, "9wm: failure during initialisation; aborting\n"); diff --git a/src/cmd/rio/event.c b/src/cmd/rio/event.c index 1b27e85a..9b9b2907 100644 --- a/src/cmd/rio/event.c +++ b/src/cmd/rio/event.c @@ -1,5 +1,6 @@ /* Copyright (c) 1994-1996 David Hogan, see README for licence details */ #include <stdio.h> +#include <stdlib.h> #include <X11/X.h> #include <X11/Xos.h> #include <X11/Xlib.h> @@ -90,6 +91,7 @@ mainloop(int shape_event) case ConfigureNotify: case MapNotify: case MappingNotify: + case GraphicsExpose: /* not interested */ trace("ignore", 0, &ev); break; @@ -173,8 +175,8 @@ mapreq(XMapRequestEvent *e) if (c == 0 || c->window != e->window) { /* workaround for stupid NCDware */ - fprintf(stderr, "9wm: bad mapreq c %x w %x, rescanning\n", - c, e->window); + fprintf(stderr, "9wm: bad mapreq c %p w %x, rescanning\n", + c, (int)e->window); for (i = 0; i < num_screens; i++) scanwins(&screens[i]); c = getclient(e->window, 0); @@ -305,11 +307,11 @@ clientmesg(XClientMessageEvent *e) } else 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; } 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 diff --git a/src/cmd/rio/fns.h b/src/cmd/rio/fns.h index bfb9df88..b6e1991a 100644 --- a/src/cmd/rio/fns.h +++ b/src/cmd/rio/fns.h @@ -6,6 +6,9 @@ #define trace(s, c, e) #endif +#define setstate setstate9wm + + /* color.c */ unsigned long colorpixel(Display*, int, unsigned long); diff --git a/src/cmd/rio/grab.c b/src/cmd/rio/grab.c index 233233d8..bcc14005 100644 --- a/src/cmd/rio/grab.c +++ b/src/cmd/rio/grab.c @@ -63,7 +63,6 @@ menuhit(XButtonEvent *e, Menu *m) XEvent ev; int i, n, cur, old, wide, high, status, drawn, warp; int x, y, dx, dy, xmax, ymax; - int tx, ty; ScreenInfo *s; if (font == 0) @@ -231,10 +230,12 @@ sweepcalc(Client *c, int x, int y) dx = x - c->x; dy = y - c->y; sx = sy = 1; + x += dx; if (dx < 0) { dx = -dx; sx = -1; } + y += dy; if (dy < 0) { dy = -dy; sy = -1; @@ -268,8 +269,8 @@ sweepcalc(Client *c, int x, int y) void dragcalc(Client *c, int x, int y) { - c->x = x; - c->y = y; + c->x += x; + c->y += y; } static void @@ -366,9 +367,12 @@ sweepdrag(Client *c, XButtonEvent *e0, void (*recalc)(Client*, int, int)) c->dx += 2*BORDER; c->dy += 2*BORDER; if (e0) { + getmouse(&c->x, &c->y, c->screen); +/* c->x = cx = e0->x; c->y = cy = e0->y; recalc(c, e0->x, e0->y); +*/ } else getmouse(&cx, &cy, c->screen); @@ -387,7 +391,10 @@ sweepdrag(Client *c, XButtonEvent *e0, void (*recalc)(Client*, int, int)) XGrabServer(dpy); idle = 0; } - recalc(c, rx, ry); + if(e0) + recalc(c, rx, ry); + else + recalc(c, rx-cx, ry-cy); cx = rx; cy = ry; drawbound(c, 1); @@ -405,7 +412,6 @@ sweepdrag(Client *c, XButtonEvent *e0, void (*recalc)(Client*, int, int)) XUngrabServer(dpy); if (e->button != Button3 && c->init) goto bad; - recalc(c, ev.xbutton.x, ev.xbutton.y); if (c->dx < 0) { c->x += c->dx; c->dx = -c->dx; @@ -466,13 +472,6 @@ drag(Client *c) ScreenInfo *s; 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); if (status != GrabSuccess) { graberror("drag", status); /* */ diff --git a/src/cmd/rio/main.c b/src/cmd/rio/main.c index d9bec822..b1d0c1a0 100644 --- a/src/cmd/rio/main.c +++ b/src/cmd/rio/main.c @@ -2,6 +2,8 @@ #include <stdio.h> #include <signal.h> #include <errno.h> +#include <stdlib.h> +#include <unistd.h> #include <X11/X.h> #include <X11/Xos.h> #include <X11/Xlib.h> @@ -47,7 +49,8 @@ Atom _9wm_hold_mode; char *fontlist[] = { "lucm.latin1.9", "blit", - "lucidasanstypewriter-bold-10", + "*-lucidatypewriter-bold-*-14-*-75-*", + "*-lucidatypewriter-medium-*-12-*-75-*", "9x15bold", "fixed", "*", @@ -66,8 +69,9 @@ main(int argc, char *argv[]) { int i, background, do_exit, do_restart; char *fname; - int shape_event, dummy; + int shape_event; + shape_event = 0; myargv = argv; /* for restart */ do_exit = do_restart = 0; @@ -195,6 +199,7 @@ main(int argc, char *argv[]) scanwins(&screens[i]); mainloop(shape_event); + return 0; } void diff --git a/src/cmd/rio/manage.c b/src/cmd/rio/manage.c index 3384daf2..94e6bf9c 100644 --- a/src/cmd/rio/manage.c +++ b/src/cmd/rio/manage.c @@ -1,5 +1,6 @@ /* Copyright (c) 1994-1996 David Hogan, see README for licence details */ #include <stdio.h> +#include <stdlib.h> #include <X11/X.h> #include <X11/Xos.h> #include <X11/Xlib.h> @@ -9,6 +10,8 @@ #include "dat.h" #include "fns.h" +int isNew; + int manage(Client *c, int mapped) { @@ -25,7 +28,11 @@ manage(Client *c, int mapped) if (XGetClassHint(dpy, c->window, &class) != 0) { /* ``Success'' */ c->instance = class.res_name; 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 { c->instance = 0; @@ -257,7 +264,7 @@ gravitate(Client *c, int invert) dy = 2*delta; break; 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; } dx += BORDER; diff --git a/src/cmd/rio/menu.c b/src/cmd/rio/menu.c index 54453954..2e875b4e 100644 --- a/src/cmd/rio/menu.c +++ b/src/cmd/rio/menu.c @@ -1,6 +1,9 @@ /* Copyright (c) 1994-1996 David Hogan, see README for licence details */ #include <stdio.h> #include <signal.h> +#include <unistd.h> +#include <stdlib.h> +#include <sys/wait.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -103,6 +106,13 @@ void 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, * but it's not very portable. */ @@ -206,7 +216,7 @@ unhide(int n, int map) c = hiddenc[n]; if (!hidden(c)) { fprintf(stderr, "9wm: unhide: not hidden: %s(0x%x)\n", - c->label, c->window); + c->label, (int)c->window); return; } @@ -237,7 +247,7 @@ unhidec(Client *c, int map) return; } fprintf(stderr, "9wm: unhidec: not hidden: %s(0x%x)\n", - c->label, c->window); + c->label, (int)c->window); } void |