[gdm/gnome3: 2/10] Port to GTK3



commit dd090af72d1ced77db9ea00af2213feaa3db7eb4
Author: William Jon McCann <jmccann redhat com>
Date:   Wed Jan 12 15:35:16 2011 -0500

    Port to GTK3
    
    https://bugzilla.gnome.org/show_bug.cgi?id=639284

 configure.ac                                     |   12 +-
 gui/simple-chooser/chooser-main.c                |    2 +-
 gui/simple-chooser/gdm-host-chooser-dialog.c     |    1 -
 gui/simple-chooser/gdm-host-chooser.c            |    2 +-
 gui/simple-greeter/gdm-cell-renderer-timer.c     |   35 ++---
 gui/simple-greeter/gdm-clock-widget.c            |   34 ++++-
 gui/simple-greeter/gdm-greeter-login-window.c    |   98 +++++++++---
 gui/simple-greeter/gdm-greeter-panel.c           |  134 +++++++++++------
 gui/simple-greeter/gdm-greeter-session.c         |   10 +-
 gui/simple-greeter/gdm-language-chooser-dialog.c |   85 ++++++++--
 gui/simple-greeter/gdm-layout-chooser-dialog.c   |   83 ++++++++--
 gui/simple-greeter/gdm-layouts.c                 |    2 +-
 gui/simple-greeter/gdm-scrollable-widget.c       |  180 +++++++++++++---------
 gui/simple-greeter/libnotificationarea/na-tray.c |    1 -
 utils/gdm-screenshot.c                           |   26 ++--
 utils/gdmflexiserver.c                           |    4 +-
 16 files changed, 471 insertions(+), 238 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3a12767..1cb2d0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,7 @@ dnl ---------------------------------------------------------------------------
 
 DBUS_GLIB_REQUIRED_VERSION=0.74
 GLIB_REQUIRED_VERSION=2.27.4
-GTK_REQUIRED_VERSION=2.20.0
+GTK_REQUIRED_VERSION=2.91.1
 PANGO_REQUIRED_VERSION=1.3.0
 SCROLLKEEPER_REQUIRED_VERSION=0.1.4
 GCONF_REQUIRED_VERSION=2.31.3
@@ -86,13 +86,13 @@ AC_SUBST(XLIB_CFLAGS)
 AC_SUBST(XLIB_LIBS)
 
 PKG_CHECK_MODULES(GTK,
-        gtk+-2.0 >= $GTK_REQUIRED_VERSION
+        gtk+-3.0 >= $GTK_REQUIRED_VERSION
 )
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 
 PKG_CHECK_MODULES(CANBERRA_GTK,
-        libcanberra-gtk >= $LIBCANBERRA_GTK_REQUIRED_VERSION
+        libcanberra-gtk3 >= $LIBCANBERRA_GTK_REQUIRED_VERSION
 )
 AC_SUBST(GCONF_CFLAGS)
 AC_SUBST(GCONF_LIBS)
@@ -120,7 +120,7 @@ AC_SUBST(UPOWER_LIBS)
 
 PKG_CHECK_MODULES(SIMPLE_GREETER,
         dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
-        gtk+-2.0 >= $GTK_REQUIRED_VERSION
+        gtk+-3.0 >= $GTK_REQUIRED_VERSION
         gconf-2.0 >= $GCONF_REQUIRED_VERSION
 	fontconfig >= $FONTCONFIG_REQUIRED_VERSION
 	x11
@@ -143,7 +143,7 @@ AC_SUBST(LIBXKLAVIER_LIBS)
 
 PKG_CHECK_MODULES(SIMPLE_CHOOSER,
         dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
-        gtk+-2.0 >= $GTK_REQUIRED_VERSION
+        gtk+-3.0 >= $GTK_REQUIRED_VERSION
         gconf-2.0 >= $GCONF_REQUIRED_VERSION
 )
 AC_SUBST(SIMPLE_CHOOSER_CFLAGS)
@@ -151,7 +151,7 @@ AC_SUBST(SIMPLE_CHOOSER_LIBS)
 
 PKG_CHECK_MODULES(APPLET,
         dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
-        gtk+-2.0 >= $GTK_REQUIRED_VERSION
+        gtk+-3.0 >= $GTK_REQUIRED_VERSION
         libpanelapplet-2.0 >= $GNOME_PANEL_REQUIRED_VERSION)
 AC_SUBST(APPLET_CFLAGS)
 AC_SUBST(APPLET_LIBS)
diff --git a/gui/simple-chooser/chooser-main.c b/gui/simple-chooser/chooser-main.c
index 17d7765..ac1edd6 100644
--- a/gui/simple-chooser/chooser-main.c
+++ b/gui/simple-chooser/chooser-main.c
@@ -125,7 +125,7 @@ assistive_registry_start (void)
         root = gdk_get_default_root_window ();
 
         if ( ! AT_SPI_IOR) {
-                AT_SPI_IOR = XInternAtom (GDK_DISPLAY (), "AT_SPI_IOR", False);
+                AT_SPI_IOR = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "AT_SPI_IOR", False);
         }
 
         gdk_window_set_events (root,  GDK_PROPERTY_CHANGE_MASK);
diff --git a/gui/simple-chooser/gdm-host-chooser-dialog.c b/gui/simple-chooser/gdm-host-chooser-dialog.c
index 7680fb5..a38498f 100644
--- a/gui/simple-chooser/gdm-host-chooser-dialog.c
+++ b/gui/simple-chooser/gdm-host-chooser-dialog.c
@@ -144,7 +144,6 @@ gdm_host_chooser_dialog_constructor (GType                  type,
 
         gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
         gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
-        gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
         gtk_window_set_title (GTK_WINDOW (dialog), _("Select System"));
         gtk_window_set_icon_name (GTK_WINDOW (dialog), "computer");
 
diff --git a/gui/simple-chooser/gdm-host-chooser.c b/gui/simple-chooser/gdm-host-chooser.c
index f9cda61..371ba28 100644
--- a/gui/simple-chooser/gdm-host-chooser.c
+++ b/gui/simple-chooser/gdm-host-chooser.c
@@ -126,7 +126,7 @@ assistive_registry_start (void)
         root = gdk_get_default_root_window ();
 
         if ( ! AT_SPI_IOR) {
-                AT_SPI_IOR = XInternAtom (GDK_DISPLAY (), "AT_SPI_IOR", False);
+                AT_SPI_IOR = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "AT_SPI_IOR", False);
         }
 
         gdk_window_set_events (root,  GDK_PROPERTY_CHANGE_MASK);
diff --git a/gui/simple-greeter/gdm-cell-renderer-timer.c b/gui/simple-greeter/gdm-cell-renderer-timer.c
index bbe0233..2c77cac 100644
--- a/gui/simple-greeter/gdm-cell-renderer-timer.c
+++ b/gui/simple-greeter/gdm-cell-renderer-timer.c
@@ -84,13 +84,13 @@ gdm_cell_renderer_timer_set_property (GObject *object,
 }
 
 static void
