[PATCH RESEND xrandr] Allow -x and -y switches to undo themselves
Connor Behan
connor.behan at gmail.com
Tue Jun 10 23:56:12 PDT 2014
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.behan at gmail.com>
---
xrandr.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/xrandr.c b/xrandr.c
index d284f78..b3b58b1 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,9 @@ main (int argc, char **argv)
{
Rotation rotations = XRRConfigRotations(sc, ¤t_rotation);
+ if (toggle_x && !(current_rotation & RR_Reflect_X)) reflection |= RR_Reflect_X;
+ if (toggle_y && !(current_rotation & RR_Reflect_Y)) reflection |= RR_Reflect_Y;
+
if (query) {
printf("Current rotation - %s\n",
rotation_name (current_rotation));
--
1.9.3
More information about the xorg-devel
mailing list