diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-03-21 00:54:25 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-03-21 00:54:25 +0100 |
| commit | 382bb998fc6e6ccbe8d674f54f0aba4f818efc6a (patch) | |
| tree | 1a518183d9335559271605ce440316337aed34df /unity-shared | |
| parent | 7a2af3c16c89679f22f9186cd7e6ca716e6864ec (diff) | |
UnitySettings: monitor the gnome 'text-scaling-factor' changes and applies them to our scaling factor
(bzr r3725.7.13)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/UnitySettings.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/unity-shared/UnitySettings.cpp b/unity-shared/UnitySettings.cpp index b95d47747..7b4a41728 100644 --- a/unity-shared/UnitySettings.cpp +++ b/unity-shared/UnitySettings.cpp @@ -75,6 +75,7 @@ public: , launcher_widths_(monitors::MAX, DEFAULT_LAUNCHER_WIDTH) , cached_form_factor_(FormFactor::DESKTOP) , cached_double_click_activate_(true) + , changing_gnome_settings_(false) , lowGfx_(false) { for (unsigned i = 0; i < monitors::MAX; ++i) @@ -117,6 +118,14 @@ public: UpdateLimSetting(); }); + signals_.Add<void, GSettings*, const gchar*>(gnome_ui_settings_, "changed::" + GNOME_TEXT_SCALE_FACTOR, [this] (GSettings*, const gchar* t) { + if (!changing_gnome_settings_) + { + double new_scale_factor = g_settings_get_double(gnome_ui_settings_, GNOME_TEXT_SCALE_FACTOR.c_str()); + g_settings_set_double(ui_settings_, TEXT_SCALE_FACTOR.c_str(), new_scale_factor); + } + }); + signals_.Add<void, GSettings*, const gchar*>(lim_settings_, "changed", [this] (GSettings*, const gchar*) { UpdateLimSetting(); }); @@ -250,11 +259,13 @@ public: void UpdateAppsScaling(double scale) { + changing_gnome_settings_ = true; unsigned integer_scaling = std::max<unsigned>(1, scale); double point_scaling = scale / static_cast<double>(integer_scaling); double text_scale_factor = parent_->font_scaling() * point_scaling; g_settings_set_uint(gnome_ui_settings_, GNOME_SCALE_FACTOR.c_str(), integer_scaling); g_settings_set_double(gnome_ui_settings_, GNOME_TEXT_SCALE_FACTOR.c_str(), text_scale_factor); + changing_gnome_settings_ = false; } Settings* parent_; @@ -268,6 +279,7 @@ public: std::vector<int> launcher_widths_; FormFactor cached_form_factor_; bool cached_double_click_activate_; + bool changing_gnome_settings_; bool lowGfx_; }; |
