[hackers] [wmii] Allow setting of increment display from /ctl. Fix CONFVERSION. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Sat, 30 Aug 2008 21:49:26 +0000 (UTC)

changeset: 2341:b1f98dc5ca55
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Jun 02 11:58:27 2008 -0400
files: cmd/wmii/column.c cmd/wmii/dat.h cmd/wmii/layout.c cmd/wmii/main.c cmd/wmii/message.c cmd/wmii/mouse.c mk/wmii.mk
description:
Allow setting of increment display from /ctl. Fix CONFVERSION.

diff -r 295c068bb367 -r b1f98dc5ca55 cmd/wmii/column.c
--- a/cmd/wmii/column.c Mon Jun 02 11:52:29 2008 -0400
+++ b/cmd/wmii/column.c Mon Jun 02 11:58:27 2008 -0400
@@ -61,31 +61,13 @@
         }
         free(orig);
         return true;
-
-#ifdef notdef
- int i;
-
- i = str2colmode(mode);
- if(i == -1)
- return false;
- a->mode = i;
- a->max = false;
- if(i == Colmax) {
- a->mode = Colstack;
- a->max = true;
- }
- return true;
-#endif
 }
 
 char*
 column_getmode(Area *a) {
 
- if(a->mode == Coldefault)
- return "default";
- if(a->max)
- return "max";
- return "stack";
+ return sxprint("%s%cmax", a->mode == Colstack ? "stack" : "default",
+ a->max ? '+' : '-');
 }
 
 Area*
@@ -408,7 +390,7 @@
                 f->colr = rectsetorigin(f->colr, Pt(a->r.min.x, yoffcr));
                 f->r.min.x = a->r.min.x;
                 f->r.max.x = a->r.max.x;
- if(def.incmode == ISqueeze)
+ if(def.incmode == ISqueeze && !resizing)
                 if(!f->collapsed) {
                         f->r.max.y += surplus;
                         if(n-- > 0)
@@ -535,7 +517,7 @@
                 frame_resize(f, f->colr);
         }
 
- if(def.incmode == ISqueeze)
+ if(def.incmode == ISqueeze && !resizing)
                 column_squeeze(a);
         column_settle(a);
 }
diff -r 295c068bb367 -r b1f98dc5ca55 cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Mon Jun 02 11:52:29 2008 -0400
+++ b/cmd/wmii/dat.h Mon Jun 02 11:58:27 2008 -0400
@@ -32,9 +32,9 @@
 };
 
 enum IncMode {
+ IIgnore,
+ IShow,
         ISqueeze,
- IShow,
- IIgnore,
 };
 
 enum {
@@ -81,7 +81,7 @@
         CurNormal,
         CurNECorner, CurNWCorner, CurSECorner, CurSWCorner,
         CurDHArrow, CurDVArrow, CurMove, CurInput, CurSizing,
- CurIcon,
+ CurTCross, CurIcon,
         CurNone,
         CurLast,
 };
diff -r 295c068bb367 -r b1f98dc5ca55 cmd/wmii/layout.c
--- a/cmd/wmii/layout.c Mon Jun 02 11:52:29 2008 -0400
+++ b/cmd/wmii/layout.c Mon Jun 02 11:58:27 2008 -0400
@@ -246,7 +246,6 @@
         Frame *f;
         Point p;
         float x, y;
- int incmode;
 
         f = c->sel;
 
@@ -256,8 +255,6 @@
                 y = (float)p.y / Dy(f->r);
         }
 
- incmode = def.incmode;
- def.incmode = IShow;
         resizing = true;
         view_update(f->view);
         warppointer(grabboxcenter(f));
@@ -267,7 +264,6 @@
         else
                 trampoline(THCol, f);
 
- def.incmode = incmode;
         resizing = false;
         view_update(f->view);
         if(grabmod)
diff -r 295c068bb367 -r b1f98dc5ca55 cmd/wmii/main.c
--- a/cmd/wmii/main.c Mon Jun 02 11:52:29 2008 -0400
+++ b/cmd/wmii/main.c Mon Jun 02 11:58:27 2008 -0400
@@ -120,6 +120,7 @@
         create_cursor(CurInput, XC_xterm);
         create_cursor(CurSizing, XC_sizing);
         create_cursor(CurIcon, XC_icon);
+ create_cursor(CurTCross, XC_tcross);
 
         XAllocNamedColor(display, scr.colormap,
                         "black", &black, &dummy);
@@ -209,9 +210,15 @@
         srv.running = false;
 
         switch(signal) {
+ case SIGTERM:
+ sa.sa_handler = cleanup_handler;
+ sigaction(SIGALRM, &sa, nil);
+ alarm(1);
         default:
                 exitsignal = signal;
                 break;
+ case SIGALRM:
+ raise(SIGTERM);
         case SIGINT:
                 break;
         }
@@ -230,7 +237,7 @@
                 close(ConnectionNumber(display));
                 setsid();
 
- display = XOpenDisplay(0);
+ display = XOpenDisplay(nil);
                 if(!display)
                         fatal("Can't open display");
 
@@ -365,9 +372,10 @@
         ixp_listen(&srv, sock, &p9srv, serve_9pcon, nil);
         ixp_listen(&srv, ConnectionNumber(display), nil, check_x_event, closedisplay);
 
- def.font = loadfont(FONT);
         def.border = 1;
         def.colmode = Coldefault;
+ def.font = loadfont(FONT);
+ def.incmode = ISqueeze;
 
         def.mod = Mod1Mask;
         strcpy(def.grabmod, "Mod1");
