[hackers] [wmii] More work on Xinerama || Kris Maglione

From: <hg_AT_suckless.org>
Date: Tue, 14 Oct 2008 08:54:39 +0000 (UTC)

changeset: 2364:23284ce3261e
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Oct 14 04:54:35 2008 -0400
files: cmd/wmii/_util.c cmd/wmii/area.c cmd/wmii/client.c cmd/wmii/div.c cmd/wmii/ewmh.c cmd/wmii/fns.h cmd/wmii/layout.c cmd/wmii/main.c cmd/wmii/message.c cmd/wmii/view.c config.mk
description:
More work on Xinerama

diff -r 20adda22f741 -r 23284ce3261e cmd/wmii/_util.c
--- a/cmd/wmii/_util.c Tue Oct 14 02:55:29 2008 -0400
+++ b/cmd/wmii/_util.c Tue Oct 14 04:54:35 2008 -0400
@@ -163,10 +163,6 @@
                 goto done;
         }
 
- /* Why? Because gdb freezes waiting for user input
- * if its stdout is a tty.
- * Might be easier to pipe to sed 2,4d here.
- */
         Biobuf bp;
         char *s;
 
diff -r 20adda22f741 -r 23284ce3261e cmd/wmii/area.c
--- a/cmd/wmii/area.c Tue Oct 14 02:55:29 2008 -0400
+++ b/cmd/wmii/area.c Tue Oct 14 04:54:35 2008 -0400
@@ -102,6 +102,7 @@
         if(!v->floating) {
                 v->floating = a;
                 a->floating = true;
+ a->screen = -1;
         }
         else if(pos) {
                 a->next = pos->next;
diff -r 20adda22f741 -r 23284ce3261e cmd/wmii/client.c
--- a/cmd/wmii/client.c Tue Oct 14 02:55:29 2008 -0400
+++ b/cmd/wmii/client.c Tue Oct 14 04:54:35 2008 -0400
@@ -108,6 +108,7 @@
 
         depth = scr.depth;
         vis = scr.visual;
+ /* XXX: Multihead. */
         c->ibuf = &screen->ibuf;
         if(render_argb_p(wa->visual)) {
                 depth = 32;
diff -r 20adda22f741 -r 23284ce3261e cmd/wmii/div.c
--- a/cmd/wmii/div.c Tue Oct 14 02:55:29 2008 -0400
+++ b/cmd/wmii/div.c Tue Oct 14 04:54:35 2008 -0400
@@ -117,12 +117,13 @@
         Divide **dp, *d;
         Area *a;
         View *v;
+ int s;
 
         update_imgs();
 
         v = screen->sel;
         dp = &divs;
- for(a = v->firstarea; a; a = a->next) {
+ foreach_area(v, s, a) {
                 d = getdiv(dp);
                 dp = &d->next;
                 div_set(d, a->r.min.x);
diff -r 20adda22f741 -r 23284ce3261e cmd/wmii/ewmh.c
--- a/cmd/wmii/ewmh.c Tue Oct 14 02:55:29 2008 -0400
+++ b/cmd/wmii/ewmh.c Tue Oct 14 04:54:35 2008 -0400
@@ -91,16 +91,16 @@
         Frame *f;
         Area *a;
         View *v;
- int i;
+ int s;
 
         vector_linit(&vec);
 
- for(v=view; v; v=v->next) /* Wow... */
- for(i=0; i < nscreens; i++)
- for(a=v->areas[i]; a; a=a->next)
- for(f=a->frame; f; f=f->anext)
- if(f->client->sel == f)
- vector_lpush(&vec, f->client->w.w);
+ for(v=view; v; v=v->next) {
+ foreach_column(v, s, a)
+ for(f=a->frame; f; f=f->anext)
+ if(f->client->sel == f)
+ vector_lpush(&vec, f->client->w.w);
+ }
         for(v=view; v; v=v->next) {
                 for(f=v->floating->stack; f; f=f->snext)
                         if(!f->snext) break;
diff -r 20adda22f741 -r 23284ce3261e cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Tue Oct 14 02:55:29 2008 -0400
+++ b/cmd/wmii/fns.h Tue Oct 14 04:54:35 2008 -0400
@@ -12,6 +12,21 @@
 # pragma varargck type "C" Client*
 # pragma varargck type "r" void
 #endif
+
+#define foreach_area(v, s, a) \
+ Area *__anext; /* Getting ugly... */ \
+ for(s=0; s <= nscreens; s++) \
+ for((a)=(s < nscreens ? (v)->areas[s] : v->floating), __anext=(a)->next; (a); (void)(((a)=__anext) && (__anext=(a)->next)))
+
+#define foreach_column(v, s, a) \
+ Area *__anext; /* Getting ugly... */ \
+ for(s=0; s < nscreens; s++) \
+ for((a)=(v)->areas[s], __anext=(a)->next; (a); (void)(((a)=__anext) && (__anext=(a)->next)))
+
+#define foreach_frame(v, s, a, f) \
+ Frame *__fnext; \
+ foreach_area(v, s, a) \
+ for((void)(((f)=(a)->frame) && (__fnext=(f)->anext)); (f); (void)(((f)=__fnext) && (__fnext=(f)->anext)))
 
 #define btassert(arg, cond) \
         (cond ? fprint(1, __FILE__":%d: failed assertion: " #cond "\n", __LINE__), backtrace(arg), true : false)
diff -r 20adda22f741 -r 23284ce3261e cmd/wmii/layout.c
--- a/cmd/wmii/layout.c Tue Oct 14 02:55:29 2008 -0400
+++ b/cmd/wmii/layout.c Tue Oct 14 04:54:35 2008 -0400
@@ -125,13 +125,20 @@
         Area *a;
         View *v;
         long l;
- int hr;
+ int hr, s;
 
         v = screen->sel;
 
- for(a = v->firstarea; a->next; a = a->next)
- if(pt.x < a->r.max.x)
- break;
+ /* XXX: Multihead. Check this over. */
+ for(s=0; s < nscreens; s++) {
+ if(!rect_haspoint_p(pt, screen[s].r))
+ continue;
+ for(a=v->areas[s]; a; a=a->next)
+ if(pt.x < a->r.max.x)
+ goto found;
+ }
+ return; /* XXX: Multihead. */
+found:
         fw->ra = a;
 
         pt.x = a->r.min.x;
@@ -175,12 +182,13 @@
 hplace(Framewin *fw, Point pt) {
         Area *a;
         View *v;
- int minw;
+ int minw, s;
         
         v = screen->sel;
         minw = Dx(v->r)/NCOL;
 
- for(a = v->firstarea; a->next; a = a->next)
+ /* XXX: Multihead. Check this over. */
+ foreach_column(v, s, a)
                 if(pt.x < a->r.max.x)
                         break;
 
@@ -254,6 +262,8 @@
 
         f = c->sel;
 
+ SET(x);
+ SET(y);
         if(grabmod) {
                 p = querypointer(f->client->framewin);
                 x = (float)p.x / Dx(f->r);
@@ -400,6 +410,9 @@
                 case ButtonRelease:
                         if(button != 1)
                                 continue;
+ SET(collapsed);
+ SET(fp);
+ SET(fn);
                         a = f->area;
                         if(a->floating)
                                 area_detach(f);
@@ -416,7 +429,7 @@
                         }
 
                         column_drop(fw->ra, f, fw->pt.y);
- if(collapsed) {
+ if(!a->floating && collapsed) {
                                 /* XXX */
                                 for(; fn && fn->collapsed; fn=fn->anext)
                                         ;
diff -r 20adda22f741 -r 23284ce3261e cmd/wmii/main.c
--- a/cmd/wmii/main.c Tue Oct 14 02:55:29 2008 -0400
+++ b/cmd/wmii/main.c Tue Oct 14 04:54:35 2008 -0400
@@ -171,12 +171,12 @@
         rects = xinerama_screens(&n);
         m = max(n, nscreens);
         screens = erealloc(screens, m * sizeof *screens);
+ for(v=view; v; v=v->next)
+ v->areas = erealloc(v->areas, m * sizeof *v->areas);
         for(i=nscreens; i < m; i++) {
                 screens[i] = (WMScreen){0};
- for(v=view; v; v=v->next) {
- v->areas = erealloc(v->areas, m * sizeof *v->areas);
+ for(v=view; v; v=v->next)
                         view_init(v, i);
- }
         }
 
         nscreens = m;
diff -r 20adda22f741 -r 23284ce3261e cmd/wmii/message.c
--- a/cmd/wmii/message.c Tue Oct 14 02:55:29 2008 -0400
+++ b/cmd/wmii/message.c Tue Oct 14 04:54:35 2008 -0400
@@ -845,12 +845,14 @@
         case LCLIENT:
                 return msg_selectframe(a->sel, m, sym);
         case LLEFT:
+ /* XXX: Multihead. */
                 if(a->floating)
                         return Ebadvalue;
                 for(ap=v->firstarea; ap->next; ap=ap->next)
                         if(ap->next == a) break;
                 break;
         case LRIGHT:
+ /* XXX: Multihead. */
                 if(a->floating)
                         return Ebadvalue;
                 ap = a->next;
@@ -866,6 +868,7 @@
                 else {
                         if(!getulong(s, &i) || i == 0)
                                 return Ebadvalue;
+ /* XXX: Multihead. */
                         for(ap=v->firstarea; ap; ap=ap->next)
                                 if(--i == 0) break;
                         if(i != 0)
@@ -913,7 +916,7 @@
         SET(fp);
         switch(sym) {
         case LUP:
- /* XXX */
+ /* XXX: Stack. */
                 if(stack) {
                         for(; f->aprev && f->aprev->collapsed; f=f->aprev)
                                 ;
@@ -926,7 +929,7 @@
                                 if(fp->anext == f) break;
                 break;
         case LDOWN:
- /* XXX */
+ /* XXX: Stack. */
                 if(stack) {
                         for(fp=f->anext; fp && fp->collapsed; fp=fp->anext)
                                 ;
@@ -1006,6 +1009,7 @@
         case LLEFT:
                 if(a->floating)
                         return Ebadvalue;
+ /* XXX: Multihead. */
                 if(a->prev)
                         to = a->prev;
                 a = v->floating;
@@ -1013,6 +1017,7 @@
         case LRIGHT:
                 if(a->floating)
                         return Ebadvalue;
+ /* XXX: Multihead. */
                 to = a->next;
                 break;
         case LTOGGLE:
@@ -1063,6 +1068,7 @@
         c = f->client;
         switch(sym) {
         case LUP:
+ /* XXX: Multihead. */
                 fp = f->aprev;
                 if(!fp)
                         return Ebadvalue;
@@ -1070,6 +1076,7 @@
                         fp = fp->aprev;
                 break;
         case LDOWN:
+ /* XXX: Multihead. */
                 fp = f->anext;
                 if(!fp)
                         return Ebadvalue;
diff -r 20adda22f741 -r 23284ce3261e cmd/wmii/view.c
--- a/cmd/wmii/view.c Tue Oct 14 02:55:29 2008 -0400
+++ b/cmd/wmii/view.c Tue Oct 14 04:54:35 2008 -0400
@@ -4,16 +4,6 @@
  */
 #include "dat.h"
 #include "fns.h"
-
-#define foreach_area(v, s, a) \
- Area *__anext; /* Getting ugly... */ \
- for(s=0; s <= nscreens; s++) \
- for((a)=(s < nscreens ? (v)->areas[s] : v->floating), __anext=(a)->next; (a); (void)(((a)=__anext) && (__anext=(a)->next)))
-
-#define foreach_frame(v, s, a, f) \
- Frame *__fnext; \
- foreach_area(v, s, a) \
- for((void)(((f)=(a)->frame) && (__fnext=(f)->anext)); (f); (void)(((f)=__fnext) && (__fnext=(f)->anext)))
 
 static bool
 empty_p(View *v) {
diff -r 20adda22f741 -r 23284ce3261e config.mk
--- a/config.mk Tue Oct 14 02:55:29 2008 -0400
+++ b/config.mk Tue Oct 14 04:54:35 2008 -0400
@@ -14,7 +14,7 @@
 
 # Flags
 include $(ROOT)/mk/gcc.mk
-CFLAGS += $(DEBUGCFLAGS) -O1
+CFLAGS += $(DEBUGCFLAGS) -O0
 LDFLAGS += -g $(LIBS)
 SOLDFLAGS += $(LDFLAGS)
 SHARED = -shared -Wl,-soname=$(SONAME)
Received on Tue Oct 14 2008 - 08:54:39 UTC

This archive was generated by hypermail 2.2.0 : Tue Oct 14 2008 - 09:00:05 UTC