[dwm] dzen + dwm

2008-08-14 Thread Antony Jepson
Hey,

This topic has probably been visited before but I think it's time for an
update.  Does anyone use dzen with dwm? If so, could you share some
configs, tips, and/or tricks for combining these two programs.

Sincerely,
-- 
Antony Jepson / <[EMAIL PROTECTED]> / GPG Key: 0xFA10ED80
++ Legum servi sumus ut liberi esse possimus. (We are   ++
++ slaves of the law so that we would be able to be ++
++ free.)   ++
++ -- Marcus Tullius Cicero ++


pgpIFhR1hqd8Z.pgp
Description: PGP signature


Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Szabolcs Nagy
On 8/14/08, Szabolcs Nagy <[EMAIL PROTECTED]> wrote:
> what's the difference?
ah, never mind
i see what you meant

/me failed



Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Szabolcs Nagy
On 8/14/08, Martin Hurton <[EMAIL PROTECTED]> wrote:
> Those other checks seems ok to me.

what's the difference?

either you assert Success==0, so the identifier 'Success' is not
needed anywhere, or using Success is mandatory

i don't see why would one mix the two.



Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Martin Hurton
On Thu, Aug 14, 2008 at 04:21:39PM +0200, Szabolcs Nagy wrote:
> On 8/14/08, Martin Hurton <[EMAIL PROTECTED]> wrote:
> > Can you apply the following patch too? According to spec the
> > XGetTransientForHint() function returns non zero value on success
> > while the Success value is defined as zero (see /usr/include/X11/X.h).
> 
> I'm not quite sure about this change.
> 
> eg. X reference manual never states explicitly that GrabSuccess is 0
> (even though if one reads the X protocol specification he can *guess*
> that it should be 0) so the programmer shouldn't rely on this.
> 
> but if it's changed then change consistently:
> $ grep Success dwm.c |wc -l
> 6
Those other checks seems ok to me.

/Martin



Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Szabolcs Nagy
On 8/14/08, Martin Hurton <[EMAIL PROTECTED]> wrote:
> Can you apply the following patch too? According to spec the
> XGetTransientForHint() function returns non zero value on success
> while the Success value is defined as zero (see /usr/include/X11/X.h).

I'm not quite sure about this change.

eg. X reference manual never states explicitly that GrabSuccess is 0
(even though if one reads the X protocol specification he can *guess*
that it should be 0) so the programmer shouldn't rely on this.

but if it's changed then change consistently:
$ grep Success dwm.c |wc -l
6



[dwm] [patch] drawtext()

2008-08-14 Thread Martin Hurton
Here is anothe little patch. No big change, just makes the drawtext()
function a bit more compact and efficient. Comments are welcome.

Cheers,
/Martin

diff -r a63cb246f35c dwm.c
--- a/dwm.c Thu Aug 14 12:36:49 2008 +0200
+++ b/dwm.c Thu Aug 14 15:44:56 2008 +0200
@@ -576,15 +576,14 @@
if(!text)
return;
olen = strlen(text);
-   len = MIN(olen, sizeof buf);
-   memcpy(buf, text, len);
h = dc.font.ascent + dc.font.descent;
y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent;
x = dc.x + (h / 2);
/* shorten text if necessary */
-   for(; len && (i = textnw(buf, len)) > dc.w - h; len--);
+   for(len = MIN(olen, sizeof buf); len && textnw(text, len) > dc.w - h; 
len--);
if(!len)
return;
+   memcpy(buf, text, len);
if(len < olen)
for(i = len; i && i > len - 3; buf[--i] = '.');
XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);



Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Martin Hurton
On Thu, Aug 14, 2008 at 12:41:30PM +0200, Premysl Hruby wrote:
> On (14/08/08 09:52), Szabolcs Nagy wrote:
> > To: dwm mail list 
> > From: Szabolcs Nagy <[EMAIL PROTECTED]>
> > Subject: Re: [dwm] [patch] Minor code cleanup, part 2
> > Reply-To: dwm mail list 
> > List-Id: dwm mail list 
> > 
> > On 8/14/08, Martin Hurton <[EMAIL PROTECTED]> wrote:
> > >   if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
> > > - for(t = clients; t && t->win != trans; t = t->next);
> > > + t = getclient(trans);
> > nice
> > 
> > what about
> > -   if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
> > +   if((rettrans = XGetTransientForHint(dpy, w, &trans)) == Success)
> > 
> 
> Applied both changes, thanks.

Can you apply the following patch too? According to spec the
XGetTransientForHint() function returns non zero value on success
while the Success value is defined as zero (see /usr/include/X11/X.h).

Cheers,
/Martin

diff -r a63cb246f35c dwm.c
--- a/dwm.c Thu Aug 14 12:36:49 2008 +0200
+++ b/dwm.c Thu Aug 14 15:29:20 2008 +0200
@@ -903,14 +903,14 @@
XSelectInput(dpy, w, 
EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, False);
updatetitle(c);
-   if((rettrans = XGetTransientForHint(dpy, w, &trans)) == Success)
+   if((rettrans = XGetTransientForHint(dpy, w, &trans)))
t = getclient(trans);
if(t)
c->tags = t->tags;
else
applyrules(c);
if(!c->isfloating)
-   c->isfloating = (rettrans == Success) || c->isfixed;
+   c->isfloating = rettrans || c->isfixed;
if(c->isfloating)
XRaiseWindow(dpy, c->win);
attach(c);



Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Premysl Hruby
On (14/08/08 09:52), Szabolcs Nagy wrote:
> To: dwm mail list 
> From: Szabolcs Nagy <[EMAIL PROTECTED]>
> Subject: Re: [dwm] [patch] Minor code cleanup, part 2
> Reply-To: dwm mail list 
> List-Id: dwm mail list 
> 
> On 8/14/08, Martin Hurton <[EMAIL PROTECTED]> wrote:
> > if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
> > -   for(t = clients; t && t->win != trans; t = t->next);
> > +   t = getclient(trans);
> nice
> 
> what about
> - if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
> + if((rettrans = XGetTransientForHint(dpy, w, &trans)) == Success)
> 

Applied both changes, thanks.

-Ph

-- 
Premysl "Anydot" Hruby, http://www.redrum.cz/



Re: [dwm] [patch] Minor code cleanup, part 2

2008-08-14 Thread Szabolcs Nagy
On 8/14/08, Martin Hurton <[EMAIL PROTECTED]> wrote:
>   if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
> - for(t = clients; t && t->win != trans; t = t->next);
> + t = getclient(trans);
nice

what about
-   if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
+   if((rettrans = XGetTransientForHint(dpy, w, &trans)) == Success)