diff options
author | Alexei Sorokin <[email protected]> | 2017-01-15 18:24:34 +0300 |
---|---|---|
committer | Alexei Sorokin <[email protected]> | 2017-01-15 18:24:34 +0300 |
commit | 78e6e31dbde35a3f3dd4e95f2d8af90de2c17b1f (patch) | |
tree | be328fdaee82db6fe18a0544a6434c337a4607a5 /src/gs-manager.c | |
parent | 15d98b9835333ba174687b4ec58eae7bcc7d94e2 (diff) | |
download | mate-screensaver-78e6e31dbde35a3f3dd4e95f2d8af90de2c17b1f.tar.bz2 mate-screensaver-78e6e31dbde35a3f3dd4e95f2d8af90de2c17b1f.tar.xz |
avoid deprecated gdk_window_set_background functions
Which are completely broken in GTK+ 3.22.
Also remove some redundant separate Gtk2 code.
Diffstat (limited to 'src/gs-manager.c')
-rw-r--r-- | src/gs-manager.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/gs-manager.c b/src/gs-manager.c index c5ce240..a2ad590 100644 --- a/src/gs-manager.c +++ b/src/gs-manager.c @@ -1277,9 +1277,9 @@ static void apply_background_to_window (GSManager *manager, GSWindow *window) { -#if GTK_CHECK_VERSION (3, 0, 0) cairo_surface_t *surface; -#else +#if !GTK_CHECK_VERSION (3, 0, 0) + cairo_t *cr; GdkPixmap *pixmap; #endif GdkScreen *screen; @@ -1289,11 +1289,7 @@ apply_background_to_window (GSManager *manager, if (manager->priv->bg == NULL) { gs_debug ("No background available"); -#if GTK_CHECK_VERSION (3, 0, 0) gs_window_set_background_surface (window, NULL); -#else - gs_window_set_background_pixmap (window, NULL); -#endif } screen = gs_window_get_screen (window); @@ -1306,17 +1302,25 @@ apply_background_to_window (GSManager *manager, width, height, FALSE); - gs_window_set_background_surface (window, surface); - cairo_surface_destroy (surface); #else + surface = gdk_window_create_similar_surface (gs_window_get_gdk_window (window), + CAIRO_CONTENT_COLOR, + width, + height); + cr = cairo_create (surface); + pixmap = mate_bg_create_pixmap (manager->priv->bg, gs_window_get_gdk_window (window), width, height, FALSE); - gs_window_set_background_pixmap (window, pixmap); + gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0); + cairo_paint (cr); + cairo_destroy (cr); g_object_unref (pixmap); #endif + gs_window_set_background_surface (window, surface); + cairo_surface_destroy (surface); } static void |