# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/xrandr/preferred-output.patch # Copyright (C) 2022 - 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-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;