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

Submitted by Michal Srb on April 24, 2018, 8:57 a.m.

Details

Message ID 20180424085720.3080-1-msrb@suse.com
State New
Headers show
Series "xrandr: Consider transform when placing monitors relatively to each other." ( rev: 1 ) in X.org

Not browsing as part of any series.

Commit Message

Michal Srb April 24, 2018, 8:57 a.m.
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(-)

Patch hide | download patch | download mbox

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;