]> code.delx.au - spectrwm/commitdiff
Fix scan_xrandr to fallback when a scan results in no new regions.
authorReginald Kennedy <rk@rejii.com>
Mon, 27 Aug 2012 15:45:03 +0000 (23:45 +0800)
committerReginald Kennedy <rk@rejii.com>
Mon, 27 Aug 2012 15:45:03 +0000 (23:45 +0800)
spectrwm.c

index 5550805a9fc1c1155ed2895b0d61a107388fd811..893d5208003d825ba5ac3986a1405036b755325c 100644 (file)
@@ -8177,6 +8177,8 @@ scan_xrandr(int i)
        xcb_randr_crtc_t                                *crtc;
        xcb_screen_t                                    *screen;
 
+       DNPRINTF(SWM_D_MISC, "scan_xrandr: screen: %d\n", i);
+
        if ((screen = get_screen(i)) == NULL)
                errx(1, "ERROR: can't get screen %d.", i);
 
@@ -8204,7 +8206,7 @@ scan_xrandr(int i)
                        new_region(&screens[i], 0, 0,
                            screen->width_in_pixels,
                            screen->height_in_pixels);
-                       return;
+                       goto out;
                } else
                        ncrtc = srr->num_crtcs;
 
@@ -8230,12 +8232,16 @@ scan_xrandr(int i)
                        free(cir);
                }
                free(srr);
-       } else
+       }
 #endif /* SWM_XRR_HAS_CRTC */
-       {
+
+       /* If detection failed, create a single region that spans the screen. */
+       if (TAILQ_EMPTY(&screens[i].rl))
                new_region(&screens[i], 0, 0, screen->width_in_pixels,
                    screen->height_in_pixels);
-       }
+
+out:
+       DNPRINTF(SWM_D_MISC, "scan_xrandr: done.\n");
 }
 
 void