[hackers] [st] Avoid failing when embedding with a Window id of 0 || Quentin Rameau

From: <git_AT_suckless.org>
Date: Tue, 21 Oct 2014 18:18:42 +0200

commit 008aae541b5cb1e67a025048adef9a06eaa11c2e
Author: Quentin Rameau <quinq.ml_AT_gmail.com>
Date: Thu Oct 16 00:42:53 2014 +0200

    Avoid failing when embedding with a Window id of 0
    
    I'd like to let st run with its own window when trying to embed it to a window with id 0 instead of exiting with an error.

diff --git a/st.c b/st.c
index bcf96e9..23dd7f1 100644
--- a/st.c
+++ b/st.c
_AT_@ -3136,8 +3136,8 @@ xinit(void) {
                 | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
         xw.attrs.colormap = xw.cmap;
 
- parent = opt_embed ? strtol(opt_embed, NULL, 0) : \
- XRootWindow(xw.dpy, xw.scr);
+ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
+ parent = XRootWindow(xw.dpy, xw.scr);
         xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
                         xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
                         xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
Received on Tue Oct 21 2014 - 18:18:42 CEST

This archive was generated by hypermail 2.3.0 : Tue Oct 21 2014 - 18:24:10 CEST