[Xfce4-commits] [xfce/xfwm4] 01/01: hdpi: Adjust default theme with scale

noreply at xfce.org noreply at xfce.org
Thu Jun 6 21:14:56 CEST 2019


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

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit a58d44fa1521e56242f5c0127c009dc53326c598
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Thu Jun 6 21:08:08 2019 +0200

    hdpi: Adjust default theme with scale
    
    Now that we ship the default theme in different sizes, adjust the
    default theme based on scale.
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/parserc.c  |  4 ----
 src/settings.c | 22 +++++++++++++++++++++-
 src/settings.h |  8 ++++++++
 3 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/src/parserc.c b/src/parserc.c
index 21d464c..e271ebb 100644
--- a/src/parserc.c
+++ b/src/parserc.c
@@ -35,10 +35,6 @@
 #include "settings.h"
 #include "parserc.h"
 
-#ifndef DEFAULT_THEME
-#define DEFAULT_THEME "Default"
-#endif
-
 #define TOINT(x)                (x ? atoi(x) : 0)
 
 gboolean
diff --git a/src/settings.c b/src/settings.c
index 8929be0..6cc7154 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -265,6 +265,26 @@ getTitleShadow (Settings *rc, const gchar * name)
     return TITLE_SHADOW_NONE;
 }
 
+static const gchar *
+getThemeName (ScreenInfo *screen_info, Settings *rc)
+{
+    const gchar *theme = getStringValue ("theme", rc);
+    gint scale;
+
+    scale = gdk_window_get_scale_factor (myScreenGetGdkWindow (screen_info));
+    if (scale == 1)
+    {
+        return theme;
+    }
+
+    if (strcmp (theme, DEFAULT_THEME))
+    {
+        return theme;
+    }
+
+    return DEFAULT_HDPI_THEME;
+}
+
 static void
 loadTheme (ScreenInfo *screen_info, Settings *rc)
 {
@@ -385,7 +405,7 @@ loadTheme (ScreenInfo *screen_info, Settings *rc)
     }
 
     /* Then load xfwm4 theme values */
-    theme = getThemeDir (getStringValue ("theme", rc), THEMERC);
+    theme = getThemeDir (getThemeName (screen_info, rc), THEMERC);
     parseRc (THEMERC, theme, rc);
 
     /* And finally redo a pass for transitive definitions of colors */
diff --git a/src/settings.h b/src/settings.h
index ad00636..f20c6db 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -35,6 +35,14 @@
 #ifndef INC_SETTINGS_H
 #define INC_SETTINGS_H
 
+#ifndef DEFAULT_THEME
+#define DEFAULT_THEME "Default"
+#endif
+
+#ifndef DEFAULT_HDPI_THEME
+#define DEFAULT_HDPI_THEME "Default-xhdpi"
+#endif
+
 enum
 {
     TITLE_SHADOW_NONE  = 0,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list