st/settings: Add magnifier activation property and bind to settings

The same code for reading the current magnifier state is repeated in both
shell-recorder, shell-screenshot and magnifier itself.
So to move this inside a property of st-settings so that we can refer to it
all over the places removing duplications.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/473
This commit is contained in:
Marco Trevisan (Treviño)
2019-03-12 21:41:18 +00:00
committed by Florian Müllner
parent d7632bbd3d
commit 5357e0a18c
4 changed files with 53 additions and 28 deletions

View File

@ -7,14 +7,12 @@
#include <meta/meta-plugin.h>
#include <meta/meta-shaped-texture.h>
#include <meta/meta-cursor-tracker.h>
#include <st/st.h>
#include "shell-global.h"
#include "shell-screenshot.h"
#include "shell-util.h"
#define A11Y_APPS_SCHEMA "org.gnome.desktop.a11y.applications"
#define MAGNIFIER_ACTIVE_KEY "screen-magnifier-enabled"
typedef struct _ShellScreenshotPrivate ShellScreenshotPrivate;
struct _ShellScreenshot
@ -271,9 +269,12 @@ should_draw_cursor_image (ShellScreenshotMode mode)
{
if (mode == SHELL_SCREENSHOT_WINDOW || !meta_is_wayland_compositor ())
{
g_autoptr (GSettings) settings = g_settings_new (A11Y_APPS_SCHEMA);
StSettings *settings = st_settings_get ();
gboolean magnifier_active = FALSE;
if (!g_settings_get_boolean (settings, MAGNIFIER_ACTIVE_KEY))
g_object_get (settings, "magnifier-active", &magnifier_active, NULL);
if (!magnifier_active)
return TRUE;
}