From 195c1784bad12239e479722a03adfa372795d2bd Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Mon, 18 May 2020 22:16:17 +1200 Subject: [PATCH] WindowServer: Rename WindowManager wm_config() to config() It looked a little silly with all of the callers saying wm.wm --- Services/WindowServer/Compositor.cpp | 12 +++++------ Services/WindowServer/WindowManager.cpp | 28 ++++++++++++------------- Services/WindowServer/WindowManager.h | 7 ++----- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Services/WindowServer/Compositor.cpp b/Services/WindowServer/Compositor.cpp index 57f87178df6..4e1d1b6c98e 100644 --- a/Services/WindowServer/Compositor.cpp +++ b/Services/WindowServer/Compositor.cpp @@ -108,7 +108,7 @@ void Compositor::compose() { auto& wm = WindowManager::the(); if (m_wallpaper_mode == WallpaperMode::Unchecked) - m_wallpaper_mode = mode_to_enum(wm.wm_config()->read_entry("Background", "Mode", "simple")); + m_wallpaper_mode = mode_to_enum(wm.config()->read_entry("Background", "Mode", "simple")); auto& ws = Screen::the(); auto dirty_rects = move(m_dirty_rects); @@ -133,7 +133,7 @@ void Compositor::compose() }; Color background_color = wm.palette().desktop_background(); - String background_color_entry = wm.wm_config()->read_entry("Background", "Color", ""); + String background_color_entry = wm.config()->read_entry("Background", "Color", ""); if (!background_color_entry.is_empty()) { background_color = Color::from_string(background_color_entry).value_or(background_color); } @@ -320,8 +320,8 @@ void Compositor::invalidate(const Gfx::Rect& a_rect) bool Compositor::set_background_color(const String& background_color) { auto& wm = WindowManager::the(); - wm.wm_config()->write_entry("Background", "Color", background_color); - bool ret_val = wm.wm_config()->sync(); + wm.config()->write_entry("Background", "Color", background_color); + bool ret_val = wm.config()->sync(); if (ret_val) Compositor::invalidate(); @@ -332,8 +332,8 @@ bool Compositor::set_background_color(const String& background_color) bool Compositor::set_wallpaper_mode(const String& mode) { auto& wm = WindowManager::the(); - wm.wm_config()->write_entry("Background", "Mode", mode); - bool ret_val = wm.wm_config()->sync(); + wm.config()->write_entry("Background", "Mode", mode); + bool ret_val = wm.config()->sync(); if (ret_val) { m_wallpaper_mode = mode_to_enum(mode); diff --git a/Services/WindowServer/WindowManager.cpp b/Services/WindowServer/WindowManager.cpp index 52b437169a4..e6a8bc0c4f0 100644 --- a/Services/WindowServer/WindowManager.cpp +++ b/Services/WindowServer/WindowManager.cpp @@ -84,7 +84,7 @@ WindowManager::~WindowManager() NonnullRefPtr WindowManager::get_cursor(const String& name, const Gfx::Point& hotspot) { - auto path = m_wm_config->read_entry("Cursor", name, "/res/cursors/arrow.png"); + auto path = m_config->read_entry("Cursor", name, "/res/cursors/arrow.png"); auto gb = Gfx::Bitmap::load_from_file(path); if (gb) return Cursor::create(*gb, hotspot); @@ -93,7 +93,7 @@ NonnullRefPtr WindowManager::get_cursor(const String& name, const Gfx::P NonnullRefPtr WindowManager::get_cursor(const String& name) { - auto path = m_wm_config->read_entry("Cursor", name, "/res/cursors/arrow.png"); + auto path = m_config->read_entry("Cursor", name, "/res/cursors/arrow.png"); auto gb = Gfx::Bitmap::load_from_file(path); if (gb) @@ -103,12 +103,12 @@ NonnullRefPtr WindowManager::get_cursor(const String& name) void WindowManager::reload_config(bool set_screen) { - m_wm_config = Core::ConfigFile::open("/etc/WindowServer/WindowServer.ini"); + m_config = Core::ConfigFile::open("/etc/WindowServer/WindowServer.ini"); - m_double_click_speed = m_wm_config->read_num_entry("Input", "DoubleClickSpeed", 250); + m_double_click_speed = m_config->read_num_entry("Input", "DoubleClickSpeed", 250); if (set_screen) { - set_resolution(m_wm_config->read_num_entry("Screen", "Width", 1920), m_wm_config->read_num_entry("Screen", "Height", 1080)); + set_resolution(m_config->read_num_entry("Screen", "Width", 1920), m_config->read_num_entry("Screen", "Height", 1080)); } m_arrow_cursor = get_cursor("Arrow", { 2, 2 }); @@ -148,17 +148,17 @@ bool WindowManager::set_resolution(int width, int height) return IterationDecision::Continue; }); } - if (m_wm_config) { + if (m_config) { if (success) { - dbg() << "Saving resolution: " << Gfx::Size(width, height) << " to config file at " << m_wm_config->file_name(); - m_wm_config->write_num_entry("Screen", "Width", width); - m_wm_config->write_num_entry("Screen", "Height", height); - m_wm_config->sync(); + dbg() << "Saving resolution: " << Gfx::Size(width, height) << " to config file at " << m_config->file_name(); + m_config->write_num_entry("Screen", "Width", width); + m_config->write_num_entry("Screen", "Height", height); + m_config->sync(); } else { - dbg() << "Saving fallback resolution: " << resolution() << " to config file at " << m_wm_config->file_name(); - m_wm_config->write_num_entry("Screen", "Width", resolution().width()); - m_wm_config->write_num_entry("Screen", "Height", resolution().height()); - m_wm_config->sync(); + dbg() << "Saving fallback resolution: " << resolution() << " to config file at " << m_config->file_name(); + m_config->write_num_entry("Screen", "Width", resolution().width()); + m_config->write_num_entry("Screen", "Height", resolution().height()); + m_config->sync(); } } return success; diff --git a/Services/WindowServer/WindowManager.h b/Services/WindowServer/WindowManager.h index f498c47ae51..b577f0fafde 100644 --- a/Services/WindowServer/WindowManager.h +++ b/Services/WindowServer/WindowManager.h @@ -81,10 +81,7 @@ public: Palette palette() const { return Palette(*m_palette); } - RefPtr wm_config() const - { - return m_wm_config; - } + RefPtr config() const { return m_config; } void reload_config(bool); void add_window(Window&); @@ -279,7 +276,7 @@ private: NonnullRefPtr m_palette; - RefPtr m_wm_config; + RefPtr m_config; WeakPtr m_dnd_client; String m_dnd_text;