WindowServer: Rename WindowManager wm_config() to config()

It looked a little silly with all of the callers saying wm.wm
This commit is contained in:
Shannon Booth 2020-05-18 22:16:17 +12:00 committed by Andreas Kling
parent d3eccf0409
commit 195c1784ba
Notes: sideshowbarker 2024-07-19 06:30:01 +09:00
3 changed files with 22 additions and 25 deletions

View File

@ -108,7 +108,7 @@ void Compositor::compose()
{ {
auto& wm = WindowManager::the(); auto& wm = WindowManager::the();
if (m_wallpaper_mode == WallpaperMode::Unchecked) 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& ws = Screen::the();
auto dirty_rects = move(m_dirty_rects); auto dirty_rects = move(m_dirty_rects);
@ -133,7 +133,7 @@ void Compositor::compose()
}; };
Color background_color = wm.palette().desktop_background(); 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()) { if (!background_color_entry.is_empty()) {
background_color = Color::from_string(background_color_entry).value_or(background_color); 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) bool Compositor::set_background_color(const String& background_color)
{ {
auto& wm = WindowManager::the(); auto& wm = WindowManager::the();
wm.wm_config()->write_entry("Background", "Color", background_color); wm.config()->write_entry("Background", "Color", background_color);
bool ret_val = wm.wm_config()->sync(); bool ret_val = wm.config()->sync();
if (ret_val) if (ret_val)
Compositor::invalidate(); Compositor::invalidate();
@ -332,8 +332,8 @@ bool Compositor::set_background_color(const String& background_color)
bool Compositor::set_wallpaper_mode(const String& mode) bool Compositor::set_wallpaper_mode(const String& mode)
{ {
auto& wm = WindowManager::the(); auto& wm = WindowManager::the();
wm.wm_config()->write_entry("Background", "Mode", mode); wm.config()->write_entry("Background", "Mode", mode);
bool ret_val = wm.wm_config()->sync(); bool ret_val = wm.config()->sync();
if (ret_val) { if (ret_val) {
m_wallpaper_mode = mode_to_enum(mode); m_wallpaper_mode = mode_to_enum(mode);

View File

@ -84,7 +84,7 @@ WindowManager::~WindowManager()
NonnullRefPtr<Cursor> WindowManager::get_cursor(const String& name, const Gfx::Point& hotspot) 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); auto gb = Gfx::Bitmap::load_from_file(path);
if (gb) if (gb)
return Cursor::create(*gb, hotspot); 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) 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); auto gb = Gfx::Bitmap::load_from_file(path);
if (gb) if (gb)
@ -103,12 +103,12 @@ NonnullRefPtr<Cursor> WindowManager::get_cursor(const String& name)
void WindowManager::reload_config(bool set_screen) 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) { 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 }); m_arrow_cursor = get_cursor("Arrow", { 2, 2 });
@ -148,17 +148,17 @@ bool WindowManager::set_resolution(int width, int height)
return IterationDecision::Continue; return IterationDecision::Continue;
}); });
} }
if (m_wm_config) { if (m_config) {
if (success) { if (success) {
dbg() << "Saving resolution: " << Gfx::Size(width, height) << " to config file at " << m_wm_config->file_name(); dbg() << "Saving resolution: " << Gfx::Size(width, height) << " to config file at " << m_config->file_name();
m_wm_config->write_num_entry("Screen", "Width", width); m_config->write_num_entry("Screen", "Width", width);
m_wm_config->write_num_entry("Screen", "Height", height); m_config->write_num_entry("Screen", "Height", height);
m_wm_config->sync(); m_config->sync();
} else { } else {
dbg() << "Saving fallback resolution: " << resolution() << " to config file at " << m_wm_config->file_name(); dbg() << "Saving fallback resolution: " << resolution() << " to config file at " << m_config->file_name();
m_wm_config->write_num_entry("Screen", "Width", resolution().width()); m_config->write_num_entry("Screen", "Width", resolution().width());
m_wm_config->write_num_entry("Screen", "Height", resolution().height()); m_config->write_num_entry("Screen", "Height", resolution().height());
m_wm_config->sync(); m_config->sync();
} }
} }
return success; return success;

View File

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