Переглянути джерело

WindowServer: Rename WindowManager wm_config() to config()

It looked a little silly with all of the callers saying wm.wm
Shannon Booth 5 роки тому
батько
коміт
195c1784ba

+ 6 - 6
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);

+ 14 - 14
Services/WindowServer/WindowManager.cpp

@@ -84,7 +84,7 @@ WindowManager::~WindowManager()
 
 NonnullRefPtr<Cursor> 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<Cursor> WindowManager::get_cursor(const String& name, const Gfx::P
 
 NonnullRefPtr<Cursor> 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<Cursor> 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;

+ 2 - 5
Services/WindowServer/WindowManager.h

@@ -81,10 +81,7 @@ public:
 
     Palette palette() const { return Palette(*m_palette); }
 
-    RefPtr<Core::ConfigFile> wm_config() const
-    {
-        return m_wm_config;
-    }
+    RefPtr<Core::ConfigFile> config() const { return m_config; }
     void reload_config(bool);
 
     void add_window(Window&);
@@ -279,7 +276,7 @@ private:
 
     NonnullRefPtr<Gfx::PaletteImpl> m_palette;
 
-    RefPtr<Core::ConfigFile> m_wm_config;
+    RefPtr<Core::ConfigFile> m_config;
 
     WeakPtr<ClientConnection> m_dnd_client;
     String m_dnd_text;