From 58551fb3f63774f605d621cc1c0e6dd1b28d4df0 Mon Sep 17 00:00:00 2001 From: hustlerone Date: Tue, 17 Feb 2026 09:01:20 +0100 Subject: [PATCH 1/2] ci: match that of Wayfire Matches the uncrustify setup on Wayfire. --- .github/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0659862..4518d2f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,9 @@ jobs: - run: git clone http://github.com/ammen99/uncrustify - run: cd uncrustify && mkdir build && cd build && cmake ../ && make && cd ../../ - run: curl https://raw.githubusercontent.com/WayfireWM/wayfire/master/uncrustify.ini > uncrustify.ini - - run: git ls-files | grep "hpp$\|cpp$" | xargs ./uncrustify/build/uncrustify -c uncrustify.ini --check + - run: git ls-files | grep "hpp$\|cpp$" | xargs ./uncrustify/build/uncrustify -c uncrustify.ini --no-backup --replace + - run: git diff + - run: git diff | diff - /dev/null &> /dev/null run_tests: name: "Check that tests do not break" runs-on: ubuntu-latest From 20df229c740e5e6edc66e7556e378c94e730678b Mon Sep 17 00:00:00 2001 From: hustlerone Date: Thu, 12 Feb 2026 13:47:51 +0100 Subject: [PATCH 2/2] Add extra output modes. Namely, `MODE_HIGHRR` and `MODE_HIGHRES`. They change the criteria on the "best" monitor mode. This is a breaking change. mode_t now only allows enums for the AUTO mode(s). --- include/wayfire/config/types.hpp | 12 +++++++++--- src/types.cpp | 31 +++++++++++++++++++++++++++---- test/types_test.cpp | 20 +++++++++++++------- uncrustify | 1 + 4 files changed, 50 insertions(+), 14 deletions(-) create mode 160000 uncrustify diff --git a/include/wayfire/config/types.hpp b/include/wayfire/config/types.hpp index 991c92b..2e8f38d 100644 --- a/include/wayfire/config/types.hpp +++ b/include/wayfire/config/types.hpp @@ -487,6 +487,10 @@ enum mode_type_t { /** Output was configured in automatic mode. */ MODE_AUTO, + /** Output was configured with the biggest refresh rate. */ + MODE_HIGHRR, + /** Output was configured with the biggest resolution. */ + MODE_HIGHRES, /** Output was configured to be turned off. */ MODE_OFF, /** Output was configured with a given resolution. */ @@ -502,11 +506,13 @@ enum mode_type_t struct mode_t { /** - * Initialize an OFF or AUTO mode. + * Initialize a mode. * - * @param auto_on If true, the created mode will be an AUTO mode. + * @param mode One of: MODE_AUTO, MODE_HIGHRR, MODE_HIGHRES, MODE_OFF. MODE_HIGHRR prioritizes refresh + * rate, MODE_HIGHRES prioritises resolution and MODE_AUTO chooses whatever the display tells it to use. + * @throws std::invalid_argument if the mode isn't MODE_AUTO, MODEHIGHRR, MODEHIGHRES or MODE_OFF. */ - mode_t(bool auto_on = false); + mode_t(output_config::mode_type_t mode); /** * Initialize the mode with source self. diff --git a/src/types.cpp b/src/types.cpp index 4906b78..473954b 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1067,9 +1067,14 @@ std::string wf::option_type::to_string( } /* ------------------------- Output config types ---------------------------- */ -wf::output_config::mode_t::mode_t(bool auto_on) +wf::output_config::mode_t::mode_t(output_config::mode_type_t mode) { - this->type = auto_on ? MODE_AUTO : MODE_OFF; + if ((mode == MODE_RESOLUTION) || (mode == MODE_MIRROR)) + { + throw std::invalid_argument("Invalid mode definition"); + } + + this->type = mode; } wf::output_config::mode_t::mode_t(int32_t width, int32_t height, int32_t refresh) @@ -1132,6 +1137,8 @@ bool wf::output_config::mode_t::operator ==(const mode_t& other) const return mirror_from == other.mirror_from; case MODE_AUTO: + case MODE_HIGHRR: + case MODE_HIGHRES: case MODE_OFF: return true; } @@ -1145,12 +1152,22 @@ std::optional wf::option_type::from_string( { if (string == "off") { - return wf::output_config::mode_t{false}; + return wf::output_config::mode_t{wf::output_config::mode_type_t::MODE_OFF}; } if ((string == "auto") || (string == "default")) { - return wf::output_config::mode_t{true}; + return wf::output_config::mode_t{wf::output_config::mode_type_t::MODE_AUTO}; + } + + if ((string == "highres")) + { + return wf::output_config::mode_t{wf::output_config::mode_type_t::MODE_HIGHRES}; + } + + if ((string == "highrr")) + { + return wf::output_config::mode_t{wf::output_config::mode_type_t::MODE_HIGHRR}; } if (string.substr(0, 6) == "mirror") @@ -1204,6 +1221,12 @@ std::string wf::option_type::to_string(const output_config::mode_t& value) case output_config::MODE_AUTO: return "auto"; + case output_config::MODE_HIGHRR: + return "highrr"; + + case output_config::MODE_HIGHRES: + return "highres"; + case output_config::MODE_OFF: return "off"; diff --git a/test/types_test.cpp b/test/types_test.cpp index b7519da..71df743 100644 --- a/test/types_test.cpp +++ b/test/types_test.cpp @@ -416,9 +416,11 @@ TEST_CASE("wf::output_config::mode_t") using namespace wf::output_config; std::vector modes = { - mt{true}, - mt{true}, - mt{false}, + mt{MODE_HIGHRES}, + mt{MODE_HIGHRR}, + mt{MODE_AUTO}, + mt{MODE_AUTO}, + mt{MODE_OFF}, mt{1920, 1080, 0}, mt{1920, 1080, 59000}, mt{1920, 1080, 59000}, @@ -426,6 +428,8 @@ TEST_CASE("wf::output_config::mode_t") }; std::vector types = { + MODE_HIGHRES, + MODE_HIGHRR, MODE_AUTO, MODE_AUTO, MODE_OFF, @@ -436,6 +440,8 @@ TEST_CASE("wf::output_config::mode_t") }; std::vector desc = { + "highres", + "highrr", "auto", "default", "off", @@ -452,10 +458,10 @@ TEST_CASE("wf::output_config::mode_t") "1920 1080", }; - CHECK(modes[3].get_refresh() == 0); - CHECK(modes[4].get_refresh() == 59000); - CHECK(modes[5].get_refresh() == 59000); - CHECK(modes[6].get_mirror_from() == "eDP-1"); + CHECK(modes[5].get_refresh() == 0); + CHECK(modes[6].get_refresh() == 59000); + CHECK(modes[7].get_refresh() == 59000); + CHECK(modes[8].get_mirror_from() == "eDP-1"); for (size_t i = 0; i < modes.size(); i++) { diff --git a/uncrustify b/uncrustify new file mode 160000 index 0000000..968c213 --- /dev/null +++ b/uncrustify @@ -0,0 +1 @@ +Subproject commit 968c2132de0e44f9c99f38378a24a40ca5362212