[mate-power-manager] 01/01: debian/patches: Add 0001_scale_osd_on_hidpi_displays.patch. Scale OSD size correctly on HiDPI displays.

Martin Wimpress flexiondotorg-guest at moszumanska.debian.org
Sat Feb 10 07:41:30 UTC 2018


This is an automated email from the git hooks/post-receive script.

flexiondotorg-guest pushed a commit to branch master
in repository mate-power-manager.

commit 5b05a401e7c87c2ff84d74ebc8e1f140dada0769
Author: Martin Wimpress <martin.wimpress at ubuntu.com>
Date:   Sat Feb 10 07:41:16 2018 +0000

    debian/patches: Add 0001_scale_osd_on_hidpi_displays.patch. Scale OSD size correctly on HiDPI displays.
---
 .../patches/0001_scale_osd_on_hidpi_displays.patch | 62 ++++++++++++++++++++++
 debian/patches/series                              |  2 +-
 debian/patches/ubuntu.series                       |  3 +-
 3 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/debian/patches/0001_scale_osd_on_hidpi_displays.patch b/debian/patches/0001_scale_osd_on_hidpi_displays.patch
new file mode 100644
index 0000000..803fe88
--- /dev/null
+++ b/debian/patches/0001_scale_osd_on_hidpi_displays.patch
@@ -0,0 +1,62 @@
+Author: Victor Kareh <vkareh at vkareh.net>
+Description: Scale OSD size correctly on HiDPI displays
+
+diff --git a/src/msd-osd-window.c b/src/msd-osd-window.c
+index 0b006ad..7797a3b 100644
+--- a/src/msd-osd-window.c
++++ b/src/msd-osd-window.c
+@@ -53,6 +53,7 @@ struct MsdOsdWindowPrivate
+         guint                    hide_timeout_id;
+         guint                    fade_timeout_id;
+         double                   fade_out_alpha;
++        gint                     scale_factor;
+ };
+ 
+ enum {
+@@ -422,13 +423,16 @@ msd_osd_window_is_composited (MsdOsdWindow *window)
+  * @window: a #MsdOsdWindow
+  *
+  * Return value: TRUE if the @window's idea of being composited matches whether
+- * its current screen is actually composited.
++ * its current screen is actually composited and whether the scale factor has
++ * not changed since last draw.
+  */
+ gboolean
+ msd_osd_window_is_valid (MsdOsdWindow *window)
+ {
+         GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (window));
+-        return gdk_screen_is_composited (screen) == window->priv->is_composited;
++        gint scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (window));
++        return gdk_screen_is_composited (screen) == window->priv->is_composited
++            && scale_factor == window->priv->scale_factor;
+ }
+ 
+ static void
+@@ -441,6 +445,7 @@ msd_osd_window_init (MsdOsdWindow *window)
+         screen = gtk_widget_get_screen (GTK_WIDGET (window));
+ 
+         window->priv->is_composited = gdk_screen_is_composited (screen);
++        window->priv->scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (window));
+ 
+         if (window->priv->is_composited) {
+                 gdouble scalew, scaleh, scale;
+@@ -453,8 +458,8 @@ msd_osd_window_init (MsdOsdWindow *window)
+                 gtk_style_context_add_class (style, "window-frame");
+ 
+                 /* assume 130x130 on a 640x480 display and scale from there */
+-                scalew = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / 640.0;
+-                scaleh = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / 480.0;
++                scalew = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / (640.0 * window->priv->scale_factor);
++                scaleh = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / (480.0 * window->priv->scale_factor);
+                 scale = MIN (scalew, scaleh);
+                 size = 130 * MAX (1, scale);
+ 
+@@ -462,7 +467,7 @@ msd_osd_window_init (MsdOsdWindow *window)
+ 
+                 window->priv->fade_out_alpha = 1.0;
+         } else {
+-		gtk_container_set_border_width (GTK_CONTAINER (window), 12);
++                gtk_container_set_border_width (GTK_CONTAINER (window), 12);
+         }
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 8b13789..c314d1b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-
+0001_scale_osd_on_hidpi_displays.patch
\ No newline at end of file
diff --git a/debian/patches/ubuntu.series b/debian/patches/ubuntu.series
index be7dcd6..a70e4c7 100644
--- a/debian/patches/ubuntu.series
+++ b/debian/patches/ubuntu.series
@@ -1 +1,2 @@
-2000_disable_notification_prefs_ui.patch
+0001_scale_osd_on_hidpi_displays.patch
+2000_disable_notification_prefs_ui.patch
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mate/mate-power-manager.git



More information about the pkg-mate-commits mailing list