aboutsummaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorokan2014-02-03 20:20:39 +0000
committerokan2014-02-03 20:20:39 +0000
commit0591be5c2b59055e9d6b193f634e9bc16bd1e999 (patch)
tree403655c8534ddc003bbe2b6d16085ddc2a91471e /client.c
parentf21abfc55cc09949eb90c5fa93a629d04b204a6a (diff)
downloadcwm-0591be5c2b59055e9d6b193f634e9bc16bd1e999.tar.gz
Move redundant bits from screen_init (while dealing with existing
clients) directly into client_init, performing the X roundtrip only once. With the previous change in maprequest, this moves decision making into one place for creating new clients.
Diffstat (limited to '')
-rw-r--r--client.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/client.c b/client.c
index 23af4b2..684dacd 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.170 2014/02/02 21:34:05 okan Exp $
+ * $OpenBSD: client.c,v 1.171 2014/02/03 20:20:39 okan Exp $
*/
#include <sys/param.h>
@@ -55,18 +55,26 @@ client_find(Window win)
}
struct client_ctx *
-client_init(Window win, struct screen_ctx *sc, int mapped)
+client_init(Window win, struct screen_ctx *sc)
{
struct client_ctx *cc;
XWindowAttributes wattr;
long state;
+ int mapped;
if (win == None)
return (NULL);
if (!XGetWindowAttributes(X_Dpy, win, &wattr))
return (NULL);
- if (sc == NULL)
+
+ if (sc == NULL) {
sc = screen_fromroot(wattr.root);
+ mapped = 1;
+ } else {
+ if (wattr.override_redirect || wattr.map_state != IsViewable)
+ return (NULL);
+ mapped = wattr.map_state != IsUnmapped;
+ }
cc = xcalloc(1, sizeof(*cc));