diff options
author | Stefano Karapetsas <[email protected]> | 2013-11-12 16:53:49 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2013-11-12 16:53:49 +0100 |
commit | 3430ce6cb75adfc8185426d50844e12dfc7f4e3a (patch) | |
tree | aa3a2d934d59281c26bc74dee3470d9547495537 /savers/gs-theme-engine.c | |
parent | 31d78b8027002647879a0c3ffd508b0c93c2202b (diff) | |
download | mate-screensaver-3430ce6cb75adfc8185426d50844e12dfc7f4e3a.tar.bz2 mate-screensaver-3430ce6cb75adfc8185426d50844e12dfc7f4e3a.tar.xz |
savers: Add GTK3 support
Diffstat (limited to 'savers/gs-theme-engine.c')
-rw-r--r-- | savers/gs-theme-engine.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/savers/gs-theme-engine.c b/savers/gs-theme-engine.c index f456e42..18ebfad 100644 --- a/savers/gs-theme-engine.c +++ b/savers/gs-theme-engine.c @@ -31,6 +31,10 @@ #include "gs-theme-engine.h" #include "gs-theme-engine-marshal.h" +#if GTK_CHECK_VERSION (3, 0, 0) +#define GTK_WIDGET_VISIBLE gtk_widget_get_visible +#endif + static void gs_theme_engine_class_init (GSThemeEngineClass *klass); static void gs_theme_engine_init (GSThemeEngine *engine); static void gs_theme_engine_finalize (GObject *object); @@ -115,7 +119,9 @@ static void gs_theme_engine_clear (GtkWidget *widget) { GdkColor color = { 0, 0x0000, 0x0000, 0x0000 }; +#if !GTK_CHECK_VERSION (3, 0, 0) GdkColormap *colormap; +#endif GtkStateType state; g_return_if_fail (GS_IS_THEME_ENGINE (widget)); @@ -126,16 +132,24 @@ gs_theme_engine_clear (GtkWidget *widget) } state = (GtkStateType) 0; +#if GTK_CHECK_VERSION (3, 0, 0) + while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (widget)->bg)) +#else while (state < (GtkStateType) G_N_ELEMENTS (widget->style->bg)) +#endif { gtk_widget_modify_bg (widget, state, &color); state++; } +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_window_set_background (gtk_widget_get_window (widget), &color); +#else colormap = gdk_drawable_get_colormap (widget->window); gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE); gdk_window_set_background (widget->window, &color); gdk_window_clear (widget->window); +#endif gdk_flush (); } @@ -209,12 +223,20 @@ gs_theme_engine_get_window_size (GSThemeEngine *engine, return; } +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_window_get_geometry (gtk_widget_get_window (GTK_WIDGET (engine)), + NULL, + NULL, + width, + height); +#else gdk_window_get_geometry (GTK_WIDGET (engine)->window, NULL, NULL, width, height, NULL); +#endif } GdkWindow * @@ -222,5 +244,9 @@ gs_theme_engine_get_window (GSThemeEngine *engine) { g_return_val_if_fail (GS_IS_THEME_ENGINE (engine), NULL); +#if GTK_CHECK_VERSION (3, 0, 0) + return gtk_widget_get_window (GTK_WIDGET (engine)); +#else return GTK_WIDGET (engine)->window; +#endif } |