summaryrefslogtreecommitdiff
path: root/libmate-desktop
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2018-04-10 00:52:39 -0400
committerraveit65 <[email protected]>2018-04-25 21:04:13 +0200
commitb24f151ee9f92ccec7fd493b1065f0b1ee2d0f10 (patch)
tree5c80885a775380db2cb665ad286293a6b0473639 /libmate-desktop
parentabaa1e43a86bcc2a764ea15d6b3394b8889cfb3f (diff)
downloadmate-desktop-b24f151ee9f92ccec7fd493b1065f0b1ee2d0f10.tar.bz2
mate-desktop-b24f151ee9f92ccec7fd493b1065f0b1ee2d0f10.tar.xz
Support background fallback on HiDPI
This change is a super hacky way of supporting the fallback desktop background (without caja) on HiDPI displays. It does this by doing two things: providing a function for scaled-up background surfaces using cairo_scale; and triggering a change signal when the entire background schema is re-loaded, and so triggering a redraw.
Diffstat (limited to 'libmate-desktop')
-rw-r--r--libmate-desktop/mate-bg.c38
-rw-r--r--libmate-desktop/mate-bg.h7
2 files changed, 43 insertions, 2 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index e1d05db..0201552 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -276,6 +276,9 @@ mate_bg_load_from_preferences (MateBG *bg)
mate_bg_load_from_gsettings (bg, settings);
g_object_unref (settings);
+
+ /* Queue change to force background redraw */
+ queue_changed (bg);
}
/* This function loads default system settings */
@@ -1138,6 +1141,36 @@ mate_bg_create_surface (MateBG *bg,
int height,
gboolean root)
{
+ return mate_bg_create_surface_scale (bg,
+ window,
+ width,
+ height,
+ 1,
+ root);
+}
+
+/**
+ * mate_bg_create_surface:
+ * @bg: MateBG
+ * @window:
+ * @width:
+ * @height:
+ * @scale:
+ * @root:
+ *
+ * Create a scaled surface that can be set as background for @window. If @is_root is
+ * TRUE, the surface created will be created by a temporary X server connection
+ * so that if someone calls XKillClient on it, it won't affect the application
+ * who created it.
+ **/
+cairo_surface_t *
+mate_bg_create_surface_scale (MateBG *bg,
+ GdkWindow *window,
+ int width,
+ int height,
+ int scale,
+ gboolean root)
+{
int pm_width, pm_height;
cairo_surface_t *surface;
@@ -1156,10 +1189,9 @@ mate_bg_create_surface (MateBG *bg,
mate_bg_get_pixmap_size (bg, width, height, &pm_width, &pm_height);
-
if (root)
{
- surface = make_root_pixmap (window, pm_width, pm_height);
+ surface = make_root_pixmap (window, pm_width * scale, pm_height * scale);
}
else
{
@@ -1168,6 +1200,8 @@ mate_bg_create_surface (MateBG *bg,
}
cr = cairo_create (surface);
+ cairo_scale (cr, (double)scale, (double)scale);
+
if (!bg->filename && bg->color_type == MATE_BG_COLOR_SOLID) {
gdk_cairo_set_source_rgba (cr, &(bg->primary));
}
diff --git a/libmate-desktop/mate-bg.h b/libmate-desktop/mate-bg.h
index a1adf36..16fda8c 100644
--- a/libmate-desktop/mate-bg.h
+++ b/libmate-desktop/mate-bg.h
@@ -127,6 +127,13 @@ cairo_surface_t *mate_bg_create_surface (MateBG *bg,
int height,
gboolean root);
+cairo_surface_t *mate_bg_create_surface_scale (MateBG *bg,
+ GdkWindow *window,
+ int width,
+ int height,
+ int scale,
+ gboolean root);
+
gboolean mate_bg_get_image_size (MateBG *bg,
MateDesktopThumbnailFactory *factory,
int best_width,