Re: [dwm] rfc: patch: xinerama support

2008-02-11 Thread Anselm R. Garbe
On Wed, Feb 06, 2008 at 08:01:25AM +, David Edmondson wrote:
 Here's a first attempt at working Xinerama for dwm. It has rough edges
 (and probably sharp corners), but perhaps someone else will find it
 interesting and provide feedback.
 
 The current code seems very confused about the difference between
 Zaphod and Xinerama. I cleaned this up only where absolutely necessary
 so far, but this has probably made Zaphod mode support more difficult
 than it was.
 
 Tags are per-display rather than per-monitor. This fit more naturally
 with the way I work (tested by playing with awesome and xmonad),
 though it is somewhat arbitrary. If two monitors display the same tag
 then the client appears on the lowest numbered monitor (again
 arbitrary).
 
 There are changes to config.def.h - don't forget to merge them into
 your config.h as appropriate.
 
 I'll do more work on this, but wanted to get early feedback.
 
 Comments?

Hmm, I'm not sure about all details in your patch, because it is
kind of different to the way I planned to have the multihead
support.

I don't want a major difference between Xinerama and classic
multihead support, except that with Xinerama one can move
windows between screens. That's why the tagset should be
screen-dependend imho.

Unfortunately I got interrupted during Dec/January proceeding on
the implementation due to my relocation to the UK. But 4.8 will
be out soon and I propose to continue the discussion after that
release.

Atm. I don't plan to make such a change like you propose mainstream.

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361



Re: [dwm] rfc: patch: xinerama support

2008-02-07 Thread hiro
Hi,

For a few weeks now i'm using a thinkpad x60s and a 1600x1200 external
tft on my desk. My old machine will probably have a lot of fun with
glenda in the cellar.
I don't know whether Kris started implementing support for xinerama in
wmii. It was talked about last year, but now, that i'm setting up my
screens, this patch is the first i found to serve a working xinerama
environment. And it feels great.
Even though i don't like dwm's strict 2-column design, this patch
shows a lot of potential, very well done!

-- 
hiro



[dwm] rfc: patch: xinerama support

2008-02-06 Thread David Edmondson
Here's a first attempt at working Xinerama for dwm. It has rough edges
(and probably sharp corners), but perhaps someone else will find it
interesting and provide feedback.

The current code seems very confused about the difference between
Zaphod and Xinerama. I cleaned this up only where absolutely necessary
so far, but this has probably made Zaphod mode support more difficult
than it was.

Tags are per-display rather than per-monitor. This fit more naturally
with the way I work (tested by playing with awesome and xmonad),
though it is somewhat arbitrary. If two monitors display the same tag
then the client appears on the lowest numbered monitor (again
arbitrary).

There are changes to config.def.h - don't forget to merge them into
your config.h as appropriate.

I'll do more work on this, but wanted to get early feedback.

Comments?

dme.
diff --git a/config.def.h b/config.def.h
--- a/config.def.h
+++ b/config.def.h
@@ -15,11 +15,11 @@ const char tags[][MAXTAGLEN] = { 1, 2
 const char tags[][MAXTAGLEN] = { 1, 2, 3, 4, 5, 6, 7, 8, www };
 Bool initags[LENGTH(tags)] = {[0] = True};
 Rule rules[] = {
-	/* class:instance:title regex	tags regex	isfloating */	/* monitor */
-	{ Firefox,			www,		False,		-1 },
-	{ Gimp,			NULL,		True,		-1 },
-	{ MPlayer,			NULL,		True,		-1 },
-	{ Acroread,			NULL,		True,		-1 },
+	/* class:instance:title regex	tags regex	isfloating */
+	{ Firefox,			www,		False },
+	{ Gimp,			NULL,		True },
+	{ MPlayer,			NULL,		True },
+	{ Acroread,			NULL,		True },
 };
 
 /* layout(s) */
diff --git a/config.mk b/config.mk
--- a/config.mk
+++ b/config.mk
@@ -15,10 +15,10 @@ LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 
 LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lXinerama
 
 # flags
-CFLAGS = -Os ${INCS} -DVERSION=\${VERSION}\
-LDFLAGS = -s ${LIBS}
-#CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} -DVERSION=\${VERSION}\
-#LDFLAGS = -g ${LIBS}
+#CFLAGS = -Os ${INCS} -DVERSION=\${VERSION}\
+#LDFLAGS = -s ${LIBS}
+CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} -DVERSION=\${VERSION}\
+LDFLAGS = -g ${LIBS}
 
 # Solaris
 #CFLAGS = -fast ${INCS} -DVERSION=\${VERSION}\
