Re: [dev] [dwm] xev's window refuses to float

2011-08-13 Thread Eckehard Berns
> This should definitely be fixed in mainline. I've attached an
> alternative patch which is basically the same as yours, but imo
> slightly neater.

I do like your patch, something paranoid in me just wanted to point out
that your patch relies on the implementation of XGetClassHint not
tempering with ch when returning failure. I don't believe this really
matters though.

-- 
Eckehard Berns



Re: [dev] [dwm] xev's window refuses to float

2011-08-13 Thread Connor Lane Smith
On 13 August 2011 21:41, Eckehard Berns  wrote:
> I do like your patch, something paranoid in me just wanted to point out
> that your patch relies on the implementation of XGetClassHint not
> tempering with ch when returning failure.

So does yours: it calls XFree on the two ch strings whether or not
XGetClassHint succeeded.

cls



Re: [dev] [dwm] xev's window refuses to float

2011-08-13 Thread Eckehard Berns
On Sat, Aug 13, 2011 at 10:08:08PM +0100, Connor Lane Smith wrote:
> On 13 August 2011 21:41, Eckehard Berns  wrote:
> > I do like your patch, something paranoid in me just wanted to point out
> > that your patch relies on the implementation of XGetClassHint not
> > tempering with ch when returning failure.
> 
> So does yours: it calls XFree on the two ch strings whether or not
> XGetClassHint succeeded.

Good point :)

-- 
Eckehard Berns



***SPAM*** Re: [dev] [dwm] xev's window refuses to float

2011-08-13 Thread Eckehard Berns
On Fri, Aug 12, 2011 at 09:39:00PM +0200, Bastien Dejean wrote:
> I have included the following line in the rules array of my config.h :
> 
> { NULL, NULL,"Event Tester", 0,True,
> -1 },
> 
> But I don't get the expected result (xev's window stays tiled).

Dwm doesn't seem to apply rules to clients without a class hint.
A fix could be something like this:

8<---8<---
diff -r 131d4f6a8a1e dwm.c
--- a/dwm.c Fri Jul 29 20:01:22 2011 +0200
+++ b/dwm.c Sat Aug 13 10:31:14 2011 +0200
@@ -296,24 +296,25 @@
if(XGetClassHint(dpy, c->win, &ch)) {
class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken;
-   for(i = 0; i < LENGTH(rules); i++) {
-   r = &rules[i];
-   if((!r->title || strstr(c->name, r->title))
-   && (!r->class || strstr(class, r->class))
-   && (!r->instance || strstr(instance, r->instance)))
-   {
-   c->isfloating = r->isfloating;
-   c->tags |= r->tags;
-   for(m = mons; m && m->num != r->monitor; m = 
m->next);
-   if(m)
-   c->mon = m;
-   }
+   } else
+   class = instance = broken;
+   for(i = 0; i < LENGTH(rules); i++) {
+   r = &rules[i];
+   if((!r->title || strstr(c->name, r->title))
+   && (!r->class || strstr(class, r->class))
+   && (!r->instance || strstr(instance, r->instance)))
+   {
+   c->isfloating = r->isfloating;
+   c->tags |= r->tags;
+   for(m = mons; m && m->num != r->monitor; m = m->next);
+   if(m)
+   c->mon = m;
}
-   if(ch.res_class)
-   XFree(ch.res_class);
-   if(ch.res_name)
-   XFree(ch.res_name);
}
+   if(ch.res_class)
+   XFree(ch.res_class);
+   if(ch.res_name)
+   XFree(ch.res_name);
c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : 
c->mon->tagset[c->mon->seltags];
 }
 
8<---8<---

-- 
Eckehard Berns



Re: Re: [dev] [dwm] xev's window refuses to float

2011-08-13 Thread Bastien Dejean
Eckehard Berns a écrit :

> Dwm doesn't seem to apply rules to clients without a class hint.
> A fix could be something like this:
> 
> 8<---8<---
> [...]
> 8<---8<---

Indeed, thanks.
-- 
Bastien



Re: ***SPAM*** Re: [dev] [dwm] xev's window refuses to float

2011-08-13 Thread Connor Lane Smith
Hey,

On 13 August 2011 09:35, Eckehard Berns  wrote:
> Dwm doesn't seem to apply rules to clients without a class hint.
> A fix could be something like this:

This should definitely be fixed in mainline. I've attached an
alternative patch which is basically the same as yours, but imo
slightly neater.

Thanks,
cls
diff -r edf3fc1e74b9 dwm.c
--- a/dwm.c	Mon Aug 08 16:55:06 2011 +
+++ b/dwm.c	Sat Aug 13 20:46:29 2011 +0100
@@ -289,31 +289,31 @@
 	unsigned int i;
 	const Rule *r;
 	Monitor *m;
-	XClassHint ch = { 0 };
+	XClassHint ch = { NULL, NULL };
 
 	/* rule matching */
 	c->isfloating = c->tags = 0;
-	if(XGetClassHint(dpy, c->win, &ch)) {
-		class = ch.res_class ? ch.res_class : broken;
-		instance = ch.res_name ? ch.res_name : broken;
-		for(i = 0; i < LENGTH(rules); i++) {
-			r = &rules[i];
-			if((!r->title || strstr(c->name, r->title))
-			&& (!r->class || strstr(class, r->class))
-			&& (!r->instance || strstr(instance, r->instance)))
-			{
-c->isfloating = r->isfloating;
-c->tags |= r->tags;
-for(m = mons; m && m->num != r->monitor; m = m->next);
-if(m)
-	c->mon = m;
-			}
+	XGetClassHint(dpy, c->win, &ch);
+	class= ch.res_class ? ch.res_class : broken;
+	instance = ch.res_name  ? ch.res_name  : broken;
+
+	for(i = 0; i < LENGTH(rules); i++) {
+		r = &rules[i];
+		if((!r->title || strstr(c->name, r->title))
+		&& (!r->class || strstr(class, r->class))
+		&& (!r->instance || strstr(instance, r->instance)))
+		{
+			c->isfloating = r->isfloating;
+			c->tags |= r->tags;
+			for(m = mons; m && m->num != r->monitor; m = m->next);
+			if(m)
+c->mon = m;
 		}
-		if(ch.res_class)
-			XFree(ch.res_class);
-		if(ch.res_name)
-			XFree(ch.res_name);
 	}
+	if(ch.res_class)
+		XFree(ch.res_class);
+	if(ch.res_name)
+		XFree(ch.res_name);
 	c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
 }
 


Re: ***SPAM*** Re: [dev] [dwm] xev's window refuses to float

2011-08-15 Thread Anselm R Garbe
On 13 August 2011 21:47, Connor Lane Smith  wrote:
> On 13 August 2011 09:35, Eckehard Berns  wrote:
>> Dwm doesn't seem to apply rules to clients without a class hint.
>> A fix could be something like this:
>
> This should definitely be fixed in mainline. I've attached an
> alternative patch which is basically the same as yours, but imo
> slightly neater.

I agree. Thanks for your efforts. I'll apply this patch later today.

Cheers,
--Anselm