Re: [dwm] [patch] Minor code cleanup, part 2
2008/8/14 Szabolcs Nagy <[EMAIL PROTECTED]>: > 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 At least in XGetTransientForHint(3) the following is mentioned: The XGetTransientForHint function returns the WM_TRANSIENT_FOR property for the specified window. It returns a nonzero status on success; otherwise, it returns a zero status. So everything is ok. Kind regards, --Anselm
Re: [dwm] [patch] Minor code cleanup, part 2
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
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
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
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
Re: [dwm] [patch] Minor code cleanup, part 2
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
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
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)
[dwm] [patch] Minor code cleanup, part 2
Hi, The patch below changes the manage() function so that it calls the getclient() function rather then using its own search loop. Comments are welcome. Cheers, /Martin diff -r 65c37b4be9cb dwm.c --- a/dwm.c Mon Aug 04 17:39:36 2008 +0100 +++ b/dwm.c Wed Aug 13 23:45:54 2008 +0200 @@ -904,7 +904,7 @@ grabbuttons(c, False); updatetitle(c); if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success)) - for(t = clients; t && t->win != trans; t = t->next); + t = getclient(trans); if(t) c->tags = t->tags; else