From 0c6fd178ed2e45cdfef6a82de766f2db57a4900f Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 21 Nov 2012 22:08:12 +0100 Subject: [PATCH] screen: Ignore RANDR displays in clone mode (FS#1046) This just makes the code for ignoring screens on Xinerama apply to RANDR screens as well. The code now also applies to protocol screens, but there is only ever a single one of those, so nothing should change here. Signed-off-by: Uli Schlachter --- screen.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/screen.c b/screen.c index 3380959b..81e063ee 100644 --- a/screen.c +++ b/screen.c @@ -59,6 +59,18 @@ screen_xsitoarea(xcb_xinerama_screen_info_t si) static void screen_add(screen_t new_screen) { + foreach(screen_to_test, globalconf.screens) + if(new_screen.geometry.x == screen_to_test->geometry.x + && new_screen.geometry.y == screen_to_test->geometry.y) + { + /* we already have a screen for this area, just check if + * it's not bigger and drop it */ + screen_to_test->geometry.width = + MAX(new_screen.geometry.width, screen_to_test->geometry.width); + screen_to_test->geometry.height = + MAX(new_screen.geometry.height, screen_to_test->geometry.height); + return; + } signal_add(&new_screen.signals, "property::workarea"); screen_array_append(&globalconf.screens, new_screen); } @@ -175,27 +187,10 @@ screen_scan_xinerama(void) /* now check if screens overlaps (same x,y): if so, we take only the biggest one */ for(int screen = 0; screen < xinerama_screen_number; screen++) { - bool drop = false; - foreach(screen_to_test, globalconf.screens) - if(xsi[screen].x_org == screen_to_test->geometry.x - && xsi[screen].y_org == screen_to_test->geometry.y) - { - /* we already have a screen for this area, just check if - * it's not bigger and drop it */ - drop = true; - int i = screen_array_indexof(&globalconf.screens, screen_to_test); - screen_to_test->geometry.width = - MAX(xsi[screen].width, xsi[i].width); - screen_to_test->geometry.height = - MAX(xsi[screen].height, xsi[i].height); - } - if(!drop) - { - screen_t s; - p_clear(&s, 1); - s.geometry = screen_xsitoarea(xsi[screen]); - screen_add(s); - } + screen_t s; + p_clear(&s, 1); + s.geometry = screen_xsitoarea(xsi[screen]); + screen_add(s); } p_delete(&xsq);