diff -r 295c068bb367 -r b1f98dc5ca55 cmd/wmii/message.c
--- a/cmd/wmii/message.c Mon Jun 02 11:52:29 2008 -0400
+++ b/cmd/wmii/message.c Mon Jun 02 11:58:27 2008 -0400
@@ -31,6 +31,7 @@
         LFONT,
         LGRABMOD,
         LGROW,
+ LINCMODE,
         LKILL,
         LLEFT,
         LNORMCOLORS,
@@ -63,6 +64,7 @@
         "font",
         "grabmod",
         "grow",
+ "incmode",
         "kill",
         "left",
         "normcolors",
@@ -91,8 +93,13 @@
 };
 
 static char* barpostab[] = {
- [BBottom] = "bottom",
- [BTop] = "top",
+ "bottom",
+ "top",
+};
+static char* incmodetab[] = {
+ "ignore",
+ "show",
+ "squeeze",
 };
 
 /* Edit ,y/^[a-zA-Z].*\n.* {\n/d
@@ -134,9 +141,14 @@
         return _bsearch(s, debugtab, nelem(debugtab));
 }
 
-static int
-getbarpos(char *s) {
- return _bsearch(s, barpostab, nelem(barpostab));
+static bool
+setdef(int *ptr, char *s, char *tab[], int ntab) {
+ int i;
+
+ i = _bsearch(s, tab, ntab);
+ if(i >= 0)
+ *ptr = i;
+ return i >= 0;
 }
 
 static int
@@ -417,7 +429,6 @@
         Font *fn;
         char *s, *ret;
         ulong n;
- int i;
 
         USED(p);
         ret = nil;
@@ -430,10 +441,8 @@
                 s = msg_getword(m);
                 if(!strcmp(s, "on"))
                         s = msg_getword(m);
- i = getbarpos(s);
- if(i < 0)
+ if(!setdef(&screen->barpos, s, barpostab, nelem(barpostab)))
                         return Ebadvalue;
- screen->barpos = i;
                 view_update(screen->sel);
                 break;
         case LBORDER:
@@ -473,12 +482,17 @@
                 utflcpy(def.grabmod, s, sizeof def.grabmod);
                 def.mod = n;
                 break;
+ case LINCMODE:
+ if(!setdef(&def.incmode, msg_getword(m), incmodetab, nelem(incmodetab)))
+ return Ebadvalue;
+ view_update(screen->sel);
+ break;
         case LNORMCOLORS:
                 ret = msg_parsecolors(m, &def.normcolor);
                 view_update(screen->sel);
                 break;
         case LSELCOLORS:
- fprint(2, "%s: warning: selcolors have been removed\n", argv0);
+ warning("selcolors have been removed");
                 return Ebadcmd;
         case LVIEW:
                 view_select(m->pos);
@@ -1033,13 +1047,8 @@
 char*
 readctl_root(void) {
         bufclear();
- bufprint("view %s\n", screen->sel->name);
- bufprint("focuscolors %s\n", def.focuscolor.colstr);
- bufprint("normcolors %s\n", def.normcolor.colstr);
- bufprint("font %s\n", def.font->name);
- bufprint("grabmod %s\n", def.grabmod);
+ bufprint("bar on %s\n", barpostab[screen->barpos]);
         bufprint("border %d\n", def.border);
- bufprint("bar on %s\n", barpostab[screen->barpos]);
         if(debugflag) {
                 bufprint("debug ");
                 printdebug(debugflag);
@@ -1050,6 +1059,12 @@
                 printdebug(debugfile);
                 bufprint("\n");
         }
+ bufprint("focuscolors %s\n", def.focuscolor.colstr);
+ bufprint("font %s\n", def.font->name);
+ bufprint("grabmod %s\n", def.grabmod);
+ bufprint("incmode %s\n", incmodetab[screen->barpos]);
+ bufprint("normcolors %s\n", def.normcolor.colstr);
+ bufprint("view %s\n", screen->sel->name);
         return buffer;
 }
 
diff -r 295c068bb367 -r b1f98dc5ca55 cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Mon Jun 02 11:52:29 2008 -0400
+++ b/cmd/wmii/mouse.c Mon Jun 02 11:58:27 2008 -0400
@@ -128,9 +128,10 @@
 
 #undef frob
 
-/* Returns a gravity for increment handling. It's normally the opposite of the mask
- * (the directions that we're resizing in), unless a snap occurs, in which case, it's the
- * direction of the snap.
+/* Returns a gravity for increment handling. It's normally the
+ * opposite of the mask (the directions that we're resizing in),
+ * unless a snap occurs, in which case, it's the direction of the
+ * snap.
  */
 Align
 snap_rect(Rectangle *rects, int num, Rectangle *r, Align *mask, int snap) {
@@ -588,7 +589,7 @@
         r = rectsubpt(f->r, f->r.min);
         q = quadrant(r, p);
         if(rect_haspoint_p(p, f->grabbox)) {
- cur = cursor[CurMove];
+ cur = cursor[CurTCross];
                 if(exec) mouse_movegrabbox(f->client, false);
         }
         else if(f->area->floating) {
diff -r 295c068bb367 -r b1f98dc5ca55 mk/wmii.mk
--- a/mk/wmii.mk Mon Jun 02 11:52:29 2008 -0400
+++ b/mk/wmii.mk Mon Jun 02 11:58:27 2008 -0400
@@ -3,4 +3,5 @@
 VERSION = $(VERS)
 VERSION := $(shell echo $(VERS) 2>/dev/null)
 VERSION != echo $(VERS) 2>/dev/null
-CONFVERSION = 3.5
+CONFVERSION = hg
+
Received on Sat Aug 30 2008 - 21:49:26 UTC

This archive was generated by hypermail 2.2.0 : Sat Aug 30 2008 - 22:00:08 UTC