summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adrien Schildknecht <adrien+dev@schischi.me>2013-07-02 03:32:34 +0200
committerGravatar Adrien Schildknecht <adrien+dev@schischi.me>2013-07-02 03:32:34 +0200
commitab4bdd8bc8196ce6613c979fa88fb5bb6791afb0 (patch)
tree8b9c4bc61a90ed1ff7a94cf559f2e1346f5e6a2c
parent671ac6b5da6289a4c7e625fc9b93e87d57d29138 (diff)
fix a crash when the focused window is the root window
-rw-r--r--xcwd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xcwd.c b/xcwd.c
index 4483c89..66ebf96 100644
--- a/xcwd.c
+++ b/xcwd.c
@@ -71,6 +71,8 @@ static Window focusedWindow()
exit (1);
XGetInputFocus (dpy, &focuswin, &focusrevert);
root = XDefaultRootWindow(dpy);
+ if(root == focuswin)
+ return None;
do {
status = XGetWindowProperty(dpy, focuswin, XA_WM_STATE, 0, 1024, 0,
@@ -290,7 +292,7 @@ int main(int argc, const char *argv[])
processes_t p;
long pid;
Window w = focusedWindow();
- if (w == 0)
+ if (w == None)
return getHomeDirectory();
pid = windowPid(w);