[hackers] [wmii] Fix some Xinerama managed-mode bugs || Kris Maglione

From: <hg_AT_suckless.org>
Date: Sun, 19 Oct 2008 00:04:01 +0000 (UTC)

changeset: 2392:6b25b0dd46cd
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Oct 18 20:03:59 2008 -0400
files: cmd/wmii/area.c cmd/wmii/column.c cmd/wmii/fns.h cmd/wmii/main.c cmd/wmii/message.c cmd/wmii/view.c
description:
Fix some Xinerama managed-mode bugs

diff -r 869a1e90ab0c -r 6b25b0dd46cd cmd/wmii/area.c
--- a/cmd/wmii/area.c Sat Oct 18 14:58:26 2008 -0400
+++ b/cmd/wmii/area.c Sat Oct 18 20:03:59 2008 -0400
@@ -58,6 +58,7 @@
         int numcols;
         Area *a;
 
+ assert(!pos || pos->screen == scrn);
         SET(i);
         if(v->areas) { /* Creating a column. */
                 minwidth = Dx(v->r[scrn])/NCOL;
@@ -83,7 +84,7 @@
                 if(numcols && (numcols * minwidth + width) > Dx(v->r[scrn]))
                         return nil;
 
- view_scale(v, Dx(v->r[scrn]) - width);
+ view_scale(v, scrn, Dx(v->r[scrn]) - width);
         }
 
         a = emallocz(sizeof *a);
diff -r 869a1e90ab0c -r 6b25b0dd46cd cmd/wmii/column.c
--- a/cmd/wmii/column.c Sat Oct 18 14:58:26 2008 -0400
+++ b/cmd/wmii/column.c Sat Oct 18 20:03:59 2008 -0400
@@ -80,7 +80,7 @@
 column_new(View *v, Area *pos, int scrn, uint w) {
         Area *a;
 
- assert(!pos || !pos->floating);
+ assert(!pos || !pos->floating && pos->screen == scrn);
         a = area_create(v, pos, scrn, w);
         return a;
 #if 0
diff -r 869a1e90ab0c -r 6b25b0dd46cd cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Sat Oct 18 14:58:26 2008 -0400
+++ b/cmd/wmii/fns.h Sat Oct 18 20:03:59 2008 -0400
@@ -206,6 +206,7 @@
 char* message_client(Client*, IxpMsg*);
 char* message_root(void*, IxpMsg*);
 char* message_view(View*, IxpMsg*);
+char* msg_debug(IxpMsg*);
 char* msg_getword(IxpMsg*);
 char* msg_parsecolors(IxpMsg*, CTuple*);
 char* msg_selectarea(Area*, IxpMsg*);
@@ -260,7 +261,7 @@
 char** view_names(void);
 uint view_newcolwidth(View*, int i);
 void view_restack(View*);
-void view_scale(View*, int w);
+void view_scale(View*, int, int);
 Client* view_selclient(View*);
 void view_select(const char*);
 void view_update(View*);
diff -r 869a1e90ab0c -r 6b25b0dd46cd cmd/wmii/main.c
--- a/cmd/wmii/main.c Sat Oct 18 14:58:26 2008 -0400
+++ b/cmd/wmii/main.c Sat Oct 18 20:03:59 2008 -0400
@@ -317,8 +317,9 @@
 
 int
 main(int argc, char *argv[]) {
+ IxpMsg m;
         char **oargv;
- char *wmiirc;
+ char *wmiirc, *s;
         int i;
 
         quotefmtinstall();
@@ -341,6 +342,11 @@
         case 'v':
                 print("%s", version);
                 exit(0);
+ case 'D':
+ s = EARGF(usage());
+ m = ixp_message(s, strlen(s), 0);
+ msg_debug(&m);
+ break;
         default:
                 usage();
                 break;
diff -r 869a1e90ab0c -r 6b25b0dd46cd cmd/wmii/message.c
--- a/cmd/wmii/message.c Sat Oct 18 14:58:26 2008 -0400
+++ b/cmd/wmii/message.c Sat Oct 18 20:03:59 2008 -0400
@@ -5,7 +5,6 @@
 #include <ctype.h>
 #include "fns.h"
 
-static char* msg_debug(IxpMsg*);
 static char* msg_grow(View*, IxpMsg*);
 static char* msg_nudge(View*, IxpMsg*);
 static char* msg_selectframe(Frame*, IxpMsg*, int);
@@ -654,7 +653,7 @@
         return buffer;
 }
 
-static char*
+char*
 msg_debug(IxpMsg *m) {
         char *opt;
         int d;
@@ -1039,7 +1038,7 @@
         }
 
         if(!to && !swap && (f->anext || f != f->area->frame))
- to = column_new(v, a, screen->idx, 0);
+ to = column_new(v, a, f->area->screen, 0);
 
         if(!to)
                 return Ebadvalue;
diff -r 869a1e90ab0c -r 6b25b0dd46cd cmd/wmii/view.c
--- a/cmd/wmii/view.c Sat Oct 18 14:58:26 2008 -0400
+++ b/cmd/wmii/view.c Sat Oct 18 20:03:59 2008 -0400
@@ -459,53 +459,48 @@
                 XRestackWindows(display, (ulong*)wins.ary, wins.n);
 }
 
