diff options
author | Keith Packard <keithp@keithp.com> | 2008-12-09 21:26:50 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-01-30 17:41:48 -0800 |
commit | 6f3e2bb207cff069791811ef2bbe7798759ed810 (patch) | |
tree | afd24bc22a38a56322f47ce4c46da80591ccb0db | |
parent | d98d1f4055d8fbae1dc8d8c54467bfef21010694 (diff) |
Add --current option to use new XRRGetScreenResourcesCurrent API
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | xrandr.c | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -1047,7 +1047,7 @@ set_output_info (output_t *output, RROutput xid, XRROutputInfo *output_info) } static void -get_screen (void) +get_screen (Bool current) { if (!has_1_2) fatal ("Server RandR version before 1.2\n"); @@ -1055,8 +1055,11 @@ get_screen (void) XRRGetScreenSizeRange (dpy, root, &minWidth, &minHeight, &maxWidth, &maxHeight); - res = XRRGetScreenResources (dpy, root); - if (!res) fatal ("could not get screen resources\n"); + if (current) + res = XRRGetScreenResourcesCurrent (dpy, root); + else + res = XRRGetScreenResources (dpy, root); + if (!res) fatal ("could not get screen resources"); } static void @@ -1984,6 +1987,7 @@ main (int argc, char **argv) Bool propit = False; Bool query_1 = False; int major, minor; + Bool current = False; #endif program_name = argv[0]; @@ -2007,6 +2011,12 @@ main (int argc, char **argv) verbose = True; continue; } + if (!strcmp("--current", argv[i])) { + current = True; + /* if --current was the only arg, then query */ + if (argc == 2) query = True; + continue; + } if (!strcmp ("-s", argv[i]) || !strcmp ("--size", argv[i])) { if (++i>=argc) usage (); @@ -2480,7 +2490,7 @@ main (int argc, char **argv) { umode_t *m; - get_screen (); + get_screen (current); get_crtcs(); get_outputs(); @@ -2528,7 +2538,7 @@ main (int argc, char **argv) if (has_1_2 && propit) { - get_screen (); + get_screen (current); get_crtcs(); get_outputs(); @@ -2606,7 +2616,7 @@ main (int argc, char **argv) } if (setit_1_2) { - get_screen (); + get_screen (current); get_crtcs (); get_outputs (); set_positions (); @@ -2701,7 +2711,7 @@ main (int argc, char **argv) #define ModeShown 0x80000000 - get_screen (); + get_screen (current); get_crtcs (); get_outputs (); |