From 64546a4518a2cebf0ce5ec6db2c2f8b1959bff18 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Tue, 20 Aug 2024 12:19:50 +0100 Subject: [PATCH] Rename => ConfigFile --- debian/libmiral7.symbols | 4 +-- ...{reloading_config_file.h => config_file.h} | 12 ++++---- src/miral/CMakeLists.txt | 2 +- ...oading_config_file.cpp => config_file.cpp} | 12 ++++---- src/miral/symbols.map | 6 ++-- tests/miral/CMakeLists.txt | 2 +- ...oading_config_file.cpp => config_file.cpp} | 30 +++++++++---------- 7 files changed, 34 insertions(+), 34 deletions(-) rename include/miral/miral/{reloading_config_file.h => config_file.h} (85%) rename src/miral/{reloading_config_file.cpp => config_file.cpp} (93%) rename tests/miral/{reloading_config_file.cpp => config_file.cpp} (92%) diff --git a/debian/libmiral7.symbols b/debian/libmiral7.symbols index 7065eea1cba..87cb25f47e9 100644 --- a/debian/libmiral7.symbols +++ b/debian/libmiral7.symbols @@ -434,6 +434,8 @@ libmiral.so.7 libmiral7 #MINVER# (c++)"vtable for miral::MinimalWindowManager@MIRAL_5.0" 5.0.0 (c++)"vtable for miral::WindowManagementPolicy@MIRAL_5.0" 5.0.0 MIRAL_5.1@MIRAL_5.1 5.1.0 + (c++)"miral::ConfigFile::ConfigFile(miral::MirRunner&, std::filesystem::__cxx11::path, std::function >&, std::filesystem::__cxx11::path const&)>)@MIRAL_5.1" 5.1.0 + (c++)"miral::ConfigFile::~ConfigFile()@MIRAL_5.1" 5.1.0 (c++)"miral::Decorations::Decorations(std::shared_ptr)@MIRAL_5.1" 5.1.0 (c++)"miral::Decorations::always_csd()@MIRAL_5.1" 5.1.0 (c++)"miral::Decorations::always_ssd()@MIRAL_5.1" 5.1.0 @@ -445,6 +447,4 @@ libmiral.so.7 libmiral7 #MINVER# (c++)"miral::IdleListener::on_off(std::function const&)@MIRAL_5.1" 5.1.0 (c++)"miral::IdleListener::on_wake(std::function const&)@MIRAL_5.1" 5.1.0 (c++)"miral::IdleListener::operator()(mir::Server&) const@MIRAL_5.1" 5.1.0 - (c++)"miral::ReloadingConfigFile::ReloadingConfigFile(miral::MirRunner&, std::filesystem::__cxx11::path, std::function >&, std::filesystem::__cxx11::path const&)>)@MIRAL_5.1" 5.1.0 - (c++)"miral::ReloadingConfigFile::~ReloadingConfigFile()@MIRAL_5.1" 5.1.0 (c++)"miral::WindowManagerTools::move_cursor_to(mir::geometry::generic::Point)@MIRAL_5.1" 5.1.0 diff --git a/include/miral/miral/reloading_config_file.h b/include/miral/miral/config_file.h similarity index 85% rename from include/miral/miral/reloading_config_file.h rename to include/miral/miral/config_file.h index 999ae3275cc..409a4b9a1f6 100644 --- a/include/miral/miral/reloading_config_file.h +++ b/include/miral/miral/config_file.h @@ -14,8 +14,8 @@ * along with this program. If not, see . */ -#ifndef MIRAL_RELOADING_CONFIG_FILE_H -#define MIRAL_RELOADING_CONFIG_FILE_H +#ifndef MIRAL_CONFIG_FILE_H +#define MIRAL_CONFIG_FILE_H #include @@ -38,14 +38,14 @@ namespace miral * applied and the supplied path monitored for changes. * \remark MirAL 5.1 */ -class ReloadingConfigFile +class ConfigFile { public: /// Loader functor is passed both the open stream and the actual path (for use in reporting problems) using Loader = std::function; - ReloadingConfigFile(MirRunner& runner, std::filesystem::path file, Loader load_config); - ~ReloadingConfigFile(); + ConfigFile(MirRunner& runner, std::filesystem::path file, Loader load_config); + ~ConfigFile(); private: @@ -54,4 +54,4 @@ class ReloadingConfigFile }; } -#endif //MIRAL_RELOADING_CONFIG_FILE_H +#endif //MIRAL_CONFIG_FILE_H diff --git a/src/miral/CMakeLists.txt b/src/miral/CMakeLists.txt index 07172c39e6d..84351a2e81c 100644 --- a/src/miral/CMakeLists.txt +++ b/src/miral/CMakeLists.txt @@ -55,6 +55,7 @@ add_library(miral-external OBJECT application_authorizer.cpp ${miral_include}/miral/application_authorizer.h application_info.cpp ${miral_include}/miral/application_info.h canonical_window_manager.cpp ${miral_include}/miral/canonical_window_manager.h + config_file.cpp ${miral_include}/miral/config_file.h configuration_option.cpp ${miral_include}/miral/configuration_option.h ${miral_include}/miral/command_line_option.h cursor_theme.cpp ${miral_include}/miral/cursor_theme.h @@ -74,7 +75,6 @@ add_library(miral-external OBJECT window_specification.cpp ${miral_include}/miral/window_specification.h internal_client.cpp ${miral_include}/miral/internal_client.h prepend_event_filter.cpp ${miral_include}/miral/prepend_event_filter.h - reloading_config_file.cpp ${miral_include}/miral/reloading_config_file.h runner.cpp ${miral_include}/miral/runner.h session_lock_listener.cpp ${miral_include}/miral/session_lock_listener.h set_command_line_handler.cpp ${miral_include}/miral/set_command_line_handler.h diff --git a/src/miral/reloading_config_file.cpp b/src/miral/config_file.cpp similarity index 93% rename from src/miral/reloading_config_file.cpp rename to src/miral/config_file.cpp index b5c0e544855..1ae807de8df 100644 --- a/src/miral/reloading_config_file.cpp +++ b/src/miral/config_file.cpp @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -#include +#include #include @@ -67,7 +67,7 @@ auto watch_descriptor(mir::Fd const& inotify_fd, std::optional const& path } } -class miral::ReloadingConfigFile::Self +class miral::ConfigFile::Self { public: Self(MirRunner& runner, path file, Loader load_config); @@ -83,7 +83,7 @@ class miral::ReloadingConfigFile::Self std::unique_ptr fd_handle; }; -miral::ReloadingConfigFile::Self::Self(MirRunner& runner, path file, Loader load_config) : +miral::ConfigFile::Self::Self(MirRunner& runner, path file, Loader load_config) : inotify_fd{inotify_init1(IN_CLOEXEC)}, load_config{load_config}, filename{file.filename()}, @@ -132,14 +132,14 @@ miral::ReloadingConfigFile::Self::Self(MirRunner& runner, path file, Loader load } } -miral::ReloadingConfigFile::ReloadingConfigFile(MirRunner& runner, path file, Loader load_config) : +miral::ConfigFile::ConfigFile(MirRunner& runner, path file, Loader load_config) : self{std::make_shared(runner, file, load_config)} { } -miral::ReloadingConfigFile::~ReloadingConfigFile() = default; +miral::ConfigFile::~ConfigFile() = default; -void miral::ReloadingConfigFile::Self::register_handler(MirRunner& runner) +void miral::ConfigFile::Self::register_handler(MirRunner& runner) { if (directory_watch_descriptor) { diff --git a/src/miral/symbols.map b/src/miral/symbols.map index 542f24cfb72..a2d1fd49702 100644 --- a/src/miral/symbols.map +++ b/src/miral/symbols.map @@ -456,6 +456,8 @@ local: *; MIRAL_5.1 { global: extern "C++" { + miral::ConfigFile::?ConfigFile*; + miral::ConfigFile::ConfigFile*; miral::Decorations::Decorations*; miral::Decorations::always_csd*; miral::Decorations::always_ssd*; @@ -468,12 +470,10 @@ global: miral::IdleListener::on_off*; miral::IdleListener::on_wake*; miral::IdleListener::operator*; - miral::ReloadingConfigFile::?ReloadingConfigFile*; - miral::ReloadingConfigFile::ReloadingConfigFile*; miral::WindowManagerTools::move_cursor_to*; + typeinfo?for?miral::ConfigFile; typeinfo?for?miral::Decorations; typeinfo?for?miral::IdleListener; - typeinfo?for?miral::ReloadingConfigFile; }; } MIRAL_5.0; diff --git a/tests/miral/CMakeLists.txt b/tests/miral/CMakeLists.txt index 24db9802976..f01d0bb0e33 100644 --- a/tests/miral/CMakeLists.txt +++ b/tests/miral/CMakeLists.txt @@ -69,7 +69,7 @@ target_link_libraries(miral-test-internal mir_add_wrapped_executable(miral-test NOINSTALL external_client.cpp - reloading_config_file.cpp + config_file.cpp runner.cpp wayland_extensions.cpp zone.cpp diff --git a/tests/miral/reloading_config_file.cpp b/tests/miral/config_file.cpp similarity index 92% rename from tests/miral/reloading_config_file.cpp rename to tests/miral/config_file.cpp index 2ab01b11ee2..02a1b0f741c 100644 --- a/tests/miral/reloading_config_file.cpp +++ b/tests/miral/config_file.cpp @@ -15,7 +15,7 @@ */ #include "miral/test_server.h" -#include "miral/reloading_config_file.h" +#include "miral/config_file.h" #include #include @@ -23,7 +23,7 @@ #include #include -using miral::ReloadingConfigFile; +using miral::ConfigFile; namespace { @@ -71,7 +71,7 @@ struct TestReloadingConfigFile : miral::TestServer, PendingLoad TestReloadingConfigFile(); MOCK_METHOD(void, load, (std::istream& in, std::filesystem::path path), ()); - std::optional reloading_config_file; + std::optional reloading_config_file; void write_a_file() { @@ -123,7 +123,7 @@ TEST_F(TestReloadingConfigFile, with_no_file_nothing_is_loaded) invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, no_such_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -138,7 +138,7 @@ TEST_F(TestReloadingConfigFile, with_a_file_something_is_loaded) invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, a_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -150,7 +150,7 @@ TEST_F(TestReloadingConfigFile, when_a_file_is_written_something_is_loaded) { invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, a_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -172,7 +172,7 @@ TEST_F(TestReloadingConfigFile, each_time_a_file_is_rewritten_something_is_loade invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, a_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -198,7 +198,7 @@ TEST_F(TestReloadingConfigFile, when_config_home_unset_a_file_in_home_config_is_ invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, config_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -218,7 +218,7 @@ TEST_F(TestReloadingConfigFile, a_file_in_xdg_config_home_is_loaded) invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, config_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -238,7 +238,7 @@ TEST_F(TestReloadingConfigFile, a_file_in_xdg_config_home_is_reloaded) invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, config_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -261,7 +261,7 @@ TEST_F(TestReloadingConfigFile, a_config_in_xdg_conf_dir0_is_loaded) invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, config_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -284,7 +284,7 @@ TEST_F(TestReloadingConfigFile, after_a_config_in_xdg_conf_dir0_is_loaded_a_new_ invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, config_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -308,7 +308,7 @@ TEST_F(TestReloadingConfigFile, a_config_in_xdg_conf_dir0_is_loaded_in_preferenc invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, config_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -328,7 +328,7 @@ TEST_F(TestReloadingConfigFile, a_config_in_xdg_conf_dir1_is_loaded_in_preferenc invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, config_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }}; @@ -347,7 +347,7 @@ TEST_F(TestReloadingConfigFile, a_config_in_xdg_conf_dir2_is_loaded) invoke_runner([this](miral::MirRunner& runner) { - reloading_config_file = ReloadingConfigFile{ + reloading_config_file = ConfigFile{ runner, config_file, [this](std::istream& in, std::filesystem::path path) { load(in, path); }};