[PATCH xrandr] xrandr: Consider transform when placing monitors relatively to each other.

Michal Srb msrb at suse.com
Tue Apr 24 08:57:20 UTC 2018


For example: xrandr --output HDMI-1 --scale 0.5 --left-of HDMI-2
Will no create any gap between HDMI-1 and HDMI-2.
---
 xrandr.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/xrandr.c b/xrandr.c
index 7f1e867..21e121a 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -2015,6 +2015,7 @@ set_positions (void)
     Bool	keep_going;
     Bool	any_set;
     int		min_x, min_y;
+    box_t	bounds;
 
     for (;;)
     {
@@ -2054,20 +2055,24 @@ set_positions (void)
 	    
 	    switch (output->relation) {
 	    case relation_left_of:
+		mode_geometry(output->mode_info, output->rotation, &output->transform.transform, &bounds);
 		output->y = relation->y;
-		output->x = relation->x - mode_width (output->mode_info, output->rotation);
+		output->x = relation->x - bounds.x2;
 		break;
 	    case relation_right_of:
+		mode_geometry(relation->mode_info, relation->rotation, &relation->transform.transform, &bounds);
 		output->y = relation->y;
-		output->x = relation->x + mode_width (relation->mode_info, relation->rotation);
+		output->x = relation->x + bounds.x2;
 		break;
 	    case relation_above:
+		mode_geometry(output->mode_info, output->rotation, &output->transform.transform, &bounds);
 		output->x = relation->x;
-		output->y = relation->y - mode_height (output->mode_info, output->rotation);
+		output->y = relation->y - bounds.y2;
 		break;
 	    case relation_below:
+		mode_geometry(relation->mode_info, relation->rotation, &relation->transform.transform, &bounds);
 		output->x = relation->x;
-		output->y = relation->y + mode_height (relation->mode_info, relation->rotation);
+		output->y = relation->y + bounds.y2;
 		break;
 	    case relation_same_as:
 		output->x = relation->x;
-- 
2.13.6



More information about the xorg-devel mailing list