summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Behan <connor.behan@gmail.com>2014-06-10 23:56:12 -0700
committerAaron Plattner <aplattner@nvidia.com>2014-06-25 16:35:02 -0700
commit00477d88297eaa6c87aa144548590c32540e3928 (patch)
tree8a8c0ed98e0ad8cb2798be0cca79a216b7c06c22
parent7d464312fb84c080a6e287edd21a794193a0dd78 (diff)
Allow -x and -y switches to undo themselves
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@gmail.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com> Tested-by: Aaron Plattner <aplattner@nvidia.com> Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
-rw-r--r--xrandr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/xrandr.c b/xrandr.c
index d284f78..db56915 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, &current_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));