diff --git a/dwm.c b/dwm.c
--- a/dwm.c
+++ b/dwm.c
@@ -75,6 +75,7 @@ struct Client {
 	Client *snext;
 	Window win;
 	int monitor;
+	int generation;
 };
 
 typedef struct {
@@ -99,16 +100,16 @@ typedef struct {
 	const char *arg;
 } Key;
 
+typedef struct Monitor Monitor;
 typedef struct {
 	const char *symbol;
-	void (*arrange)(void);
+	void (*arrange)(Monitor *m);
 } Layout;
 
 typedef struct {
 	const char *prop;
 	const char *tags;
 	Bool isfloating;
-	int monitor;
 } Rule;
 
 typedef struct {
@@ -116,7 +117,8 @@ typedef struct {
 	regex_t *tagregex;
 } Regs;
 
-typedef struct {
+struct Monitor {
+	int nth;
 	int screen;
 	Window root;
 	Window barwin;
@@ -126,7 +128,7 @@ typedef struct {
 	Bool *prevtags;
 	Layout *layout;
 	double mwfact;
-} Monitor;
+};
 
 /* function declarations */
 void applyrules(Client *c);
@@ -151,7 +153,7 @@ void enternotify(XEvent *e);
 void enternotify(XEvent *e);
 void eprint(const char *errstr, ...);
 void expose(XEvent *e);
-void floating(void); /* default floating layout */
+void floating(Monitor*); /* default floating layout */
 void focus(Client *c);
 void focusin(XEvent *e);
 void focusnext(const char *arg);
@@ -164,7 +166,7 @@ void grabkeys(void);
 void grabkeys(void);
 unsigned int idxoftag(const char *tag);
 void initfont(Monitor*, const char *fontstr);
-Bool isoccupied(Monitor *m, unsigned int t);
+Bool isoccupied(unsigned int t);
 Bool isprotodel(Client *c);
 Bool isvisible(Client *c, Monitor *m);
 void keypress(XEvent *e);
@@ -190,7 +192,7 @@ void tag(const char *arg);
 void tag(const char *arg);
 unsigned int textnw(Monitor*, const char *text, unsigned int len);
 unsigned int textw(Monitor*, const char *text);
-void tile(void);
+void tile(Monitor*);
 void togglebar(const char *arg);
 void togglefloating(const char *arg);
 void toggletag(const char *arg);
@@ -253,6 +255,17 @@ int selmonitor = 0;
 
 //Bool prevtags[LENGTH(tags)];
 
+void
+dump_tagset(char *s, Bool *t)
+{
+	unsigned int i;
+
+	printf(%s: , s);
+	for(i = 0; i  LENGTH(tags); i++)
+		printf(%s , t[i] ? t : f);
+	printf(\n);
+}
+
 /* function implementations */
 void
 applyrules(Client *c) {
@@ -260,7 +273,6 @@ applyrules(Client *c) {
 	unsigned int i, j;
 	regmatch_t tmp;
 	Bool matched_tag = False;
-	Bool matched_monitor = False;
 	XClassHint ch = { 0 };
 
 	/* rule matching */
@@ -270,11 +282,6 @@ applyrules(Client *c) {
 			ch.res_name ? ch.res_name : , c-name);
 	for(i = 0; i  LENGTH(rules); i++)
 		if(regs[i].propregex  !regexec(regs[i].propregex, buf, 1, tmp, 0)) {
-			if (rules[i].monitor = 0  rules[i].monitor  mcount) {
-matched_monitor = True;
-c-monitor = rules[i].monitor;
-			}
-
 			c-isfloating = rules[i].isfloating;
 			for(j = 0; regs[i].tagregex  j  LENGTH(tags); j++) {
 if(!regexec(regs[i].tagregex, tags[j], 1, tmp, 0)) {
@@ -289,21 +296,36 @@ applyrules(Client *c) {
 		XFree(ch.res_name);
 	if(!matched_tag)