diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/copy-theme-dialog.c | 4 | ||||
-rw-r--r-- | src/gs-fade.c | 162 | ||||
-rw-r--r-- | src/gs-grab-x11.c | 47 | ||||
-rw-r--r-- | src/gs-lock-plug.c | 64 | ||||
-rw-r--r-- | src/gs-manager.c | 48 | ||||
-rw-r--r-- | src/gs-window-x11.c | 33 | ||||
-rw-r--r-- | src/mate-screensaver-preferences.c | 15 |
7 files changed, 316 insertions, 57 deletions
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); } |