diff options
Diffstat (limited to 'src/manage.c')
-rw-r--r-- | src/manage.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/manage.c b/src/manage.c index 8b62a30..2c12f09 100644 --- a/src/manage.c +++ b/src/manage.c @@ -447,37 +447,34 @@ unmanage (rp_window *w) /* When starting up scan existing windows and start managing them. */ void -scanwins(rp_screen *s) +scanwins () { rp_window *win; XWindowAttributes attr; unsigned int i, nwins; Window dw1, dw2, *wins; - XQueryTree(dpy, s->root, &dw1, &dw2, &wins, &nwins); + XQueryTree(dpy, rp_glob_screen.root, &dw1, &dw2, &wins, &nwins); PRINT_DEBUG (("windows: %d\n", nwins)); for (i = 0; i < nwins; i++) { + rp_screen *screen; + XGetWindowAttributes(dpy, wins[i], &attr); if (is_rp_window_for_screen(wins[i]) || attr.override_redirect == True || unmanaged_window (wins[i])) continue; - { - XWindowAttributes root_attr; - - XGetWindowAttributes (dpy, s->root, &root_attr); - PRINT_DEBUG (("attrs: %d %d %d %d %d %d\n", root_attr.x, root_attr.y, - s->left, s->top, s->left + s->width, s->top + s->height));} - if (rp_have_xrandr - && ((attr.x > s->left + s->width) - || (attr.x < s->left) - || (attr.y > s->top + s->height) - || (attr.y < s->top))) continue; + screen = find_screen_by_attr (attr); + if (!screen) + { + PRINT_ERROR (("Unable to find a screen by window attributes\n")); + continue; + } - win = add_to_window_list (s, wins[i]); + win = add_to_window_list (screen, wins[i]); PRINT_DEBUG (("map_state: %s\n", attr.map_state == IsViewable ? "IsViewable": |