# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/xrandr/preferred-output.patch # Copyright (C) 2022 - 2024 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- Make xrandr more convinient by implicitly using the first output if none was specified. - Rene Rebe --- xrandr-1.5.1/xrandr.c.vanilla 2019-08-12 19:50:48.000000000 +0200 +++ xrandr-1.5.1/xrandr.c 2022-07-10 16:00:11.112000000 +0200 @@ -677,7 +677,7 @@ name->string = old->string; if (old->kind & name_index) name->index = old->index; - name->kind |= old->kind; + name->kind = old->kind; } static void @@ -779,6 +779,8 @@ break; if ((common & name_index) && name->index == output->output.index) break; + if (output->output.kind & name_preferred) + break; } return output; } @@ -1820,6 +1820,10 @@ } } } + + if ((output->output.kind & name_preferred) && (output_info->connection == RR_Disconnected)) + continue; + output->found = True; /* @@ -2851,8 +2862,14 @@ continue; } if (!strcmp ("--mode", argv[i])) { - if (!config_output) argerr ("%s must be used after --output\n", argv[i]); if (++i >= argc) argerr ("%s requires an argument\n", argv[i-1]); + if (!config_output) { + config_output = add_output (); + set_name_preferred (&config_output->output); + setit_1_2 = True; + action_requested = True; + } + set_name (&config_output->mode, argv[i], name_string|name_xid); config_output->changes |= changes_mode; continue;