diff options
author | Dave Airlie <airlied@redhat.com> | 2015-03-30 15:00:55 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-03-30 15:00:55 +1000 |
commit | fa9a06a0e3aec4b105701c4b230d86802a770f25 (patch) | |
tree | 624e1eb7285ceee71903b5ba6578058f43c6bef3 | |
parent | 6327690b121a5b513521694e75d6aa93dbc56153 (diff) |
xrandr: add --listactivemonitorsrandr-1.5
this tests the new flag asking for active vs all monitors
-rw-r--r-- | xrandr.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -155,6 +155,7 @@ usage(void) " --setprovideroutputsource <prov-xid> <source-xid>\n" " --setprovideroffloadsink <prov-xid> <sink-xid>\n" " --listmonitors\n" + " --listactivemonitors\n" " --setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}\n" " --delmonitor <name>\n"); } @@ -2581,7 +2582,7 @@ find_provider (name_t *name) } static void -get_monitors(void) +get_monitors(Bool get_active) { XRRMonitorInfo *m; int n; @@ -2589,7 +2590,7 @@ get_monitors(void) if (!has_1_5 || monitors) return; - m = XRRGetMonitors(dpy, root, &n); + m = XRRGetMonitors(dpy, root, get_active, &n); if (n == -1) fatal("get monitors failed\n"); monitors = calloc(1, sizeof (monitors_t)); @@ -2637,6 +2638,7 @@ main (int argc, char **argv) Bool provsetoffsink = False; Bool monitorit = False; Bool list_monitors = False; + Bool list_active_monitors = False; int major, minor; Bool current = False; Bool toggle_x = False; @@ -3178,6 +3180,12 @@ main (int argc, char **argv) action_requested = True; continue; } + if (!strcmp("--listactivemonitors", argv[i])) + { + list_active_monitors = True; + action_requested = True; + continue; + } if (!strcmp("--setmonitor", argv[i])) { umonitor_t *m = calloc(1, sizeof (umonitor_t)), **l; @@ -3545,7 +3553,7 @@ main (int argc, char **argv) } get_screen(current); - get_monitors(); + get_monitors(True); get_crtcs(); get_outputs(); @@ -3934,7 +3942,7 @@ main (int argc, char **argv) } } } - if (list_monitors) { + if (list_monitors || list_active_monitors) { if (!has_1_5) { printf("RandR 1.5 not supported\n"); @@ -3942,7 +3950,7 @@ main (int argc, char **argv) } get_screen(current); - get_monitors(); + get_monitors(list_active_monitors ? True : False); get_crtcs(); get_outputs(); |