fix a crash when the focused window is the root window

This commit is contained in:
Adrien Schildknecht 2013-07-02 03:32:34 +02:00
parent 671ac6b5da
commit ab4bdd8bc8

4
xcwd.c
View File

@ -71,6 +71,8 @@ static Window focusedWindow()
exit (1); exit (1);
XGetInputFocus (dpy, &focuswin, &focusrevert); XGetInputFocus (dpy, &focuswin, &focusrevert);
root = XDefaultRootWindow(dpy); root = XDefaultRootWindow(dpy);
if(root == focuswin)
return None;
do { do {
status = XGetWindowProperty(dpy, focuswin, XA_WM_STATE, 0, 1024, 0, status = XGetWindowProperty(dpy, focuswin, XA_WM_STATE, 0, 1024, 0,
@ -290,7 +292,7 @@ int main(int argc, const char *argv[])
processes_t p; processes_t p;
long pid; long pid;
Window w = focusedWindow(); Window w = focusedWindow();
if (w == 0) if (w == None)
return getHomeDirectory(); return getHomeDirectory();
pid = windowPid(w); pid = windowPid(w);