Simplify scan() function

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-03-20 17:58:58 +01:00
parent 2473de53b7
commit 21277ad12b
1 changed files with 2 additions and 20 deletions

View File

@ -77,33 +77,15 @@ scan()
for(screen = 0; screen < ScreenCount(globalconf.display); screen++) for(screen = 0; screen < ScreenCount(globalconf.display); screen++)
{ {
if(XQueryTree(globalconf.display, RootWindow(globalconf.display, screen), &d1, &d2, &wins, &num)) if(XQueryTree(globalconf.display, RootWindow(globalconf.display, screen), &d1, &d2, &wins, &num))
{
for(i = 0; i < num; i++) for(i = 0; i < num; i++)
{
/* XGetWindowAttributes return 1 on success */ /* XGetWindowAttributes return 1 on success */
if(!XGetWindowAttributes(globalconf.display, wins[i], &wa) if(XGetWindowAttributes(globalconf.display, wins[i], &wa)
|| wa.override_redirect && !wa.override_redirect
|| XGetTransientForHint(globalconf.display, wins[i], &d1))
continue;
if(wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState)
{
real_screen = screen_get_bycoord(globalconf.screens_info, screen, wa.x, wa.y);
client_manage(wins[i], &wa, real_screen);
}
}
/* now the transients */
for(i = 0; i < num; i++)
{
if(!XGetWindowAttributes(globalconf.display, wins[i], &wa))
continue;
if(XGetTransientForHint(globalconf.display, wins[i], &d1)
&& (wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState)) && (wa.map_state == IsViewable || window_getstate(wins[i]) == IconicState))
{ {
real_screen = screen_get_bycoord(globalconf.screens_info, screen, wa.x, wa.y); real_screen = screen_get_bycoord(globalconf.screens_info, screen, wa.x, wa.y);
client_manage(wins[i], &wa, real_screen); client_manage(wins[i], &wa, real_screen);
} }
}
}
if(wins) if(wins)
XFree(wins); XFree(wins);
} }