[gnome-shell/f20] Backport high dpi support patches from upstream
drago01
drago01 at fedoraproject.org
Wed Feb 12 20:51:16 UTC 2014
commit fbffb8776f21fc569cc86738a4440f1aea694a66
Author: Adel Gadllah <adel.gadllah at gmail.com>
Date: Wed Feb 12 21:51:37 2014 +0100
Backport high dpi support patches from upstream
0001-st-Add-high-dpi-support.patch | 160 ++++++++++++++++++++
...-shell-global-Set-high-dpi-scaling-factor.patch | 60 ++++++++
gnome-shell.spec | 9 +-
3 files changed, 228 insertions(+), 1 deletions(-)
---
diff --git a/0001-st-Add-high-dpi-support.patch b/0001-st-Add-high-dpi-support.patch
new file mode 100644
index 0000000..054bd83
--- /dev/null
+++ b/0001-st-Add-high-dpi-support.patch
@@ -0,0 +1,160 @@
+From 272479b5cc3f6e8c457e15ef50603f4c1ebfcbd9 Mon Sep 17 00:00:00 2001
+From: Adel Gadllah <adel.gadllah at gmail.com>
+Date: Wed, 12 Feb 2014 17:29:08 +0100
+Subject: [PATCH 1/2] st: Add high dpi support
+
+Add a scale_factor property to StThemeContext that can
+be used to enable (integer) scaling of pixel values.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=705410
+---
+ src/st/st-theme-context.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++
+ src/st/st-theme-node.c | 5 ++-
+ 2 files changed, 83 insertions(+), 1 deletion(-)
+
+diff --git a/src/st/st-theme-context.c b/src/st/st-theme-context.c
+index 399a858..34ac295 100644
+--- a/src/st/st-theme-context.c
++++ b/src/st/st-theme-context.c
+@@ -34,6 +34,8 @@ struct _StThemeContext {
+
+ /* set of StThemeNode */
+ GHashTable *nodes;
++
++ int scale_factor;
+ };
+
+ struct _StThemeContextClass {
+@@ -44,6 +46,12 @@ struct _StThemeContextClass {
+
+ enum
+ {
++ PROP_0,
++ PROP_SCALE_FACTOR
++};
++
++enum
++{
+ CHANGED,
+
+ LAST_SIGNAL
+@@ -57,6 +65,15 @@ static void on_icon_theme_changed (StTextureCache *cache,
+ StThemeContext *context);
+ static void st_theme_context_changed (StThemeContext *context);
+
++static void st_theme_context_set_property (GObject *object,
++ guint prop_id,
++ const GValue *value,
++ GParamSpec *pspec);
++static void st_theme_context_get_property (GObject *object,
++ guint prop_id,
++ GValue *value,
++ GParamSpec *pspec);
++
+ static void
+ st_theme_context_finalize (GObject *object)
+ {
+@@ -86,8 +103,23 @@ st_theme_context_class_init (StThemeContextClass *klass)
+ {
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
++ object_class->set_property = st_theme_context_set_property;
++ object_class->get_property = st_theme_context_get_property;
+ object_class->finalize = st_theme_context_finalize;
+
++ /**
++ * StThemeContext:scale-factor:
++ *
++ * The scaling factor used or high dpi scaling.
++ */
++ g_object_class_install_property (object_class,
++ PROP_SCALE_FACTOR,
++ g_param_spec_int ("scale-factor",
++ "Scale factor",
++ "Integer scale factor used for high dpi scaling",
++ 0, G_MAXINT, 1,
++ G_PARAM_READABLE | G_PARAM_WRITABLE));
++
+ signals[CHANGED] =
+ g_signal_new ("changed",
+ G_TYPE_FROM_CLASS (klass),
+@@ -114,6 +146,53 @@ st_theme_context_init (StThemeContext *context)
+ context->nodes = g_hash_table_new_full ((GHashFunc) st_theme_node_hash,
+ (GEqualFunc) st_theme_node_equal,
+ g_object_unref, NULL);
++ context->scale_factor = 1;
++}
++
++static void
++st_theme_context_set_property (GObject *object,
++ guint prop_id,
++ const GValue *value,
++ GParamSpec *pspec)
++{
++ StThemeContext *context = ST_THEME_CONTEXT (object);
++
++ switch (prop_id)
++ {
++ case PROP_SCALE_FACTOR:
++ {
++ int scale_factor = g_value_get_int (value);
++ if (scale_factor != context->scale_factor)
++ {
++ context->scale_factor = scale_factor;
++ st_theme_context_changed (context);
++ }
++
++ break;
++ }
++ default:
++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
++ break;
++ }
++}
++
++static void
++st_theme_context_get_property (GObject *object,
++ guint prop_id,
++ GValue *value,
++ GParamSpec *pspec)
++{
++ StThemeContext *context = ST_THEME_CONTEXT (object);
++
++ switch (prop_id)
++ {
++ case PROP_SCALE_FACTOR:
++ g_value_set_int (value, context->scale_factor);
++ break;
++ default:
++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
++ break;
++ }
+ }
+
+ /**
+diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c
+index 22b3833..68aea17 100644
+--- a/src/st/st-theme-node.c
++++ b/src/st/st-theme-node.c
+@@ -1015,6 +1015,9 @@ get_length_from_term (StThemeNode *node,
+ } type = ABSOLUTE;
+
+ double multiplier = 1.0;
++ int scale_factor;
++
++ g_object_get (node->context, "scale-factor", &scale_factor, NULL);
+
+ if (term->type != TERM_NUMBER)
+ {
+@@ -1028,7 +1031,7 @@ get_length_from_term (StThemeNode *node,
+ {
+ case NUM_LENGTH_PX:
+ type = ABSOLUTE;
+- multiplier = 1;
++ multiplier = 1 * scale_factor;
+ break;
+ case NUM_LENGTH_PT:
+ type = POINTS;
+--
+1.8.5.3
+
diff --git a/0002-shell-global-Set-high-dpi-scaling-factor.patch b/0002-shell-global-Set-high-dpi-scaling-factor.patch
new file mode 100644
index 0000000..483bca3
--- /dev/null
+++ b/0002-shell-global-Set-high-dpi-scaling-factor.patch
@@ -0,0 +1,60 @@
+From ba459f4d202e6b0656994bea16edac00359edb1f Mon Sep 17 00:00:00 2001
+From: Adel Gadllah <adel.gadllah at gmail.com>
+Date: Wed, 12 Feb 2014 19:18:37 +0100
+Subject: [PATCH 2/3] shell-global: Set high dpi scaling factor
+
+Set the scaling factor based on the xsetting.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=705410
+---
+ src/shell-global.c | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/src/shell-global.c b/src/shell-global.c
+index cc82566..b2b6e52 100644
+--- a/src/shell-global.c
++++ b/src/shell-global.c
+@@ -746,6 +746,20 @@ global_stage_after_paint (gpointer data)
+ return TRUE;
+ }
+
++
++static void
++update_scale_factor (gpointer data)
++{
++ ShellGlobal *global = SHELL_GLOBAL (data);
++ ClutterStage *stage = CLUTTER_STAGE (global->stage);
++ StThemeContext *context = st_theme_context_get_for_stage (stage);
++ GValue value = G_VALUE_INIT;
++
++ g_value_init (&value, G_TYPE_INT);
++ gdk_screen_get_setting (global->gdk_screen, "gdk-window-scaling-factor", &value);
++ g_object_set (context, "scale-factor", g_value_get_int (&value), NULL);
++}
++
+ /* This is an IBus workaround. The flow of events with IBus is that every time
+ * it gets gets a key event, it:
+ *
+@@ -924,9 +938,19 @@ _shell_global_set_plugin (ShellGlobal *global,
+ g_signal_connect (global->meta_display, "notify::focus-window",
+ G_CALLBACK (focus_window_changed), global);
+
++ /*
++ * We connect to GdkScreen's monitors-changed here to avoid
++ * a race condition. GdkScreen's monitors-changed signal is
++ * emitted *after* the xsetting has been updated.
++ */
++ g_signal_connect (global->gdk_screen, "monitors-changed",
++ G_CALLBACK (update_scale_factor), global);
++
+ gdk_event_handler_set (gnome_shell_gdk_event_handler, global, NULL);
+
+ global->focus_manager = st_focus_manager_get_for_stage (global->stage);
++
++ update_scale_factor (global);
+ }
+
+ GjsContext *
+--
+1.8.5.3
+
diff --git a/gnome-shell.spec b/gnome-shell.spec
index 380cb61..a079e92 100644
--- a/gnome-shell.spec
+++ b/gnome-shell.spec
@@ -1,6 +1,6 @@
Name: gnome-shell
Version: 3.10.3
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Window management and application launching for GNOME
Group: User Interface/Desktops
@@ -17,6 +17,8 @@ Patch10: fix-app-switcher-regressions.patch
Patch11: track-skip-taskbar-changes.patch
Patch12: 0001-window-tracker-Be-more-cautious-when-setting-focus-a.patch
Patch13: 0001-shell-app-Don-t-crash-when-trying-to-dispose.patch
+Patch14: 0001-st-Add-high-dpi-support.patch
+Patch15: 0002-shell-global-Set-high-dpi-scaling-factor.patch
%define clutter_version 1.13.4
%define gnome_bluetooth_version 1:3.9.0
@@ -125,6 +127,8 @@ easy to use experience.
%patch11 -p1 -b .track-skip-taskbar-changes
%patch12 -p1 -b .fix-app-menu
%patch13 -p1 -b .fix-app-dispose-crash
+%patch14 -p1 -b .hdpi-st
+%patch15 -p1 -b .hdpi-core
%build
(if ! test -x configure; then NOCONFIGURE=1 ./autogen.sh; fi;
@@ -184,6 +188,9 @@ glib-compile-schemas --allow-any-name %{_datadir}/glib-2.0/schemas &> /dev/null
%exclude %{_datadir}/gtk-doc
%changelog
+* Wed Feb 12 2014 Adel Gadllah <adel.gadllah at gmail.com> - 3.10.4-5
+- Backport high dpi support patches from upstream
+
* Thu Feb 06 2014 Florian Müllner <fmuellner at redhat.com> - 3.10.4-4
- Backport fix for crash when using some Java applications (#1058314)
More information about the scm-commits
mailing list