summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--savers/floaters.c41
-rw-r--r--savers/gs-theme-window.c11
-rw-r--r--savers/gste-popsquares.c131
-rw-r--r--src/copy-theme-dialog.c4
-rw-r--r--src/gs-fade.c162
-rw-r--r--src/gs-grab-x11.c47
-rw-r--r--src/gs-lock-plug.c64
-rw-r--r--src/gs-manager.c48
-rw-r--r--src/gs-window-x11.c33
-rw-r--r--src/mate-screensaver-preferences.c15
10 files changed, 442 insertions, 114 deletions
diff --git a/savers/floaters.c b/savers/floaters.c
index dd0d85e..d565d63 100644
--- a/savers/floaters.c
+++ b/savers/floaters.c
@@ -265,7 +265,7 @@ static CachedSource *cached_source_new (cairo_pattern_t *pattern,
gint height);
static void cached_source_free (CachedSource *source);
-static ScreenSaver *screen_saver_new (GtkDrawingArea *drawing_area,
+static ScreenSaver *screen_saver_new (GtkWidget *drawing_area,
const gchar *filename,
gint max_floater_count,
gboolean should_do_rotations,
@@ -841,7 +841,7 @@ screen_saver_floater_do_draw (ScreenSaver *screen_saver,
}
static ScreenSaver *
-screen_saver_new (GtkDrawingArea *drawing_area,
+screen_saver_new (GtkWidget *drawing_area,
const gchar *filename,
gint max_floater_count,
gboolean should_do_rotations,
@@ -851,7 +851,7 @@ screen_saver_new (GtkDrawingArea *drawing_area,
screen_saver = g_new (ScreenSaver, 1);
screen_saver->filename = g_strdup (filename);
- screen_saver->drawing_area = GTK_WIDGET (drawing_area);
+ screen_saver->drawing_area = drawing_area;
screen_saver->cached_sources =
g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) cached_source_free);
@@ -1216,15 +1216,13 @@ int
main (int argc,
char *argv[])
{
- ScreenSaver *screen_saver;
- GtkWidget *window;
- GtkWidget *drawing_area;
-#if GTK_CHECK_VERSION (3, 0, 0)
- GdkRGBA bg;
- GdkRGBA fg;
-#else
- GtkStyle *style;
- GtkStateType state;
+ ScreenSaver *screen_saver;
+ GtkWidget *window;
+ GtkWidget *drawing_area;
+#if !GTK_CHECK_VERSION (3, 0, 0)
+ GtkStyle *style;
+ GtkStateType state;
+ GdkColor black = { 0, 0x0000, 0x0000, 0x0000 };
#endif
GError *error;
@@ -1264,25 +1262,14 @@ main (int argc,
g_signal_connect (G_OBJECT (window), "delete-event",
G_CALLBACK (gtk_main_quit), NULL);
- drawing_area = gtk_drawing_area_new ();
+ drawing_area = GTK_WIDGET (gtk_drawing_area_new ());
-#if GTK_CHECK_VERSION (3, 0, 0)
- bg.red = 0;
- bg.green = 0;
- bg.blue = 0;
- bg.alpha = 1.0;
- fg.red = 0.8;
- fg.green = 0.8;
- fg.blue = 0.8;
- fg.alpha = 1.0;
- gtk_widget_override_background_color (drawing_area, 0, &bg);
- gtk_widget_override_color (drawing_area, 0, &fg);
-#else
+#if !GTK_CHECK_VERSION (3, 0, 0)
style = gtk_widget_get_style (drawing_area);
state = (GtkStateType) 0;
while (state < (GtkStateType) G_N_ELEMENTS (style->bg))
{
- gtk_widget_modify_bg (drawing_area, state, &style->mid[state]);
+ gtk_widget_modify_bg (drawing_area, state, &black);
state++;
}
#endif
@@ -1290,7 +1277,7 @@ main (int argc,
gtk_widget_show (drawing_area);
gtk_container_add (GTK_CONTAINER (window), drawing_area);
- screen_saver = screen_saver_new (GTK_DRAWING_AREA (drawing_area),
+ screen_saver = screen_saver_new (drawing_area,
filenames[0], max_floater_count,
should_do_rotations, should_show_paths);
g_strfreev (filenames);
diff --git a/savers/gs-theme-window.c b/savers/gs-theme-window.c
index 0741aad..47c731e 100644
--- a/savers/gs-theme-window.c
+++ b/savers/gs-theme-window.c
@@ -62,6 +62,7 @@ gs_theme_window_class_init (GSThemeWindowClass *klass)
widget_class->realize = gs_theme_window_real_realize;
}
+#if !GTK_CHECK_VERSION (3, 0, 0)
static void
force_no_pixmap_background (GtkWidget *widget)
{
@@ -90,11 +91,16 @@ force_no_pixmap_background (GtkWidget *widget)
gtk_widget_set_name (widget, "gs-window");
}
+#endif
static void
gs_theme_window_init (GSThemeWindow *window)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
+#else
force_no_pixmap_background (GTK_WIDGET (window));
+#endif
}
static void
@@ -177,9 +183,14 @@ gs_theme_window_real_realize (GtkWidget *widget)
return;
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_style_context_set_background (gtk_widget_get_style_context (widget),
+ window);
+#else
gtk_style_set_background (gtk_widget_get_style (widget),
window,
GTK_STATE_NORMAL);
+#endif
gdk_window_set_decorations (window, (GdkWMDecoration) 0);
gdk_window_set_events (window, gdk_window_get_events (window) | event_mask);
diff --git a/savers/gste-popsquares.c b/savers/gste-popsquares.c
index 837bb2c..44caa48 100644
--- a/savers/gste-popsquares.c
+++ b/savers/gste-popsquares.c
@@ -51,7 +51,11 @@ struct GSTEPopsquaresPrivate
int ncolors;
int subdivision;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA *colors;
+#else
GdkColor *colors;
+#endif
square *squares;
};
@@ -63,12 +67,12 @@ static GObjectClass *parent_class = NULL;
G_DEFINE_TYPE (GSTEPopsquares, gste_popsquares, GS_TYPE_THEME_ENGINE)
static void
-hsv_to_rgb (int h,
- double s,
- double v,
- unsigned short *r,
- unsigned short *g,
- unsigned short *b)
+hsv_to_rgb (int h,
+ double s,
+ double v,
+ double *r,
+ double *g,
+ double *b)
{
double H, S, V, R, G, B;
double p1, p2, p3;
@@ -138,27 +142,27 @@ hsv_to_rgb (int h,
B = p2;
}
- *r = R * 65535;
- *g = G * 65535;
- *b = B * 65535;
+ *r = R;
+ *g = G;
+ *b = B;
}
static void
-rgb_to_hsv (unsigned short r,
- unsigned short g,
- unsigned short b,
- int *h,
- double *s,
- double *v)
+rgb_to_hsv (double r,
+ double g,
+ double b,
+ int *h,
+ double *s,
+ double *v)
{
double R, G, B, H, S, V;
double cmax, cmin;
double cmm;
int imax;
- R = ((double) r) / 65535.0;
- G = ((double) g) / 65535.0;
- B = ((double) b) / 65535.0;
+ R = r;
+ G = g;
+ B = b;
cmax = R;
cmin = G;
imax = 1;
@@ -226,11 +230,13 @@ make_color_ramp (GdkColormap *colormap,
int h2,
double s2,
double v2,
- GdkColor *colors,
- int n_colors,
#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA *colors,
+ int n_colors,
gboolean closed)
#else
+ GdkColor *colors,
+ int n_colors,
gboolean closed,
gboolean allocate,
gboolean writable)
@@ -267,13 +273,25 @@ make_color_ramp (GdkColormap *colormap,
for (i = 0; i < ncolors; i++)
{
+#if !GTK_CHECK_VERSION (3, 0, 0)
+ double red, green, blue;
+
+#endif
hsv_to_rgb ((int) (h1 + (i * dh)),
(s1 + (i * ds)),
(v1 + (i * dv)),
+#if GTK_CHECK_VERSION (3, 0, 0)
&colors [i].red,
&colors [i].green,
&colors [i].blue);
-#if !GTK_CHECK_VERSION (3, 0, 0)
+ colors [i].alpha = 1.0;
+#else
+ &red, &green, &blue);
+
+ colors [i].red = (guint16) (red * 65535.0);
+ colors [i].green = (guint16) (green * 65535.0);
+ colors [i].blue = (guint16) (blue * 65535.0);
+
if (allocate)
{
gdk_colormap_alloc_color (colormap,
@@ -310,25 +328,55 @@ randomize_square_colors (square *squares,
}
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void
+set_colors (GtkWidget *widget,
+ GdkRGBA *fg,
+ GdkRGBA *bg)
+{
+ GtkStyleContext *style;
+
+ style = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_save (style);
+ gtk_style_context_set_state (style, GTK_STATE_FLAG_SELECTED);
+ gtk_style_context_get_background_color (style,
+ gtk_style_context_get_state (style),
+ bg);
+ if (bg->alpha == 0.0)
+ gtk_style_context_get_color (style,
+ gtk_style_context_get_state (style),
+ bg);
+ gtk_style_context_restore (style);
+
+ fg->red = bg->red * 0.7;
+ fg->green = bg->green * 0.7;
+ fg->blue = bg->blue * 0.7;
+ fg->alpha = bg->alpha;
+}
+#else
static void
-set_colors (GdkWindow *window,
+set_colors (GtkWidget *widget,
GdkColor *fg,
GdkColor *bg)
{
- GtkWidget *widget;
+ GtkWidget *style_widget;
+ GtkStyle *style;
GdkColor color;
- widget = gtk_invisible_new ();
+ style_widget = gtk_invisible_new ();
+ style = gtk_widget_get_style (style_widget);
- color = gtk_widget_get_style (widget)->dark [GTK_STATE_SELECTED];
+ color = style->dark [GTK_STATE_SELECTED];
fg->red = color.red;
fg->green = color.green;
fg->blue = color.blue;
- color = gtk_widget_get_style (widget)->bg [GTK_STATE_SELECTED];
+ color = style->bg [GTK_STATE_SELECTED];
bg->red = color.red;
bg->green = color.green;
bg->blue = color.blue;
}
+#endif
static void
gste_popsquares_set_property (GObject *object,
@@ -413,8 +461,13 @@ setup_colors (GSTEPopsquares *pop)
double s1, v1, s2, v2 = 0;
int h1, h2 = 0;
int nsquares;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA fg;
+ GdkRGBA bg;
+#else
GdkColor fg;
GdkColor bg;
+#endif
GdkWindow *window;
window = gs_theme_engine_get_window (GS_THEME_ENGINE (pop));
@@ -424,24 +477,37 @@ setup_colors (GSTEPopsquares *pop)
return;
}
- set_colors (window, &fg, &bg);
+ set_colors (GTK_WIDGET (pop), &fg, &bg);
if (pop->priv->colors)
{
g_free (pop->priv->colors);
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ pop->priv->colors = g_new0 (GdkRGBA, pop->priv->ncolors);
+#else
pop->priv->colors = g_new0 (GdkColor, pop->priv->ncolors);
+#endif
+#if GTK_CHECK_VERSION (3, 0, 0)
rgb_to_hsv (fg.red, fg.green, fg.blue, &h1, &s1, &v1);
rgb_to_hsv (bg.red, bg.green, bg.blue, &h2, &s2, &v2);
-#if GTK_CHECK_VERSION (3, 0, 0)
make_color_ramp (h1, s1, v1,
h2, s2, v2,
pop->priv->colors,
pop->priv->ncolors,
TRUE);
#else
+ rgb_to_hsv ((double) (fg.red / 65535.0),
+ (double) (fg.green / 65535.0),
+ (double) (fg.blue / 65535.0),
+ &h1, &s1, &v1);
+ rgb_to_hsv ((double) (bg.red / 65535.0),
+ (double) (bg.green / 65535.0),
+ (double) (bg.blue / 65535.0),
+ &h2, &s2, &v2);
+
make_color_ramp (gtk_widget_get_colormap (GTK_WIDGET (pop)),
h1, s1, v1,
h2, s2, v2,
@@ -484,10 +550,12 @@ gste_popsquares_real_draw (GtkWidget *widget,
gste_popsquares_real_expose (GtkWidget *widget,
GdkEventExpose *event)
{
+ cairo_t *cr;
+
if (GTK_WIDGET_CLASS (parent_class)->expose_event) {
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
}
- cairo_t *cr = gdk_cairo_create (event->window);
+ cr = gdk_cairo_create (event->window);
#endif
draw_frame (GSTE_POPSQUARES (widget), cr);
@@ -545,7 +613,6 @@ gste_popsquares_class_init (GSTEPopsquaresClass *klass)
g_type_class_add_private (klass, sizeof (GSTEPopsquaresPrivate));
}
-
static void
draw_frame (GSTEPopsquares *pop,
cairo_t *cr)
@@ -580,7 +647,11 @@ draw_frame (GSTEPopsquares *pop,
{
square *s = (square *) &pop->priv->squares [gw * y + x];
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_cairo_set_source_rgba (cr, &(pop->priv->colors [s->color]));
+#else
gdk_cairo_set_source_color (cr, &(pop->priv->colors [s->color]));
+#endif
cairo_rectangle (cr, s->x, s->y,
border ? s->w - border : s->w,
border ? s->h - border : s->h);
diff --git a/src/copy-theme-dialog.c b/src/copy-theme-dialog.c
index 69db9a3..0fd64f2 100644
--- a/src/copy-theme-dialog.c
+++ b/src/copy-theme-dialog.c
@@ -527,7 +527,11 @@ eel_gtk_label_make_bold (GtkLabel *label)
* theme or user prefs, since the font desc only has the
* weight flag turned on.
*/
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_override_font (GTK_WIDGET (label), font_desc);
+#else
gtk_widget_modify_font (GTK_WIDGET (label), font_desc);
+#endif
pango_font_description_free (font_desc);
}
diff --git a/src/gs-fade.c b/src/gs-fade.c
index b571ec8..c037718 100644
--- a/src/gs-fade.c
+++ b/src/gs-fade.c
@@ -82,6 +82,12 @@ struct GSFadeScreenPrivate
/* one per screen also */
XF86VidModeGamma vmg;
#endif /* HAVE_XF86VMODE_GAMMA */
+#if GTK_CHECK_VERSION(3, 10, 0)
+ gboolean (*fade_setup) (GSFade *fade);
+ gboolean (*fade_set_alpha_gamma) (GSFade *fade,
+ gdouble alpha);
+ void (*fade_finish) (GSFade *fade);
+#else
gboolean (*fade_setup) (GSFade *fade,
int screen);
gboolean (*fade_set_alpha_gamma) (GSFade *fade,
@@ -89,6 +95,7 @@ struct GSFadeScreenPrivate
gdouble alpha);
void (*fade_finish) (GSFade *fade,
int screen);
+#endif
};
struct GSFadePrivate
@@ -105,9 +112,13 @@ struct GSFadePrivate
gdouble alpha_per_iter;
gdouble current_alpha;
+#if GTK_CHECK_VERSION(3, 10, 0)
+ struct GSFadeScreenPrivate screen_priv;
+#else
int num_screens;
struct GSFadeScreenPrivate *screen_priv;
+#endif
};
enum
@@ -286,12 +297,20 @@ gs_fade_set_enabled (GSFade *fade,
#ifdef HAVE_XF86VMODE_GAMMA
static gboolean
+#if GTK_CHECK_VERSION(3, 10, 0)
+gamma_fade_setup (GSFade *fade)
+#else
gamma_fade_setup (GSFade *fade, int screen_idx)
+#endif
{
gboolean res;
struct GSFadeScreenPrivate *screen_priv;
+#if GTK_CHECK_VERSION(3, 10, 0)
+ screen_priv = &fade->priv->screen_priv;
+#else
screen_priv = &fade->priv->screen_priv[screen_idx];
+#endif
if (screen_priv->info)
return TRUE;
@@ -313,7 +332,14 @@ gamma_fade_setup (GSFade *fade, int screen_idx)
{
/* have ramps */
- res = XF86VidModeGetGammaRampSize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), screen_idx, &screen_priv->info->size);
+
+ res = XF86VidModeGetGammaRampSize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+#if GTK_CHECK_VERSION(3, 10, 0)
+ gdk_screen_get_number (gdk_screen_get_default ()),
+#else
+ screen_idx,
+#endif
+ &screen_priv->info->size);
if (!res || screen_priv->info->size <= 0)
{
screen_priv->fade_type = FADE_TYPE_GAMMA_NUMBER;
@@ -331,7 +357,11 @@ gamma_fade_setup (GSFade *fade, int screen_idx)
}
res = XF86VidModeGetGammaRamp (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+#if GTK_CHECK_VERSION(3, 10, 0)
+ gdk_screen_get_number (gdk_screen_get_default ()),
+#else
screen_idx,
+#endif
screen_priv->info->size,
screen_priv->info->r,
screen_priv->info->g,
@@ -350,14 +380,19 @@ test_number:
{
/* only have gamma parameter, not ramps. */
- res = XF86VidModeGetGamma (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), screen_idx, &screen_priv->vmg);
+ res = XF86VidModeGetGamma (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+#if GTK_CHECK_VERSION(3, 10, 0)
+ gdk_screen_get_number (gdk_screen_get_default ()),
+#else
+ screen_idx,
+#endif
+ &screen_priv->vmg);
if (! res)
{
screen_priv->fade_type = FADE_TYPE_NONE;
goto test_none;
}
- gs_debug ("Initialized gamma fade for screen %d: %f %f %f",
- screen_idx,
+ gs_debug ("Initialized gamma fade: %f %f %f",
screen_priv->vmg.red,
screen_priv->vmg.green,
screen_priv->vmg.blue);
@@ -377,11 +412,19 @@ FAIL:
#endif /* HAVE_XF86VMODE_GAMMA */
static void
+#if GTK_CHECK_VERSION(3, 10, 0)
+screen_fade_finish (GSFade *fade)
+#else
screen_fade_finish (GSFade *fade, int screen_idx)
+#endif
{
struct GSFadeScreenPrivate *screen_priv;
int i;
+#if GTK_CHECK_VERSION(3, 10, 0)
+ screen_priv = &fade->priv->screen_priv;
+#else
screen_priv = &fade->priv->screen_priv[screen_idx];
+#endif
if (!screen_priv->info)
return;
@@ -404,20 +447,33 @@ screen_fade_finish (GSFade *fade, int screen_idx)
#ifdef HAVE_XF86VMODE_GAMMA
static gboolean
gamma_fade_set_alpha_gamma (GSFade *fade,
+#if !GTK_CHECK_VERSION(3, 10, 0)
int screen_idx,
+#endif
gdouble alpha)
{
struct GSFadeScreenPrivate *screen_priv;
+#if GTK_CHECK_VERSION(3, 10, 0)
+ int screen_idx = gdk_screen_get_number (gdk_screen_get_default ());
+
+ screen_priv = &fade->priv->screen_priv;
+ xf86_whack_gamma (screen_idx, screen_priv, alpha);
+#else
screen_priv = &fade->priv->screen_priv[screen_idx];
xf86_whack_gamma (screen_idx, screen_priv, alpha);
+#endif
return TRUE;
}
#endif /* HAVE_XF86VMODE_GAMMA */
static void
+#if GTK_CHECK_VERSION(3, 10, 0)
+check_gamma_extension (GSFade *fade)
+#else
check_gamma_extension (GSFade *fade, int screen_idx)
+#endif
{
struct GSFadeScreenPrivate *screen_priv;
#ifdef HAVE_XF86VMODE_GAMMA
@@ -428,7 +484,11 @@ check_gamma_extension (GSFade *fade, int screen_idx)
gboolean res;
#endif /* HAVE_XF86VMODE_GAMMA */
+#if GTK_CHECK_VERSION(3, 10, 0)
+ screen_priv = &fade->priv->screen_priv;
+#else
screen_priv = &fade->priv->screen_priv[screen_idx];
+#endif
#ifdef HAVE_XF86VMODE_GAMMA
res = XF86VidModeQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &event, &error);
@@ -466,7 +526,11 @@ fade_none:
/* Xrandr support */
+#if GTK_CHECK_VERSION(3, 10, 0)
+static gboolean xrandr_fade_setup (GSFade *fade)
+#else
static gboolean xrandr_fade_setup (GSFade *fade, int screen_idx)
+#endif
{
struct GSFadeScreenPrivate *screen_priv;
MateRRCrtc *crtc;
@@ -475,7 +539,11 @@ static gboolean xrandr_fade_setup (GSFade *fade, int screen_idx)
struct GSGammaInfo *info;
gboolean res;
+#if GTK_CHECK_VERSION(3, 10, 0)
+ screen_priv = &fade->priv->screen_priv;
+#else
screen_priv = &fade->priv->screen_priv[screen_idx];
+#endif
if (screen_priv->info)
return TRUE;
@@ -564,7 +632,9 @@ static void xrandr_crtc_whack_gamma (MateRRCrtc *crtc,
}
static gboolean xrandr_fade_set_alpha_gamma (GSFade *fade,
+#if !GTK_CHECK_VERSION(3, 10, 0)
int screen_idx,
+#endif
gdouble alpha)
{
struct GSFadeScreenPrivate *screen_priv;
@@ -572,7 +642,11 @@ static gboolean xrandr_fade_set_alpha_gamma (GSFade *fade,
MateRRCrtc **crtcs;
int i;
+#if GTK_CHECK_VERSION(3, 10, 0)
+ screen_priv = &fade->priv->screen_priv;
+#else
screen_priv = &fade->priv->screen_priv[screen_idx];
+#endif
if (!screen_priv->info)
return FALSE;
@@ -591,13 +665,25 @@ static gboolean xrandr_fade_set_alpha_gamma (GSFade *fade,
}
static void
+#if GTK_CHECK_VERSION(3, 10, 0)
+check_randr_extension (GSFade *fade)
+#else
check_randr_extension (GSFade *fade, int screen_idx)
+#endif
{
GdkDisplay *display = gdk_display_get_default ();
+#if GTK_CHECK_VERSION(3, 10, 0)
+ GdkScreen *screen = gdk_display_get_default_screen (display);
+#else
GdkScreen *screen = gdk_display_get_screen (display, screen_idx);
+#endif
struct GSFadeScreenPrivate *screen_priv;
+#if GTK_CHECK_VERSION(3, 10, 0)
+ screen_priv = &fade->priv->screen_priv;
+#else
screen_priv = &fade->priv->screen_priv[screen_idx];
+#endif
screen_priv->rrscreen = mate_rr_screen_new (screen,
NULL);
@@ -618,6 +704,24 @@ gs_fade_set_alpha (GSFade *fade,
gdouble alpha)
{
gboolean ret = FALSE;
+#if GTK_CHECK_VERSION (3, 10, 0)
+
+ switch (fade->priv->screen_priv.fade_type)
+ {
+ case FADE_TYPE_GAMMA_RAMP:
+ case FADE_TYPE_GAMMA_NUMBER:
+ case FADE_TYPE_XRANDR:
+ ret = fade->priv->screen_priv.fade_set_alpha_gamma (fade, alpha);
+ break;
+ case FADE_TYPE_NONE:
+ ret = FALSE;
+ break;
+ default:
+ g_warning ("Unknown fade type");
+ ret = FALSE;
+ break;
+ }
+#else
int i;
for (i = 0; i < fade->priv->num_screens; i++)
@@ -638,6 +742,7 @@ gs_fade_set_alpha (GSFade *fade,
break;
}
}
+#endif
return ret;
}
@@ -730,12 +835,22 @@ gs_fade_start (GSFade *fade,
{
guint steps_per_sec = 60;
guint msecs_per_step;
+#if !GTK_CHECK_VERSION (3, 10, 0)
struct GSFadeScreenPrivate *screen_priv;
- gboolean active_fade, res;
int i;
+#endif
+ gboolean active_fade, res;
g_return_if_fail (GS_IS_FADE (fade));
+#if GTK_CHECK_VERSION (3, 10, 0)
+ if (fade->priv->screen_priv.fade_type != FADE_TYPE_NONE)
+ {
+ res = fade->priv->screen_priv.fade_setup (fade);
+ if (res == FALSE)
+ return;
+ }
+#else
for (i = 0; i < fade->priv->num_screens; i++)
{
screen_priv = &fade->priv->screen_priv[i];
@@ -746,6 +861,7 @@ gs_fade_start (GSFade *fade,
return;
}
}
+#endif
if (fade->priv->timer_id > 0)
{
@@ -757,12 +873,18 @@ gs_fade_start (GSFade *fade,
gs_fade_set_timeout (fade, timeout);
active_fade = FALSE;
+#if GTK_CHECK_VERSION (3, 10, 0)
+ if (fade->priv->screen_priv.fade_type != FADE_TYPE_NONE)
+ active_fade = TRUE;
+#else
for (i = 0; i < fade->priv->num_screens; i++)
{
screen_priv = &fade->priv->screen_priv[i];
if (screen_priv->fade_type != FADE_TYPE_NONE)
active_fade = TRUE;
}
+#endif
+
if (active_fade)
{
guint num_steps;
@@ -870,7 +992,9 @@ gs_fade_sync (GSFade *fade,
void
gs_fade_reset (GSFade *fade)
{
+#if !GTK_CHECK_VERSION(3, 10, 0)
int i;
+#endif
g_return_if_fail (GS_IS_FADE (fade));
gs_debug ("Resetting fade");
@@ -884,9 +1008,14 @@ gs_fade_reset (GSFade *fade)
gs_fade_set_alpha (fade, fade->priv->current_alpha);
+#if GTK_CHECK_VERSION (3, 10, 0)
+ if (fade->priv->screen_priv.fade_type != FADE_TYPE_NONE)
+ fade->priv->screen_priv.fade_finish (fade);
+#else
for (i = 0; i < fade->priv->num_screens; i++)
if (fade->priv->screen_priv[i].fade_type != FADE_TYPE_NONE)
fade->priv->screen_priv[i].fade_finish (fade, i);
+#endif
}
static void
@@ -913,16 +1042,22 @@ gs_fade_class_init (GSFadeClass *klass)
static void
gs_fade_init (GSFade *fade)
{
- GdkDisplay *display;
+#if !GTK_CHECK_VERSION (3, 10, 0)
int i;
+#endif
fade->priv = GS_FADE_GET_PRIVATE (fade);
fade->priv->timeout = 1000;
fade->priv->current_alpha = 1.0;
- display = gdk_display_get_default ();
- fade->priv->num_screens = gdk_display_get_n_screens (display);
+#if GTK_CHECK_VERSION (3, 10, 0)
+ check_randr_extension (fade);
+ if (!fade->priv->screen_priv.fade_type)
+ check_gamma_extension (fade);
+ gs_debug ("Fade type: %d", fade->priv->screen_priv.fade_type);
+#else
+ fade->priv->num_screens = gdk_display_get_n_screens (gdk_display_get_default ());
fade->priv->screen_priv = g_new0 (struct GSFadeScreenPrivate, fade->priv->num_screens);
@@ -933,13 +1068,16 @@ gs_fade_init (GSFade *fade)
check_gamma_extension (fade, i);
gs_debug ("Fade type: %d", fade->priv->screen_priv[i].fade_type);
}
+#endif
}
static void
gs_fade_finalize (GObject *object)
{
GSFade *fade;
+#if !GTK_CHECK_VERSION (3, 10, 0)
int i;
+#endif
g_return_if_fail (object != NULL);
g_return_if_fail (GS_IS_FADE (object));
@@ -948,6 +1086,13 @@ gs_fade_finalize (GObject *object)
g_return_if_fail (fade->priv != NULL);
+#if GTK_CHECK_VERSION (3, 10, 0)
+ fade->priv->screen_priv.fade_finish(fade);
+
+ if (fade->priv->screen_priv.rrscreen)
+ g_object_unref (fade->priv->screen_priv.rrscreen);
+ fade->priv->screen_priv.rrscreen = NULL;
+#else
for (i = 0; i < fade->priv->num_screens; i++)
fade->priv->screen_priv[i].fade_finish(fade, i);
@@ -963,6 +1108,7 @@ gs_fade_finalize (GObject *object)
g_free (fade->priv->screen_priv);
fade->priv->screen_priv = NULL;
}
+#endif
G_OBJECT_CLASS (gs_fade_parent_class)->finalize (object);
}
diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c
index 0a5d601..2133e6d 100644
--- a/src/gs-grab-x11.c
+++ b/src/gs-grab-x11.c
@@ -73,6 +73,10 @@ grab_string (int status)
return "GrabNotViewable";
case GDK_GRAB_FROZEN:
return "GrabFrozen";
+#if GTK_CHECK_VERSION (3, 0, 0)
+ case GDK_GRAB_FAILED:
+ return "GrabFailed";
+#endif
default:
{
static char foo [255];
@@ -241,7 +245,7 @@ gs_grab_get_mouse (GSGrab *grab,
}
#if GTK_CHECK_VERSION (3, 0, 0)
- g_object_unref (cursor);
+ g_object_unref (G_OBJECT (cursor));
#else
gdk_cursor_unref (cursor);
#endif
@@ -302,14 +306,15 @@ gs_grab_move_mouse (GSGrab *grab,
GdkScreen *screen,
gboolean hide_cursor)
{
- gboolean result;
- GdkWindow *old_window;
- GdkScreen *old_screen;
+ gboolean result;
+ GdkWindow *old_window;
+ GdkScreen *old_screen;
gboolean old_hide_cursor;
+
/* if the pointer is not grabbed and we have a
mouse_grab_window defined then we lost the grab */
- if (! gdk_pointer_is_grabbed ())
+ if (!gdk_pointer_is_grabbed ())
{
gs_grab_mouse_reset (grab);
}
@@ -323,7 +328,7 @@ gs_grab_move_mouse (GSGrab *grab,
#if 0
gs_debug ("Intentionally skipping move pointer grabs");
- /* FIXME: GTK doesn't like having the pointer grabbed */
+ /* FIXME: GTK+ doesn't like having the pointer grabbed */
return TRUE;
#else
if (grab->priv->mouse_grab_window)
@@ -377,9 +382,9 @@ gs_grab_move_keyboard (GSGrab *grab,
GdkWindow *window,
GdkScreen *screen)
{
- gboolean result;
- GdkWindow *old_window;
- GdkScreen *old_screen;
+ gboolean result;
+ GdkWindow *old_window;
+ GdkScreen *old_screen;
if (grab->priv->keyboard_grab_window == window)
{
@@ -475,11 +480,11 @@ gs_grab_grab_window (GSGrab *grab,
GdkScreen *screen,
gboolean hide_cursor)
{
- gboolean mstatus = FALSE;
- gboolean kstatus = FALSE;
- int i;
- int retries = 4;
- gboolean focus_fuckus = FALSE;
+ gboolean mstatus = FALSE;
+ gboolean kstatus = FALSE;
+ int i;
+ int retries = 4;
+ gboolean focus_fuckus = FALSE;
AGAIN:
@@ -524,7 +529,7 @@ AGAIN:
}
#if 0
- /* FIXME: release the pointer grab so GTK will work */
+ /* FIXME: release the pointer grab so GTK+ will work */
gs_grab_release_mouse (grab);
#endif
@@ -568,12 +573,24 @@ gs_grab_grab_root (GSGrab *grab,
GdkDisplay *display;
GdkWindow *root;
GdkScreen *screen;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkDevice *device;
+#endif
gboolean res;
gs_debug ("Grabbing the root window");
display = gdk_display_get_default ();
+#if GTK_CHECK_VERSION (3, 0, 0)
+#if GTK_CHECK_VERSION(3, 20, 0)
+ device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
+#else
+ device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
+#endif
+ gdk_device_get_position (device, &screen, NULL, NULL);
+#else
gdk_display_get_pointer (display, &screen, NULL, NULL, NULL);
+#endif
root = gdk_screen_get_root_window (screen);
res = gs_grab_grab_window (grab, root, screen, hide_cursor);
diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c
index 53b091f..2893714 100644
--- a/src/gs-lock-plug.c
+++ b/src/gs-lock-plug.c
@@ -87,6 +87,10 @@ static void gs_lock_plug_finalize (GObject *object);
#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
#endif
+#if !GTK_CHECK_VERSION (3, 20, 0)
+#define gtk_widget_set_focus_on_click(a, b) gtk_button_set_focus_on_click(GTK_BUTTON(a), b)
+#endif
+
struct GSLockPlugPrivate
{
GtkWidget *vbox;
@@ -1708,7 +1712,7 @@ gs_lock_plug_add_button (GSLockPlug *plug,
g_return_val_if_fail (GS_IS_LOCK_PLUG (plug), NULL);
g_return_val_if_fail (button_text != NULL, NULL);
- button = gtk_button_new_from_stock (button_text);
+ button = gtk_button_new_with_label (button_text);
gtk_widget_set_can_default (button, TRUE);
@@ -1773,24 +1777,24 @@ create_page_one_buttons (GSLockPlug *plug)
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (plug->priv->auth_action_area),
plug->priv->auth_switch_button,
TRUE);
- gtk_button_set_focus_on_click (GTK_BUTTON (plug->priv->auth_switch_button), FALSE);
+ gtk_widget_set_focus_on_click (GTK_WIDGET (plug->priv->auth_switch_button), FALSE);
gtk_widget_set_no_show_all (plug->priv->auth_switch_button, TRUE);
plug->priv->auth_logout_button = gs_lock_plug_add_button (GS_LOCK_PLUG (plug),
plug->priv->auth_action_area,
_("Log _Out"));
- gtk_button_set_focus_on_click (GTK_BUTTON (plug->priv->auth_logout_button), FALSE);
+ gtk_widget_set_focus_on_click (GTK_WIDGET (plug->priv->auth_logout_button), FALSE);
gtk_widget_set_no_show_all (plug->priv->auth_logout_button, TRUE);
plug->priv->auth_cancel_button = gs_lock_plug_add_button (GS_LOCK_PLUG (plug),
plug->priv->auth_action_area,
GTK_STOCK_CANCEL);
- gtk_button_set_focus_on_click (GTK_BUTTON (plug->priv->auth_cancel_button), FALSE);
+ gtk_widget_set_focus_on_click (GTK_WIDGET (plug->priv->auth_cancel_button), FALSE);
plug->priv->auth_unlock_button = gs_lock_plug_add_button (GS_LOCK_PLUG (plug),
plug->priv->auth_action_area,
_("_Unlock"));
- gtk_button_set_focus_on_click (GTK_BUTTON (plug->priv->auth_unlock_button), FALSE);
+ gtk_widget_set_focus_on_click (GTK_WIDGET (plug->priv->auth_unlock_button), FALSE);
gtk_window_set_default (GTK_WINDOW (plug), plug->priv->auth_unlock_button);
@@ -1940,19 +1944,31 @@ expand_string_for_label (GtkWidget *label)
static void
create_page_one (GSLockPlug *plug)
{
- GtkWidget *align;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *hbox;
+#if !GTK_CHECK_VERSION(3, 0, 0)
+ GtkWidget *align;
+#endif
char *str;
gs_profile_start ("page one");
+#if GTK_CHECK_VERSION(3, 0, 0)
+ vbox = gtk_vbox_new (FALSE, 12);
+ gtk_widget_set_halign (GTK_WIDGET (vbox),
+ GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (GTK_WIDGET (vbox),
+ GTK_ALIGN_CENTER);
+
+ gtk_notebook_append_page (GTK_NOTEBOOK (plug->priv->notebook), vbox, NULL);
+#else
align = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_notebook_append_page (GTK_NOTEBOOK (plug->priv->notebook), align, NULL);
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_add (GTK_CONTAINER (align), vbox);
+#endif
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
@@ -1962,7 +1978,7 @@ create_page_one (GSLockPlug *plug)
g_free (str);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_time_label), 0.5);
- gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_time_label), 0.5);
+ gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_time_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_time_label), 0.5, 0.5);
#endif
@@ -1974,7 +1990,7 @@ create_page_one (GSLockPlug *plug)
g_free (str);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_date_label), 0.5);
- gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_date_label), 0.5);
+ gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_date_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_date_label), 0.5, 0.5);
#endif
@@ -1999,7 +2015,7 @@ create_page_one (GSLockPlug *plug)
expand_string_for_label (plug->priv->auth_realname_label);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_realname_label), 0.5);
- gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_realname_label), 0.5);
+ gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_realname_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_realname_label), 0.5, 0.5);
#endif
@@ -2013,7 +2029,7 @@ create_page_one (GSLockPlug *plug)
expand_string_for_label (plug->priv->auth_username_label);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_realname_label), 0.5);
- gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_realname_label), 0.5);
+ gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_realname_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_username_label), 0.5, 0.5);
#endif
@@ -2029,6 +2045,7 @@ create_page_one (GSLockPlug *plug)
plug->priv->auth_prompt_label = gtk_label_new_with_mnemonic (_("_Password:"));
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_prompt_label), 0.0);
+ gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_prompt_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_prompt_label), 0.0, 0.5);
#endif
@@ -2043,7 +2060,7 @@ create_page_one (GSLockPlug *plug)
plug->priv->auth_capslock_label = gtk_label_new ("");
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_capslock_label), 0.5);
- gtk_label_set_xalign (GTK_LABEL (plug->priv->auth_capslock_label), 0.5);
+ gtk_label_set_yalign (GTK_LABEL (plug->priv->auth_capslock_label), 0.5);
#else
gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_capslock_label), 0.5, 0.5);
#endif
@@ -2123,7 +2140,7 @@ load_theme (GSLockPlug *plug)
char *theme;
char *filename;
char *gtkbuilder;
- char *rc;
+ char *css;
GtkBuilder *builder;
GtkWidget *lock_dialog;
GError *error=NULL;
@@ -2144,17 +2161,30 @@ load_theme (GSLockPlug *plug)
return FALSE;
}
- filename = g_strdup_printf ("lock-dialog-%s.gtkrc", theme);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ filename = g_strdup_printf ("lock-dialog-%s.css", theme);
g_free (theme);
- rc = g_build_filename (GTKBUILDERDIR, filename, NULL);
+ css = g_build_filename (GTKBUILDERDIR, filename, NULL);
g_free (filename);
- if (g_file_test (rc, G_FILE_TEST_IS_REGULAR))
+ if (g_file_test (css, G_FILE_TEST_IS_REGULAR))
{
- gtk_rc_parse (rc);
+ GtkCssProvider *style_provider = gtk_css_provider_get_default ();
+ gtk_css_provider_load_from_path (style_provider, css, NULL);
}
- g_free (rc);
+ g_free (css);
+#else
+ filename = g_strdup_printf ("lock-dialog-%s.gtkrc", theme);
+ g_free (theme);
+ css = g_build_filename (GTKBUILDERDIR, filename, NULL);
+ g_free (filename);
+ if (g_file_test (css, G_FILE_TEST_IS_REGULAR))
+ {
+ gtk_rc_parse (css);
+ }
+ g_free (css);
+#endif
builder = gtk_builder_new();
if (!gtk_builder_add_from_file (builder,gtkbuilder,&error))
diff --git a/src/gs-manager.c b/src/gs-manager.c
index a77ebd7..c5ce240 100644
--- a/src/gs-manager.c
+++ b/src/gs-manager.c
@@ -1103,6 +1103,9 @@ find_window_at_pointer (GSManager *manager)
{
GdkDisplay *display;
GdkScreen *screen;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkDevice *device;
+#endif
int monitor;
int x, y;
GSWindow *window;
@@ -1110,7 +1113,17 @@ find_window_at_pointer (GSManager *manager)
GSList *l;
display = gdk_display_get_default ();
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+#if GTK_CHECK_VERSION(3, 20, 0)
+ device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
+#else
+ device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
+#endif
+ gdk_device_get_position (device, &screen, &x, &y);
+#else
gdk_display_get_pointer (display, &screen, &x, &y, NULL);
+#endif
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
screen_num = gdk_screen_get_number (screen);
@@ -1163,12 +1176,24 @@ manager_maybe_grab_window (GSManager *manager,
{
GdkDisplay *display;
GdkScreen *screen;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkDevice *device;
+#endif
int monitor;
int x, y;
gboolean grabbed;
display = gdk_display_get_default ();
+#if GTK_CHECK_VERSION (3, 0, 0)
+#if GTK_CHECK_VERSION(3, 20, 0)
+ device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
+#else
+ device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
+#endif
+ gdk_device_get_position (device, &screen, &x, &y);
+#else
gdk_display_get_pointer (display, &screen, &x, &y, NULL);
+#endif
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
gdk_flush ();
@@ -1641,8 +1666,10 @@ gs_manager_destroy_windows (GSManager *manager)
{
GdkDisplay *display;
GSList *l;
+#if !GTK_CHECK_VERSION (3, 10, 0)
int n_screens;
int i;
+#endif
g_return_if_fail (manager != NULL);
g_return_if_fail (GS_IS_MANAGER (manager));
@@ -1654,6 +1681,11 @@ gs_manager_destroy_windows (GSManager *manager)
display = gdk_display_get_default ();
+#if GTK_CHECK_VERSION (3, 10, 0)
+ g_signal_handlers_disconnect_by_func (gdk_display_get_default_screen (display),
+ on_screen_monitors_changed,
+ manager);
+#else
n_screens = gdk_display_get_n_screens (display);
for (i = 0; i < n_screens; i++)
@@ -1662,6 +1694,7 @@ gs_manager_destroy_windows (GSManager *manager)
on_screen_monitors_changed,
manager);
}
+#endif
for (l = manager->priv->windows; l; l = l->next)
{
@@ -1744,8 +1777,10 @@ static void
gs_manager_create_windows (GSManager *manager)
{
GdkDisplay *display;
+#if !GTK_CHECK_VERSION (3, 10, 0)
int n_screens;
int i;
+#endif
g_return_if_fail (manager != NULL);
g_return_if_fail (GS_IS_MANAGER (manager));
@@ -1753,6 +1788,15 @@ gs_manager_create_windows (GSManager *manager)
g_assert (manager->priv->windows == NULL);
display = gdk_display_get_default ();
+#if GTK_CHECK_VERSION (3, 10, 0)
+ g_signal_connect (gdk_display_get_default_screen (display),
+ "monitors-changed",
+ G_CALLBACK (on_screen_monitors_changed),
+ manager);
+
+ gs_manager_create_windows_for_screen (manager,
+ gdk_display_get_default_screen (display));
+#else
n_screens = gdk_display_get_n_screens (display);
for (i = 0; i < n_screens; i++)
@@ -1762,8 +1806,10 @@ gs_manager_create_windows (GSManager *manager)
G_CALLBACK (on_screen_monitors_changed),
manager);
- gs_manager_create_windows_for_screen (manager, gdk_display_get_screen (display, i));
+ gs_manager_create_windows_for_screen (manager,
+ gdk_display_get_screen (display, i));
}
+#endif
}
GSManager *
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index 8199786..e49cbd4 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -1107,7 +1107,7 @@ gs_window_real_show (GtkWidget *widget)
static void
set_info_text_and_icon (GSWindow *window,
- const char *icon_stock_id,
+ const char *icon_name,
const char *primary_text,
const char *secondary_text)
{
@@ -1123,7 +1123,7 @@ set_info_text_and_icon (GSWindow *window,
hbox_content = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox_content);
- image = gtk_image_new_from_stock (icon_stock_id, GTK_ICON_SIZE_DIALOG);
+ image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG);
gtk_widget_show (image);
gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION (3, 0, 0)
@@ -1700,7 +1700,15 @@ create_lock_socket (GSWindow *window,
guint32 id)
{
window->priv->lock_socket = gtk_socket_new ();
+#if GTK_CHECK_VERSION(3, 12, 0)
+ window->priv->lock_box = gtk_grid_new ();
+ gtk_widget_set_halign (GTK_WIDGET (window->priv->lock_box),
+ GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (GTK_WIDGET (window->priv->lock_box),
+ GTK_ALIGN_CENTER);
+#else
window->priv->lock_box = gtk_alignment_new (0.5, 0.5, 0, 0);
+#endif
gtk_widget_show (window->priv->lock_box);
gtk_box_pack_start (GTK_BOX (window->priv->vbox), window->priv->lock_box, TRUE, TRUE, 0);
@@ -1764,8 +1772,7 @@ static void
shake_dialog (GSWindow *window)
{
int i;
- guint left;
- guint right;
+ guint start, end;
window->priv->dialog_shake_in_progress = TRUE;
@@ -1773,13 +1780,13 @@ shake_dialog (GSWindow *window)
{
if (i % 2 == 0)
{
- left = 30;
- right = 0;
+ start = 30;
+ end = 0;
}
else
{
- left = 0;
- right = 30;
+ start = 0;
+ end = 30;
}
if (! window->priv->lock_box)
@@ -1787,10 +1794,16 @@ shake_dialog (GSWindow *window)
break;
}
+#if GTK_CHECK_VERSION(3, 12, 0)
+ gtk_widget_set_margin_start (GTK_WIDGET (window->priv->lock_box),
+ start);
+ gtk_widget_set_margin_end (GTK_WIDGET (window->priv->lock_box),
+ end);
+#else
gtk_alignment_set_padding (GTK_ALIGNMENT (window->priv->lock_box),
0, 0,
- left,
- right);
+ start, end);
+#endif
while (gtk_events_pending ())
{
diff --git a/src/mate-screensaver-preferences.c b/src/mate-screensaver-preferences.c
index fb0d311..5dd0757 100644
--- a/src/mate-screensaver-preferences.c
+++ b/src/mate-screensaver-preferences.c
@@ -301,12 +301,15 @@ config_set_lock (gboolean lock)
static void
preview_clear (GtkWidget *widget)
{
- GdkColor color = { 0, 0, 0 };
-
- gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &color);
#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
+
+ gdk_window_set_background_rgba (gtk_widget_get_window (widget), &black);
gtk_widget_queue_draw (widget);
#else
+ GdkColor black = { 0, 0x0000, 0x0000, 0x0000 };
+
+ gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &black);
gdk_window_clear (gtk_widget_get_window (widget));
#endif
}
@@ -1203,7 +1206,7 @@ fullscreen_preview_start_cb (GtkWidget *widget,
static void
constrain_list_size (GtkWidget *widget,
- GtkRequisition *requisition,
+ GtkAllocation *allocation,
GtkWidget *to_size)
{
GtkRequisition req;
@@ -1218,14 +1221,14 @@ constrain_list_size (GtkWidget *widget,
gtk_widget_size_request (to_size, &req);
#endif
- requisition->height = MIN (req.height, max_height);
+ allocation->height = MIN (req.height, max_height);
}
static void
setup_list_size_constraint (GtkWidget *widget,
GtkWidget *to_size)
{
- g_signal_connect (widget, "size-request",
+ g_signal_connect (widget, "size-allocate",
G_CALLBACK (constrain_list_size), to_size);
}