From b9e8bbbdc75f285551c4beb45b6a65741ba8ad4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Wed, 3 Apr 2013 20:01:46 +0200 Subject: [PATCH] code clean at startup.c Small code clean at startup.c --- src/startup.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/startup.c b/src/startup.c index e0249ee8..f9d4e52d 100644 --- a/src/startup.c +++ b/src/startup.c @@ -415,16 +415,12 @@ WScreen *wScreenForRootWindow(Window window) if (wScreenCount == 1) return wScreen[0]; - /* - * Since the number of heads will probably be small (normally 2), + /* Since the number of heads will probably be small (normally 2), * it should be faster to use this than a hash table, because - * of the overhead. - */ - for (i = 0; i < wScreenCount; i++) { - if (wScreen[i]->root_win == window) { + * of the overhead. */ + for (i = 0; i < wScreenCount; i++) + if (wScreen[i]->root_win == window) return wScreen[i]; - } - } return wScreenForWindow(window); } @@ -436,9 +432,9 @@ WScreen *wScreenForWindow(Window window) if (wScreenCount == 1) return wScreen[0]; - if (XGetWindowAttributes(dpy, window, &attr)) { + if (XGetWindowAttributes(dpy, window, &attr)) return wScreenForRootWindow(attr.root); - } + return NULL; }