-gdm_cell_renderer_timer_get_size (GtkCellRenderer *cell,
-                                  GtkWidget       *widget,
-                                  GdkRectangle    *cell_area,
-                                  gint            *x_offset,
-                                  gint            *y_offset,
-                                  gint            *width,
-                                  gint            *height)
+gdm_cell_renderer_timer_get_size (GtkCellRenderer    *cell,
+                                  GtkWidget          *widget,
+                                  const GdkRectangle *cell_area,
+                                  gint               *x_offset,
+                                  gint               *y_offset,
+                                  gint               *width,
+                                  gint               *height)
 {
 
         GdmCellRendererTimer *renderer;
@@ -180,16 +180,15 @@ draw_timer (GdmCellRendererTimer *renderer,
 
 static void
 gdm_cell_renderer_timer_render (GtkCellRenderer      *cell,
-                                GdkWindow            *window,
+                                cairo_t              *context,
                                 GtkWidget            *widget,
-                                GdkRectangle         *background_area,
-                                GdkRectangle         *cell_area,
-                                GdkRectangle         *expose_area,
+                                const GdkRectangle   *background_area,
+                                const GdkRectangle   *cell_area,
                                 GtkCellRendererState  renderer_state)
 {
         GdmCellRendererTimer *renderer;
-        cairo_t              *context;
         GtkStateType          widget_state;
+        gfloat                xpad, ypad;
 
         renderer = GDM_CELL_RENDERER_TIMER (cell);
 
@@ -197,15 +196,7 @@ gdm_cell_renderer_timer_render (GtkCellRenderer      *cell,
                 return;
         }
 
-        context = gdk_cairo_create (GDK_DRAWABLE (window));
-
-        if (expose_area != NULL) {
-                gdk_cairo_rectangle (context, expose_area);
-                cairo_clip (context);
-        }
-
-	gfloat xpad, ypad;
-	gtk_cell_renderer_get_alignment (cell, &xpad, &ypad);
+        gtk_cell_renderer_get_alignment (cell, &xpad, &ypad);
 
         cairo_translate (context,
                          cell_area->x + xpad,
@@ -228,8 +219,6 @@ gdm_cell_renderer_timer_render (GtkCellRenderer      *cell,
                     &gtk_widget_get_style (widget)->text_aa[widget_state],
                     &gtk_widget_get_style (widget)->base[widget_state],
                     cell_area->width, cell_area->height);
-
-        cairo_destroy (context);
 }
 
 static void
diff --git a/gui/simple-greeter/gdm-clock-widget.c b/gui/simple-greeter/gdm-clock-widget.c
index 7b09c12..68c6da0 100644
--- a/gui/simple-greeter/gdm-clock-widget.c
+++ b/gui/simple-greeter/gdm-clock-widget.c
@@ -196,18 +196,31 @@ remove_timeout (GdmClockWidget *clock)
 }
 
 static void
-gdm_clock_widget_size_request (GtkWidget      *widget,
-                               GtkRequisition *requisition)
+gdm_clock_widget_get_preferred_width (GtkWidget *widget,
+                                      gint      *minimum_size,
+                                      gint      *natural_size)
+{
+        if (GTK_WIDGET_CLASS (gdm_clock_widget_parent_class)->get_preferred_width) {
+                GTK_WIDGET_CLASS (gdm_clock_widget_parent_class)->get_preferred_width (widget, minimum_size, natural_size);
+        }
+
+}
+
+static void
+gdm_clock_widget_get_preferred_height (GtkWidget *widget,
+                                       gint      *minimum_size,
+                                       gint      *natural_size)
 {
         PangoFontMetrics *metrics;
         PangoContext     *context;
         int               ascent;
         int               descent;
         int               padding;
+        int               min_size;
+        int               nat_size;
 
-        if (GTK_WIDGET_CLASS (gdm_clock_widget_parent_class)->size_request) {
-                GTK_WIDGET_CLASS (gdm_clock_widget_parent_class)->size_request (widget, requisition);
-        }
+        min_size = 0;
+        nat_size = 0;
 
         gtk_widget_ensure_style (widget);
         context = gtk_widget_get_pango_context (widget);
@@ -218,7 +231,13 @@ gdm_clock_widget_size_request (GtkWidget      *widget,
         ascent = pango_font_metrics_get_ascent (metrics);
         descent = pango_font_metrics_get_descent (metrics);
         padding = PANGO_PIXELS (ascent + descent) / 2.0;
-        requisition->height += padding;
+        min_size += padding;
+        nat_size += padding;
+
+        if (minimum_size)
+                *minimum_size = min_size;
+        if (natural_size)
+                *natural_size = nat_size;
 
         pango_font_metrics_unref (metrics);
 }
@@ -233,7 +252,8 @@ gdm_clock_widget_class_init (GdmClockWidgetClass *klass)
         widget_class = GTK_WIDGET_CLASS (klass);
 
         object_class->finalize = gdm_clock_widget_finalize;
-        widget_class->size_request = gdm_clock_widget_size_request;
+        widget_class->get_preferred_width = gdm_clock_widget_get_preferred_width;
+        widget_class->get_preferred_height = gdm_clock_widget_get_preferred_height;
 
         g_type_class_add_private (klass, sizeof (GdmClockWidgetPrivate));
 }
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index 6069e00..3db63dd 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -624,7 +624,6 @@ reset_dialog (GdmGreeterLoginWindow *login_window,
 {
         GtkWidget  *entry;
         GtkWidget  *label;
-        guint       mode;
 
         g_debug ("GdmGreeterLoginWindow: Resetting dialog to mode %u", dialog_mode);
         set_busy (login_window);
@@ -1031,7 +1030,6 @@ on_user_chosen (GdmUserChooserWidget  *user_chooser,
                 GdmGreeterLoginWindow *login_window)
 {
         char *user_name;
-        guint mode;
 
         user_name = gdm_user_chooser_widget_get_chosen_user_name (GDM_USER_CHOOSER_WIDGET (login_window->priv->user_chooser));
         g_debug ("GdmGreeterLoginWindow: user chosen '%s'", user_name);
@@ -1330,7 +1328,7 @@ gdm_greeter_login_window_key_press_event (GtkWidget   *widget,
 
         login_window = GDM_GREETER_LOGIN_WINDOW (widget);
 
-        if (event->keyval == GDK_Escape) {
+        if (event->keyval == GDK_KEY_Escape) {
                 if (login_window->priv->dialog_mode == MODE_AUTHENTICATION
                     || login_window->priv->dialog_mode == MODE_TIMED_LOGIN) {
                         do_cancel (GDM_GREETER_LOGIN_WINDOW (widget));
@@ -1341,45 +1339,92 @@ gdm_greeter_login_window_key_press_event (GtkWidget   *widget,
 }
 
 static void
-gdm_greeter_login_window_size_request (GtkWidget      *widget,
-                                       GtkRequisition *requisition)
+gdm_greeter_login_window_get_preferred_width (GtkWidget *widget,
+                                              gint      *minimum_size,
+                                              gint      *natural_size)
 {
         int             monitor;
         GdkScreen      *screen;
-        GtkRequisition  child_requisition;
         GdkRectangle    area;
+        GtkAllocation   widget_allocation;
+        int             min_size;
+        int             nat_size;
+        guint           border_width;
 
-        if (GTK_WIDGET_CLASS (gdm_greeter_login_window_parent_class)->size_request) {
-                GTK_WIDGET_CLASS (gdm_greeter_login_window_parent_class)->size_request (widget, requisition);
-        }
+        min_size = 0;
+        nat_size = 0;
 
         if (!gtk_widget_get_realized (widget)) {
-                return;
+                goto out;
         }
 
+        gtk_widget_get_preferred_width (gtk_bin_get_child (GTK_BIN (widget)),
+                                        &min_size,
+                                        &nat_size);
+
+        border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+        min_size += 2 * border_width;
+        nat_size += 2 * border_width;
+
+        /* Make width be at least 33% screen width */
         screen = gtk_widget_get_screen (widget);
         monitor = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
         gdk_screen_get_monitor_geometry (screen, monitor, &area);
+        min_size = MAX (min_size, .33 * area.width);
+        nat_size = MAX (nat_size, .33 * area.width);
 
-        gtk_widget_get_child_requisition (gtk_bin_get_child (GTK_BIN (widget)), &child_requisition);
-        *requisition = child_requisition;
+       /* Don't ever shrink window width */
+        gtk_widget_get_allocation (widget, &widget_allocation);
 
-        guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-        requisition->width += 2 * border_width;
-        requisition->height += 2 * border_width;
+        min_size = MAX (min_size, widget_allocation.width);
+        nat_size = MAX (nat_size, widget_allocation.width);
 
-        /* Make width be at least 33% screen width
-         * and height be at most 80% of screen height
-         */
-        requisition->width = MAX (requisition->width, .33 * area.width);
-        requisition->height = MIN (requisition->height, .80 * area.height);
+ out:
+        if (minimum_size)
+                *minimum_size = min_size;
+        if (natural_size)
+                *natural_size = nat_size;
+}
 
-       /* Don't ever shrink window width
-        */
-        GtkAllocation widget_allocation;
-        gtk_widget_get_allocation (widget, &widget_allocation);
+static void
+gdm_greeter_login_window_get_preferred_height (GtkWidget *widget,
+                                               gint      *minimum_size,
+                                               gint      *natural_size)
+{
+        int             monitor;
+        GdkScreen      *screen;
+        GdkRectangle    area;
+        int             min_size;
+        int             nat_size;
+        guint           border_width;
+
+        min_size = 0;
+        nat_size = 0;
+
+        if (!gtk_widget_get_realized (widget)) {
+                goto out;
+        }
 
-        requisition->width = MAX (requisition->width, widget_allocation.width);
+        gtk_widget_get_preferred_height (gtk_bin_get_child (GTK_BIN (widget)),
+                                        &min_size,
+                                        &nat_size);
+
+        border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+        min_size += 2 * border_width;
+        nat_size += 2 * border_width;
+
+        /* Make height be at most 80% of screen height */
+        screen = gtk_widget_get_screen (widget);
+        monitor = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
+        gdk_screen_get_monitor_geometry (screen, monitor, &area);
+        min_size = MIN (min_size, .8 * area.height);
+        nat_size = MIN (nat_size, .8 * area.height);
+
+ out:
+        if (minimum_size)
+                *minimum_size = min_size;
+        if (natural_size)
+                *natural_size = nat_size;
 }
 
 static void
@@ -1471,7 +1516,8 @@ gdm_greeter_login_window_class_init (GdmGreeterLoginWindowClass *klass)
         object_class->finalize = gdm_greeter_login_window_finalize;
 
         widget_class->key_press_event = gdm_greeter_login_window_key_press_event;
-        widget_class->size_request = gdm_greeter_login_window_size_request;
+        widget_class->get_preferred_width = gdm_greeter_login_window_get_preferred_width;
+        widget_class->get_preferred_height = gdm_greeter_login_window_get_preferred_height;
 
         signals [BEGIN_AUTO_LOGIN] =
                 g_signal_new ("begin-auto-login",
diff --git a/gui/simple-greeter/gdm-greeter-panel.c b/gui/simple-greeter/gdm-greeter-panel.c
index 69eeeda..32ae792 100644
--- a/gui/simple-greeter/gdm-greeter-panel.c
+++ b/gui/simple-greeter/gdm-greeter-panel.c
@@ -79,6 +79,7 @@ struct GdmGreeterPanelPrivate
         GtkWidget              *option_hbox;
         GtkWidget              *hostname_label;
         GtkWidget              *clock;
+        NaTray                 *tray;
         GtkWidget              *shutdown_button;
         GtkWidget              *shutdown_menu;
         GtkWidget              *language_option_widget;
@@ -238,7 +239,7 @@ gdm_greeter_panel_real_realize (GtkWidget *widget)
                 GTK_WIDGET_CLASS (gdm_greeter_panel_parent_class)->realize (widget);
         }
 
-        gdk_window_set_geometry_hints (widget->window, NULL, GDK_HINT_POS);
+        gdk_window_set_geometry_hints (gtk_widget_get_window (widget), NULL, GDK_HINT_POS);
 
         gdm_greeter_panel_move_resize_window (GDM_GREETER_PANEL (widget), TRUE, TRUE);
 
@@ -295,35 +296,30 @@ set_struts (GdmGreeterPanel *panel,
 #endif
 
         gdk_error_trap_push ();
+        if (gtk_widget_get_window (GTK_WIDGET (panel)) != NULL) {
+                gdk_property_change (gtk_widget_get_window (GTK_WIDGET (panel)),
+                                     gdk_atom_intern ("_NET_WM_STRUT_PARTIAL", FALSE),
+                                     gdk_atom_intern ("CARDINAL", FALSE),
+                                     32,
+                                     GDK_PROP_MODE_REPLACE,
+                                     (guchar *) &data,
+                                     12);
+
+                gdk_property_change (gtk_widget_get_window (GTK_WIDGET (panel)),
+                                     gdk_atom_intern ("_NET_WM_STRUT", FALSE),
+                                     gdk_atom_intern ("CARDINAL", FALSE),
+                                     32,
+                                     GDK_PROP_MODE_REPLACE,
+                                     (guchar *) &data,
+                                     4);
+        }
 
-        gdk_property_change (gtk_widget_get_window (GTK_WIDGET (panel)),
-                             gdk_atom_intern ("_NET_WM_STRUT_PARTIAL", FALSE),
-                             gdk_atom_intern ("CARDINAL", FALSE),
-                             32,
-                             GDK_PROP_MODE_REPLACE,
-                             (guchar *) &data,
-                             12);
-
-        gdk_property_change (gtk_widget_get_window (GTK_WIDGET (panel)),
-                             gdk_atom_intern ("_NET_WM_STRUT", FALSE),
-                             gdk_atom_intern ("CARDINAL", FALSE),
-                             32,
-                             GDK_PROP_MODE_REPLACE,
-                             (guchar *) &data,
-                             4);
-
-        gdk_error_trap_pop ();
+        gdk_error_trap_pop_ignored ();
 }
 
 static void
 update_struts (GdmGreeterPanel *panel)
 {
-        GdkRectangle geometry;
-
-        gdk_screen_get_monitor_geometry (gtk_window_get_screen (GTK_WINDOW (panel)),
-                                         panel->priv->monitor,
-                                         &geometry);
-
         /* FIXME: assumes only one panel */
         set_struts (panel,
                     panel->priv->geometry.x,
@@ -360,32 +356,50 @@ update_geometry (GdmGreeterPanel *panel,
 }
 
 static void
-gdm_greeter_panel_real_size_request (GtkWidget      *widget,
-                                     GtkRequisition *requisition)
+gdm_greeter_panel_get_preferred_size (GtkWidget      *widget,
+                                      GtkOrientation  orientation,
+                                      gint           *minimum_size,
+                                      gint           *natural_size)
 {
         GdmGreeterPanel *panel;
         GtkBin          *bin;
+        GtkWidget       *child;
         GdkRectangle     old_geometry;
         int              position_changed = FALSE;
         int              size_changed = FALSE;
+        GtkRequisition   minimum_req, natural_req;
 
         panel = GDM_GREETER_PANEL (widget);
         bin = GTK_BIN (widget);
+        child = gtk_bin_get_child (bin);
+
+        minimum_req.width = 0;
+        minimum_req.height = 0;
+        natural_req.width = minimum_req.width;
+        natural_req.height = minimum_req.height;
+
+        if (child != NULL && gtk_widget_get_visible (child)) {
+                int min_child_width, nat_child_width;
+                int min_child_height, nat_child_height;
+
+                gtk_widget_get_preferred_width (gtk_bin_get_child (bin),
+                                                &min_child_width,
+                                                &nat_child_width);
+                gtk_widget_get_preferred_height (gtk_bin_get_child (bin),
+                                                 &min_child_height,
+                                                 &nat_child_height);
+
+                minimum_req.width += min_child_width;
+                natural_req.width += nat_child_width;
+                minimum_req.height += min_child_height;
+                natural_req.height += nat_child_height;
+        }
 
         old_geometry = panel->priv->geometry;
+        update_geometry (panel, &natural_req);
 
-        update_geometry (panel, requisition);
-
-        requisition->width  = panel->priv->geometry.width;
-        requisition->height = panel->priv->geometry.height;
-
-        if (gtk_bin_get_child (bin) && gtk_widget_get_visible (gtk_bin_get_child (bin))) {
-                gtk_widget_size_request (gtk_bin_get_child (bin), requisition);
-        }
-
-        if (! gtk_widget_get_realized (widget)) {
-                return;
-        }
+        if (!gtk_widget_get_realized (widget))
+                goto out;
 
         if (old_geometry.width  != panel->priv->geometry.width ||
             old_geometry.height != panel->priv->geometry.height) {
@@ -398,6 +412,36 @@ gdm_greeter_panel_real_size_request (GtkWidget      *widget,
         }
 
         gdm_greeter_panel_move_resize_window (panel, position_changed, size_changed);
+
+ out:
+
+        if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+                if (minimum_size)
+                        *minimum_size = panel->priv->geometry.width;
+                if (natural_size)
+                        *natural_size = panel->priv->geometry.width;
+        } else {
+                if (minimum_size)
+                        *minimum_size = panel->priv->geometry.height;
+                if (natural_size)
+                        *natural_size = panel->priv->geometry.height;
+        }
+}
+
+static void
+gdm_greeter_panel_real_get_preferred_width (GtkWidget *widget,
+                                            gint      *minimum_size,
+                                            gint      *natural_size)
+{
+        gdm_greeter_panel_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
+}
+
+static void
+gdm_greeter_panel_real_get_preferred_height (GtkWidget *widget,
+                                             gint      *minimum_size,
+                                             gint      *natural_size)
+{
+        gdm_greeter_panel_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
 }
 
 static void
@@ -722,7 +766,6 @@ on_shutdown_menu_deactivate (GdmGreeterPanel *panel)
 static void
 setup_panel (GdmGreeterPanel *panel)
 {
-        NaTray    *tray;
         GtkWidget *spacer;
         int        padding;
 
@@ -846,13 +889,13 @@ setup_panel (GdmGreeterPanel *panel)
                             GTK_WIDGET (panel->priv->clock), FALSE, FALSE, 6);
         gtk_widget_show (panel->priv->clock);
 
-        tray = na_tray_new_for_screen (gtk_window_get_screen (GTK_WINDOW (panel)),
-                                       GTK_ORIENTATION_HORIZONTAL);
+        panel->priv->tray = na_tray_new_for_screen (gtk_window_get_screen (GTK_WINDOW (panel)),
+                                                    GTK_ORIENTATION_HORIZONTAL);
 
         padding = gconf_client_get_int (panel->priv->client, KEY_NOTIFICATION_AREA_PADDING, NULL);
-        na_tray_set_padding (tray, padding);
-        gtk_box_pack_end (GTK_BOX (panel->priv->hbox), GTK_WIDGET (tray), FALSE, FALSE, 6);
-        gtk_widget_show (GTK_WIDGET (tray));
+        na_tray_set_padding (panel->priv->tray, padding);
+        gtk_box_pack_end (GTK_BOX (panel->priv->hbox), GTK_WIDGET (panel->priv->tray), FALSE, FALSE, 6);
+        gtk_widget_show (GTK_WIDGET (panel->priv->tray));
         gdm_greeter_panel_hide_user_options (panel);
 
         panel->priv->progress = 0.0;
@@ -928,7 +971,8 @@ gdm_greeter_panel_class_init (GdmGreeterPanelClass *klass)
 
         widget_class->realize = gdm_greeter_panel_real_realize;
         widget_class->unrealize = gdm_greeter_panel_real_unrealize;
-        widget_class->size_request = gdm_greeter_panel_real_size_request;
+        widget_class->get_preferred_width = gdm_greeter_panel_real_get_preferred_width;
+        widget_class->get_preferred_height = gdm_greeter_panel_real_get_preferred_height;
         widget_class->show = gdm_greeter_panel_real_show;
         widget_class->hide = gdm_greeter_panel_real_hide;
 
diff --git a/gui/simple-greeter/gdm-greeter-session.c b/gui/simple-greeter/gdm-greeter-session.c
index d4ef77f..e97b540 100644
--- a/gui/simple-greeter/gdm-greeter-session.c
+++ b/gui/simple-greeter/gdm-greeter-session.c
@@ -314,8 +314,8 @@ get_tallest_monitor_at_point (GdkScreen *screen,
                               int        x,
                               int        y)
 {
-        GdkRectangle area;
-        GdkRegion *region;
+        cairo_rectangle_int_t area;
+        cairo_region_t *region;
         int i;
         int monitor;
         int n_monitors;
@@ -326,15 +326,15 @@ get_tallest_monitor_at_point (GdkScreen *screen,
         monitor = -1;
         for (i = 0; i < n_monitors; i++) {
                 gdk_screen_get_monitor_geometry (screen, i, &area);
-                region = gdk_region_rectangle (&area);
+                region = cairo_region_create_rectangle (&area);
 
-                if (gdk_region_point_in (region, x, y)) {
+                if (cairo_region_contains_point (region, x, y)) {
                         if (area.height > tallest_height) {
                                 monitor = i;
                                 tallest_height = area.height;
                         }
                 }
-                gdk_region_destroy (region);
+                cairo_region_destroy (region);
         }
 
         if (monitor == -1) {
diff --git a/gui/simple-greeter/gdm-language-chooser-dialog.c b/gui/simple-greeter/gdm-language-chooser-dialog.c
index d03d6c8..a5f150a 100644
--- a/gui/simple-greeter/gdm-language-chooser-dialog.c
+++ b/gui/simple-greeter/gdm-language-chooser-dialog.c
@@ -72,28 +72,79 @@ gdm_language_chooser_dialog_set_current_language_name (GdmLanguageChooserDialog
 }
 
 static void
-gdm_language_chooser_dialog_size_request (GtkWidget      *widget,
-                                       GtkRequisition *requisition)
+gdm_language_chooser_dialog_get_preferred_width (GtkWidget *widget,
+                                                 gint      *minimum_size,
+                                                 gint      *natural_size)
 {
-        int            screen_w;
-        int            screen_h;
-        GtkRequisition child_requisition;
+        GtkWidget *child;
+        int        min_size, nat_size;
+        int        screen_w;
 
-        if (GTK_WIDGET_CLASS (gdm_language_chooser_dialog_parent_class)->size_request) {
-                GTK_WIDGET_CLASS (gdm_language_chooser_dialog_parent_class)->size_request (widget, requisition);
+        /* FIXME: this should use monitor size */
+        screen_w = gdk_screen_get_width (gtk_widget_get_screen (widget));
+
+        child = gtk_bin_get_child (GTK_BIN (widget));
+
+        min_size = 0;
+        nat_size = 0;
+
+        if (GTK_WIDGET_CLASS (gdm_language_chooser_dialog_parent_class)->get_preferred_width) {
+                GTK_WIDGET_CLASS (gdm_language_chooser_dialog_parent_class)->get_preferred_width (widget, &min_size, &nat_size);
         }
 
-        screen_w = gdk_screen_get_width (gtk_widget_get_screen (widget));
-        screen_h = gdk_screen_get_height (gtk_widget_get_screen (widget));
+        if (child && gtk_widget_get_visible (child)) {
+                gtk_widget_get_preferred_width (child,
+                                                &min_size,
+                                                &nat_size);
+        }
+
+        min_size += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        min_size = MIN (min_size, .50 * screen_w);
+        nat_size += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        nat_size = MIN (nat_size, .50 * screen_w);
+
+        if (minimum_size)
+                *minimum_size = min_size;
+        if (natural_size)
+                *natural_size = nat_size;
+}
 
-        gtk_widget_get_child_requisition (gtk_bin_get_child (GTK_BIN (widget)), &child_requisition);
-        *requisition = child_requisition;
+static void
+gdm_language_chooser_dialog_get_preferred_height (GtkWidget *widget,
+                                                  gint      *minimum_size,
+                                                  gint      *natural_size)
+{
+        GtkWidget *child;
+        int        min_size, nat_size;
+        int        screen_w;
+
+        /* FIXME: this should use monitor size */
+        screen_w = gdk_screen_get_height (gtk_widget_get_screen (widget));
+
+        child = gtk_bin_get_child (GTK_BIN (widget));
+
+        min_size = 0;
+        nat_size = 0;
+
+        if (GTK_WIDGET_CLASS (gdm_language_chooser_dialog_parent_class)->get_preferred_height) {
+                GTK_WIDGET_CLASS (gdm_language_chooser_dialog_parent_class)->get_preferred_height (widget, &min_size, &nat_size);
+        }
+
+        if (child && gtk_widget_get_visible (child)) {
+                gtk_widget_get_preferred_height (child,
+                                                &min_size,
+                                                &nat_size);
+        }
 
-        requisition->width += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
-        requisition->height += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        min_size += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        min_size = MIN (min_size, .50 * screen_w);
+        nat_size += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        nat_size = MIN (nat_size, .50 * screen_w);
 
-        requisition->width = MIN (requisition->width, .50 * screen_w);
-        requisition->height = MIN (requisition->height, .80 * screen_h);
+        if (minimum_size)
+                *minimum_size = min_size;
+        if (natural_size)
+                *natural_size = nat_size;
 }
 
 static void
@@ -126,7 +177,8 @@ gdm_language_chooser_dialog_class_init (GdmLanguageChooserDialogClass *klass)
         GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
         object_class->finalize = gdm_language_chooser_dialog_finalize;
-        widget_class->size_request = gdm_language_chooser_dialog_size_request;
+        widget_class->get_preferred_width = gdm_language_chooser_dialog_get_preferred_width;
+        widget_class->get_preferred_height = gdm_language_chooser_dialog_get_preferred_height;
         widget_class->realize = gdm_language_chooser_dialog_realize;
 
         g_type_class_add_private (klass, sizeof (GdmLanguageChooserDialogPrivate));
@@ -168,7 +220,6 @@ gdm_language_chooser_dialog_init (GdmLanguageChooserDialog *dialog)
                                 GTK_STOCK_OK, GTK_RESPONSE_OK,
                                 NULL);
 
-        gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
         gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
         gtk_container_set_border_width (GTK_CONTAINER (dialog->priv->chooser_widget), 5);
         gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
diff --git a/gui/simple-greeter/gdm-layout-chooser-dialog.c b/gui/simple-greeter/gdm-layout-chooser-dialog.c
index eb5bdc6..41c293c 100644
--- a/gui/simple-greeter/gdm-layout-chooser-dialog.c
+++ b/gui/simple-greeter/gdm-layout-chooser-dialog.c
@@ -72,28 +72,79 @@ gdm_layout_chooser_dialog_set_current_layout_name (GdmLayoutChooserDialog *dialo
 }
 
 static void
-gdm_layout_chooser_dialog_size_request (GtkWidget      *widget,
-                                        GtkRequisition *requisition)
+gdm_layout_chooser_dialog_get_preferred_width (GtkWidget *widget,
+                                               gint      *minimum_size,
+                                               gint      *natural_size)
 {
-        int            screen_w;
-        int            screen_h;
-        GtkRequisition child_requisition;
+        GtkWidget *child;
+        int        min_size, nat_size;
+        int        screen_w;
 
-        if (GTK_WIDGET_CLASS (gdm_layout_chooser_dialog_parent_class)->size_request) {
-                GTK_WIDGET_CLASS (gdm_layout_chooser_dialog_parent_class)->size_request (widget, requisition);
+        /* FIXME: this should use monitor size */
+        screen_w = gdk_screen_get_width (gtk_widget_get_screen (widget));
+
+        child = gtk_bin_get_child (GTK_BIN (widget));
+
+        min_size = 0;
+        nat_size = 0;
+
+        if (GTK_WIDGET_CLASS (gdm_layout_chooser_dialog_parent_class)->get_preferred_width) {
+                GTK_WIDGET_CLASS (gdm_layout_chooser_dialog_parent_class)->get_preferred_width (widget, &min_size, &nat_size);
         }
 
-        screen_w = gdk_screen_get_width (gtk_widget_get_screen (widget));
+        if (child && gtk_widget_get_visible (child)) {
+                gtk_widget_get_preferred_width (child,
+                                                &min_size,
+                                                &nat_size);
+        }
+
+        min_size += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        min_size = MIN (min_size, .50 * screen_w);
+        nat_size += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        nat_size = MIN (nat_size, .50 * screen_w);
+
+        if (minimum_size)
+                *minimum_size = min_size;
+        if (natural_size)
+                *natural_size = nat_size;
+}
+
+static void
+gdm_layout_chooser_dialog_get_preferred_height (GtkWidget *widget,
+                                                gint      *minimum_size,
+                                                gint      *natural_size)
+{
+        GtkWidget *child;
+        int        min_size, nat_size;
+        int        screen_h;
+
+        /* FIXME: this should use monitor size */
         screen_h = gdk_screen_get_height (gtk_widget_get_screen (widget));
 
-        gtk_widget_get_child_requisition (gtk_bin_get_child (GTK_BIN (widget)), &child_requisition);
-        *requisition = child_requisition;
+        child = gtk_bin_get_child (GTK_BIN (widget));
+
+        min_size = 0;
+        nat_size = 0;
+
+        if (GTK_WIDGET_CLASS (gdm_layout_chooser_dialog_parent_class)->get_preferred_height) {
+                GTK_WIDGET_CLASS (gdm_layout_chooser_dialog_parent_class)->get_preferred_height (widget, &min_size, &nat_size);
+        }
+
+        if (child && gtk_widget_get_visible (child)) {
+                gtk_widget_get_preferred_height (child,
+                                                &min_size,
+                                                &nat_size);
+        }
 
-        requisition->width += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
-        requisition->height += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        min_size += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        min_size = MIN (min_size, .50 * screen_h);
+        nat_size += 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        nat_size = MIN (nat_size, .50 * screen_h);
 
-        requisition->width = MIN (requisition->width, .50 * screen_w);
-        requisition->height = MIN (requisition->height, .80 * screen_h);
+        if (minimum_size)
+                *minimum_size = min_size;
+        if (natural_size)
+                *natural_size = nat_size;
 }
 
 static void
@@ -115,7 +166,8 @@ gdm_layout_chooser_dialog_class_init (GdmLayoutChooserDialogClass *klass)
         GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
         object_class->finalize = gdm_layout_chooser_dialog_finalize;
-        widget_class->size_request = gdm_layout_chooser_dialog_size_request;
+        widget_class->get_preferred_width = gdm_layout_chooser_dialog_get_preferred_width;
+        widget_class->get_preferred_height = gdm_layout_chooser_dialog_get_preferred_height;
         widget_class->realize = gdm_layout_chooser_dialog_realize;
 
         g_type_class_add_private (klass, sizeof (GdmLayoutChooserDialogPrivate));
@@ -158,7 +210,6 @@ gdm_layout_chooser_dialog_init (GdmLayoutChooserDialog *dialog)
                                 GTK_STOCK_OK, GTK_RESPONSE_OK,
                                 NULL);
 
-        gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
         gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
         gtk_container_set_border_width (GTK_CONTAINER (dialog->priv->chooser_widget), 5);
         gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
diff --git a/gui/simple-greeter/gdm-layouts.c b/gui/simple-greeter/gdm-layouts.c
index 6043e8a..847ed8f 100644
--- a/gui/simple-greeter/gdm-layouts.c
+++ b/gui/simple-greeter/gdm-layouts.c
@@ -49,7 +49,7 @@ static void
 init_xkl (void)
 {
         if (config_registry == NULL) {
-                engine = xkl_engine_get_instance (GDK_DISPLAY ());
+                engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
                 config_registry = xkl_config_registry_get_instance (engine);
                 xkl_config_registry_load (config_registry, FALSE);
 
diff --git a/gui/simple-greeter/gdm-scrollable-widget.c b/gui/simple-greeter/gdm-scrollable-widget.c
index 58f84f9..34b2d3a 100644
--- a/gui/simple-greeter/gdm-scrollable-widget.c
+++ b/gui/simple-greeter/gdm-scrollable-widget.c
@@ -252,6 +252,7 @@ gdm_scrollable_widget_animation_stop (GdmScrollableWidgetAnimation *animation)
 static gboolean
 gdm_scrollable_widget_needs_scrollbar (GdmScrollableWidget *widget)
 {
+        GtkWidget *child;
         gboolean needs_scrollbar;
 
         if (widget->priv->scrollbar == NULL) {
@@ -266,17 +267,14 @@ gdm_scrollable_widget_needs_scrollbar (GdmScrollableWidget *widget)
                 return FALSE;
         }
 
-        if (gtk_bin_get_child (GTK_BIN (widget)) != NULL) {
-                GtkRequisition child_requisition;
-                GtkAllocation widget_allocation;
+        child = gtk_bin_get_child (GTK_BIN (widget));
+        if (child != NULL) {
                 int available_height;
+                int child_scrolled_height;
 
-                gtk_widget_get_allocation (GTK_WIDGET (widget), &widget_allocation);
-
-                gtk_widget_get_child_requisition (gtk_bin_get_child (GTK_BIN (widget)),
-                                                  &child_requisition);
-                available_height = widget_allocation.height;
-                needs_scrollbar = child_requisition.height > available_height;
+                available_height = gtk_widget_get_allocated_height (GTK_WIDGET (widget));
+                gtk_widget_get_preferred_height (child, NULL, &child_scrolled_height);
+                needs_scrollbar = child_scrolled_height > available_height;
         } else {
                 needs_scrollbar = FALSE;
         }
@@ -285,56 +283,89 @@ gdm_scrollable_widget_needs_scrollbar (GdmScrollableWidget *widget)
 }
 
 static void
-gdm_scrollable_widget_size_request (GtkWidget      *widget,
-                                    GtkRequisition *requisition)
+gdm_scrollable_widget_get_preferred_size (GtkWidget      *widget,
+                                          GtkOrientation  orientation,
+                                          gint           *minimum_size,
+                                          gint           *natural_size)
 {
         GdmScrollableWidget *scrollable_widget;
-        GtkRequisition       child_requisition;
-        gboolean             child_adjustments_stale;
+        GtkRequisition scrollbar_requisition;
+        GtkRequisition minimum_req, natural_req;
+        GtkWidget *child;
+        int min_child_size, nat_child_size;
 
+        child = gtk_bin_get_child (GTK_BIN (widget));
         scrollable_widget = GDM_SCROLLABLE_WIDGET (widget);
 
-        requisition->width = 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
-        requisition->height = 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
-
-        requisition->width += 2 * gtk_widget_get_style (widget)->xthickness;
-        requisition->height += 2 * gtk_widget_get_style (widget)->ythickness;
-
-        child_adjustments_stale = FALSE;
-        GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
-
-         if (child && gtk_widget_get_visible (child)) {
+        gtk_widget_get_preferred_size (scrollable_widget->priv->scrollbar,
+                                       &scrollbar_requisition,
+                                       NULL);
 
-                int old_child_height;
-                gtk_widget_get_child_requisition (child,
-                                                  &child_requisition);
-                old_child_height = child_requisition.height;
+        minimum_req.width = 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
+        minimum_req.height = 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
 
-                gtk_widget_size_request (child,
-                                         &child_requisition);
+        minimum_req.width += 2 * gtk_widget_get_style (widget)->xthickness;
+        minimum_req.height += 2 * gtk_widget_get_style (widget)->ythickness;
 
-                requisition->width += child_requisition.width;
-                requisition->height += child_requisition.height;
+        natural_req.width = minimum_req.width;
+        natural_req.height = minimum_req.height;
 
-                child_adjustments_stale = old_child_height != child_requisition.height;
+        if (child && gtk_widget_get_visible (child)) {
+                if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+                        gtk_widget_get_preferred_width (child,
+                                                        &min_child_size,
+                                                        &nat_child_size);
+                        minimum_req.width += min_child_size;
+                        natural_req.width += nat_child_size;
+                }
         }
 
         if (gdm_scrollable_widget_needs_scrollbar (scrollable_widget)) {
-                GtkRequisition scrollbar_requisition;
-
-                gtk_widget_show (scrollable_widget->priv->scrollbar);
-
-                gtk_widget_size_request (scrollable_widget->priv->scrollbar,
-                                         &scrollbar_requisition);
+                /* FIXME: make this a property */
+                minimum_req.height += 48;
+                natural_req.height += 48;
+
+                minimum_req.height = MAX (minimum_req.height,
+                                          scrollbar_requisition.height);
+                minimum_req.width += scrollbar_requisition.width;
+                natural_req.height = MAX (natural_req.height,
+                                          scrollbar_requisition.height);
+                natural_req.width += scrollbar_requisition.width;
+        } else {
+                gtk_widget_get_preferred_height (child,
+                                                &min_child_size,
+                                                &nat_child_size);
+                minimum_req.height += min_child_size;
+                natural_req.height += nat_child_size;
+        }
 
-                requisition->height = MAX (requisition->height,
-                                           scrollbar_requisition.height);
-                requisition->width += scrollbar_requisition.width;
+        if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+                if (minimum_size)
+                        *minimum_size = minimum_req.width;
+                if (natural_size)
+                        *natural_size = natural_req.width;
         } else {
-                gtk_widget_hide (scrollable_widget->priv->scrollbar);
+                if (minimum_size)
+                        *minimum_size = minimum_req.height;
+                if (natural_size)
+                        *natural_size = natural_req.height;
         }
+}
 
-        scrollable_widget->priv->child_adjustments_stale = child_adjustments_stale;
+static void
+gdm_scrollable_widget_get_preferred_width (GtkWidget *widget,
+                                           gint      *minimum_size,
+                                           gint      *natural_size)
+{
+        gdm_scrollable_widget_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
+}
+
+static void
+gdm_scrollable_widget_get_preferred_height (GtkWidget *widget,
+                                            gint      *minimum_size,
+                                            gint      *natural_size)
+{
+        gdm_scrollable_widget_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
 }
 
 static void
@@ -347,24 +378,21 @@ gdm_scrollable_widget_size_allocate (GtkWidget     *widget,
         gboolean             has_child;
         gboolean             needs_scrollbar;
         gboolean             is_flipped;
+        GtkWidget           *child;
 
         scrollable_widget = GDM_SCROLLABLE_WIDGET (widget);
 
         gtk_widget_set_allocation (widget, allocation);
 
-        GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
-
+        child = gtk_bin_get_child (GTK_BIN (widget));
         has_child = child && gtk_widget_get_visible (child);
         needs_scrollbar = gdm_scrollable_widget_needs_scrollbar (scrollable_widget);
         is_flipped = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
 
         if (needs_scrollbar) {
-                GtkRequisition scrollbar_requisition;
-
-                gtk_widget_get_child_requisition (scrollable_widget->priv->scrollbar,
-                                                  &scrollbar_requisition);
+                gtk_widget_show (scrollable_widget->priv->scrollbar);
 
-                scrollbar_allocation.width = scrollbar_requisition.width;
+                gtk_widget_get_preferred_width (scrollable_widget->priv->scrollbar, NULL, &scrollbar_allocation.width);
 
                 if (!is_flipped) {
                         scrollbar_allocation.x = allocation->x + allocation->width;
@@ -383,6 +411,8 @@ gdm_scrollable_widget_size_allocate (GtkWidget     *widget,
 
                 gtk_widget_size_allocate (scrollable_widget->priv->scrollbar,
                                           &scrollbar_allocation);
+        } else {
+                gtk_widget_hide (scrollable_widget->priv->scrollbar);
         }
 
         if (has_child) {
@@ -408,7 +438,6 @@ gdm_scrollable_widget_size_allocate (GtkWidget     *widget,
                 child_allocation.height = allocation->height;
                 child_allocation.height -= 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
                 child_allocation.height -= 2 * gtk_widget_get_style (widget)->ythickness;
-
                 child_allocation.y = allocation->y;
                 child_allocation.y += gtk_container_get_border_width (GTK_CONTAINER (widget));
                 child_allocation.y += gtk_widget_get_style (widget)->ythickness;
@@ -433,14 +462,17 @@ gdm_scrollable_widget_add (GtkContainer *container,
                                   G_CALLBACK (gtk_widget_queue_resize),
                                   container);
 
-        gtk_widget_set_scroll_adjustments (child, NULL, adjustment);
+        if (GTK_IS_SCROLLABLE (child))
+                g_object_set (child, "hadjustment", NULL, "vadjustment", adjustment, NULL);
+        else
+                g_warning ("gdm_scrollable_widget_add(): cannot add non scrollable widget");
 }
 
 static void
 gdm_scrollable_widget_remove (GtkContainer *container,
                               GtkWidget    *child)
 {
-        gtk_widget_set_scroll_adjustments (child, NULL, NULL);
+        g_object_set (child, "hadjustment", NULL, "vadjustment", NULL, NULL);
 
         GTK_CONTAINER_CLASS (gdm_scrollable_widget_parent_class)->remove (container, child);
 }
@@ -496,8 +528,8 @@ gdm_scrollable_widget_finalize (GObject *object)
 }
 
 static gboolean
-gdm_scrollable_widget_expose_event (GtkWidget      *widget,
-                                    GdkEventExpose *event)
+gdm_scrollable_widget_draw (GtkWidget *widget,
+                            cairo_t   *cr)
 {
         GdmScrollableWidget *scrollable_widget;
         int                  x;
@@ -505,6 +537,7 @@ gdm_scrollable_widget_expose_event (GtkWidget      *widget,
         int                  width;
         int                  height;
         gboolean             is_flipped;
+        GtkStyleContext     *context;
         GtkAllocation widget_allocation;
 
         gtk_widget_get_allocation (widget, &widget_allocation);
@@ -539,12 +572,15 @@ gdm_scrollable_widget_expose_event (GtkWidget      *widget,
         height = widget_allocation.height;
         height -= 2 * gtk_container_get_border_width (GTK_CONTAINER (widget));
 
-        gtk_paint_shadow (gtk_widget_get_style (widget), gtk_widget_get_window (widget),
-                          gtk_widget_get_state (widget), GTK_SHADOW_IN,
-                          &event->area, widget, "scrolled_window",
+        context = gtk_widget_get_style_context (widget);
+        gtk_style_context_save (context);
+        gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);
+
+        gtk_render_frame (context, cr,
                           x, y, width, height);
+        gtk_style_context_restore (context);
 
-        return GTK_WIDGET_CLASS (gdm_scrollable_widget_parent_class)->expose_event (widget, event);
+        return GTK_WIDGET_CLASS (gdm_scrollable_widget_parent_class)->draw (widget, cr);
 }
 
 static gboolean
@@ -569,7 +605,7 @@ add_scroll_binding (GtkBindingSet  *binding_set,
                     GdkModifierType mask,
                     GtkScrollType   scroll)
 {
-        guint keypad_keyval = keyval - GDK_Left + GDK_KP_Left;
+        guint keypad_keyval = keyval - GDK_KEY_Left + GDK_KEY_KP_Left;
 
         gtk_binding_entry_add_signal (binding_set, keyval, mask,
                                       "scroll-child", 1,
@@ -584,10 +620,10 @@ add_tab_bindings (GtkBindingSet    *binding_set,
                   GdkModifierType   modifiers,
                   GtkDirectionType  direction)
 {
-        gtk_binding_entry_add_signal (binding_set, GDK_Tab, modifiers,
+        gtk_binding_entry_add_signal (binding_set, GDK_KEY_Tab, modifiers,
                                       "move-focus-out", 1,
                                       GTK_TYPE_DIRECTION_TYPE, direction);
-        gtk_binding_entry_add_signal (binding_set, GDK_KP_Tab, modifiers,
+        gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Tab, modifiers,
                                       "move-focus-out", 1,
                                       GTK_TYPE_DIRECTION_TYPE, direction);
 }
@@ -599,14 +635,14 @@ gdm_scrollable_widget_class_install_bindings (GdmScrollableWidgetClass *klass)
 
         binding_set = gtk_binding_set_by_class (klass);
 
-        add_scroll_binding (binding_set, GDK_Up, GDK_CONTROL_MASK, GTK_SCROLL_STEP_BACKWARD);
-        add_scroll_binding (binding_set, GDK_Down, GDK_CONTROL_MASK, GTK_SCROLL_STEP_FORWARD);
+        add_scroll_binding (binding_set, GDK_KEY_Up, GDK_CONTROL_MASK, GTK_SCROLL_STEP_BACKWARD);
+        add_scroll_binding (binding_set, GDK_KEY_Down, GDK_CONTROL_MASK, GTK_SCROLL_STEP_FORWARD);
 
-        add_scroll_binding (binding_set, GDK_Page_Up, 0, GTK_SCROLL_PAGE_BACKWARD);
-        add_scroll_binding (binding_set, GDK_Page_Down, 0, GTK_SCROLL_PAGE_FORWARD);
+        add_scroll_binding (binding_set, GDK_KEY_Page_Up, 0, GTK_SCROLL_PAGE_BACKWARD);
+        add_scroll_binding (binding_set, GDK_KEY_Page_Down, 0, GTK_SCROLL_PAGE_FORWARD);
 
-        add_scroll_binding (binding_set, GDK_Home, 0, GTK_SCROLL_START);
-        add_scroll_binding (binding_set, GDK_End, 0, GTK_SCROLL_END);
+        add_scroll_binding (binding_set, GDK_KEY_Home, 0, GTK_SCROLL_START);
+        add_scroll_binding (binding_set, GDK_KEY_End, 0, GTK_SCROLL_END);
 
         add_tab_bindings (binding_set, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
         add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
@@ -629,9 +665,10 @@ gdm_scrollable_widget_class_init (GdmScrollableWidgetClass *klass)
 
         widget_class->destroy = gdm_scrollable_widget_destroy;
 
-        widget_class->size_request = gdm_scrollable_widget_size_request;
+        widget_class->get_preferred_width = gdm_scrollable_widget_get_preferred_width;
+        widget_class->get_preferred_height = gdm_scrollable_widget_get_preferred_height;
         widget_class->size_allocate = gdm_scrollable_widget_size_allocate;
-        widget_class->expose_event = gdm_scrollable_widget_expose_event;
+        widget_class->draw = gdm_scrollable_widget_draw;
         widget_class->scroll_event = gdm_scrollable_widget_scroll_event;
 
         container_class->add = gdm_scrollable_widget_add;
@@ -666,6 +703,7 @@ gdm_scrollable_widget_add_scrollbar (GdmScrollableWidget *widget)
 {
         gtk_widget_push_composite_child ();
         widget->priv->scrollbar = gtk_vscrollbar_new (NULL);
+        g_object_set (widget->priv->scrollbar, "expand", TRUE, NULL);
         gtk_widget_set_composite_name (widget->priv->scrollbar, "scrollbar");
         gtk_widget_pop_composite_child ();
         gtk_widget_set_parent (widget->priv->scrollbar, GTK_WIDGET (widget));
@@ -735,6 +773,7 @@ gdm_scrollable_widget_slide_to_height (GdmScrollableWidget *scrollable_widget,
 {
         GtkWidget *widget;
         gboolean   input_redirected;
+        GtkAllocation widget_allocation;
 
         g_return_if_fail (GDM_IS_SCROLLABLE_WIDGET (scrollable_widget));
         widget = GTK_WIDGET (scrollable_widget);
@@ -762,7 +801,6 @@ gdm_scrollable_widget_slide_to_height (GdmScrollableWidget *scrollable_widget,
         height += gtk_widget_get_style (widget)->ythickness * 2;
         height += gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2;
 
-        GtkAllocation widget_allocation;
         gtk_widget_get_allocation (widget, &widget_allocation);
 
         scrollable_widget->priv->animation =
diff --git a/gui/simple-greeter/libnotificationarea/na-tray.c b/gui/simple-greeter/libnotificationarea/na-tray.c
index f8f40b0..1e0c9d2 100644
--- a/gui/simple-greeter/libnotificationarea/na-tray.c
+++ b/gui/simple-greeter/libnotificationarea/na-tray.c
@@ -490,7 +490,6 @@ update_size_and_orientation (NaTray *tray)
   if (get_tray (priv->trays_screen) == tray)
     na_tray_manager_set_orientation (priv->trays_screen->tray_manager,
                                      priv->orientation);
-
   /* note, you want this larger if the frame has non-NONE relief by default. */
   switch (priv->orientation)
     {
diff --git a/utils/gdm-screenshot.c b/utils/gdm-screenshot.c
index 1b9e31b..c580275 100644
--- a/utils/gdm-screenshot.c
+++ b/utils/gdm-screenshot.c
@@ -57,8 +57,8 @@ screenshot_grab_lock (void)
         gboolean   result = FALSE;
 
         selection_atom = gdk_x11_get_xatom_by_name (SELECTION_NAME);
-        XGrabServer (GDK_DISPLAY ());
-        if (XGetSelectionOwner (GDK_DISPLAY(), selection_atom) != None) {
+        XGrabServer (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+        if (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), selection_atom) != None) {
                 goto out;
         }
 
@@ -81,7 +81,7 @@ screenshot_grab_lock (void)
         result = TRUE;
 
  out:
-        XUngrabServer (GDK_DISPLAY ());
+        XUngrabServer (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
         gdk_flush ();
 
         return result;
@@ -114,13 +114,13 @@ screenshot_get_pixbuf (Window w)
         int        width;
         int        height;
 
-        window = gdk_window_foreign_new (w);
+        window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), w);
         if (window == NULL) {
                 return NULL;
         }
 
-        root = gdk_window_foreign_new (GDK_ROOT_WINDOW ());
-        gdk_drawable_get_size (window, &real_width, &real_height);
+        root = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), GDK_ROOT_WINDOW ());
+        gdk_window_get_geometry (window, NULL, NULL, &real_width, &real_height);
         gdk_window_get_origin (window, &x_real_orig, &y_real_orig);
 
         x_orig = x_real_orig;
@@ -144,15 +144,11 @@ screenshot_get_pixbuf (Window w)
                 height = gdk_screen_height () - y_orig;
         }
 
-        screenshot = gdk_pixbuf_get_from_drawable (NULL,
-                                                   root,
-                                                   NULL,
-                                                   x_orig,
-                                                   y_orig,
-                                                   0,
-                                                   0,
-                                                   width,
-                                                   height);
+        screenshot = gdk_pixbuf_get_from_window (root,
+                                                 x_orig,
+                                                 y_orig,
+                                                 width,
+                                                 height);
 
         return screenshot;
 }
diff --git a/utils/gdmflexiserver.c b/utils/gdmflexiserver.c
index fdcbfb1..41551a2 100644
--- a/utils/gdmflexiserver.c
+++ b/utils/gdmflexiserver.c
@@ -116,7 +116,7 @@ maybe_lock_screen (void)
 
         screen = gdk_screen_get_default ();
 
-        if (! gdk_spawn_command_line_on_screen (screen, command, &error)) {
+        if (! g_spawn_command_line_async (command, &error)) {
                 g_warning ("Cannot lock screen: %s", error->message);
                 g_error_free (error);
         }
@@ -125,7 +125,7 @@ maybe_lock_screen (void)
 
         if (! use_gscreensaver) {
                 command = g_strdup ("xscreensaver-command -throttle");
-                if (! gdk_spawn_command_line_on_screen (screen, command, &error)) {
+                if (! g_spawn_command_line_async (command, &error)) {
                         g_warning ("Cannot disable screensaver engines: %s", error->message);
                         g_error_free (error);
                 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]