-/* XXX: Multihead. */
 void
-view_scale(View *v, int w) {
+view_scale(View *v, int scrn, int width) {
         uint xoff, numcol;
         uint minwidth;
         Area *a;
         float scale;
- int dx, s;
+ int dx;
 
- minwidth = Dx(v->screenr)/NCOL; /* XXX: Multihead. */
+ minwidth = Dx(v->r[scrn])/NCOL; /* XXX: Multihead. */
 
- if(!v->firstarea)
+ if(!v->areas[scrn])
                 return;
 
         numcol = 0;
         dx = 0;
- for(a=v->firstarea; a; a=a->next) {
+ for(a=v->areas[scrn]; a; a=a->next) {
                 numcol++;
                 dx += Dx(a->r);
         }
 
- scale = (float)w / dx;
- for(s=0; s < nscreens; s++) {
- xoff = v->r[s].min.x;
- for(a=v->areas[s]; a; a=a->next) {
- a->r.max.x = xoff + Dx(a->r) * scale;
- a->r.min.x = xoff;
- if(!a->next)
- a->r.max.x = v->r[s].min.x + w;
- xoff = a->r.max.x;
- }
+ scale = (float)width / dx;
+ xoff = v->r[scrn].min.x;
+ for(a=v->areas[scrn]; a; a=a->next) {
+ a->r.max.x = xoff + Dx(a->r) * scale;
+ a->r.min.x = xoff;
+ if(!a->next)
+ a->r.max.x = v->r[scrn].min.x + width;
+ xoff = a->r.max.x;
         }
 
- if(numcol * minwidth > w)
+ if(numcol * minwidth > width)
                 return;
 
- for(s=0; s < nscreens; s++) {
- xoff = v->r[s].min.x;
- for(a=v->areas[s]; a; a=a->next) {
- a->r.min.x = xoff;
+ xoff = v->r[scrn].min.x;
+ for(a=v->areas[scrn]; a; a=a->next) {
+ a->r.min.x = xoff;
 
- if(Dx(a->r) < minwidth)
- a->r.max.x = xoff + minwidth;
- if(!a->next)
- a->r.max.x = v->r[s].min.x + w;
- xoff = a->r.max.x;
- }
+ if(Dx(a->r) < minwidth)
+ a->r.max.x = xoff + minwidth;
+ if(!a->next)
+ a->r.max.x = v->r[scrn].min.x + width;
+ xoff = a->r.max.x;
         }
 }
 
@@ -519,7 +514,8 @@
                 return;
 
         view_update_rect(v);
- view_scale(v, Dx(v->screenr));
+ for(s=0; s < nscreens; s++)
+ view_scale(v, s, Dx(v->r[s]));
         foreach_area(v, s, a) {
                 if(a->floating)
                         continue;
Received on Sun Oct 19 2008 - 00:04:01 UTC

This archive was generated by hypermail 2.2.0 : Sun Oct 19 2008 - 00:12:05 UTC