People who want to dick around might think it is safe to run "xrandr -x"
before they know any of the other syntax. When "xrandr -x" again does
not get back to a normal screen, they are stuck having to read a manpage
with reflected text.

Signed-off-by: Connor Behan <connor.be...@gmail.com>
---
 xrandr.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xrandr.c b/xrandr.c
index d284f78..c00a9cb 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -2571,6 +2571,8 @@ main (int argc, char **argv)
     Bool        provsetoffsink = False;
     int                major, minor;
     Bool       current = False;
+    Bool        toggle_x = False;
+    Bool        toggle_y = False;
 
     program_name = argv[0];
     for (i = 1; i < argc; i++) {
@@ -2639,13 +2641,13 @@ main (int argc, char **argv)
        }
 
        if (!strcmp ("-x", argv[i])) {
-           reflection |= RR_Reflect_X;
+           toggle_x = True;
            setit = True;
            action_requested = True;
            continue;
        }
        if (!strcmp ("-y", argv[i])) {
-           reflection |= RR_Reflect_Y;
+           toggle_y = True;
            setit = True;
            action_requested = True;
            continue;
@@ -3824,6 +3826,11 @@ main (int argc, char **argv)
     {
        Rotation rotations = XRRConfigRotations(sc, &current_rotation);
 
+        if (toggle_x || toggle_y) {
+            if (!(current_rotation & RR_Reflect_X)) reflection |= RR_Reflect_X;
+            if (!(current_rotation & RR_Reflect_Y)) reflection |= RR_Reflect_Y;
+        }
+
        if (query) {
            printf("Current rotation - %s\n",
                   rotation_name (current_rotation));
-- 
1.9.3

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to