[gdm: 7/70] Compute size constraint based on current monitor



commit 7957381ef345d45c22fd7d614381ed4bf0d42942
Author: Ray Strode <halfline src gnome org>
Date:   Wed Jan 14 22:59:37 2009 +0000

    Compute size constraint based on current monitor
    
    Before we were computing it based on the current
    screen (which may be multiple monitors)
    
    svn path=/trunk/; revision=6662
---
 ChangeLog                                     |    9 +++++++++
 gui/simple-greeter/gdm-greeter-login-window.c |   20 +++++++++++++-------
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0e96531..5ed06ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2009-01-14  Ray Strode <rstrode redhat com>
 
+	* gui/simple-greeter/gdm-greeter-login-window.c
+	(gdm_greeter_login_window_size_request): Compute
+	size constraint based on current monitor
+
+	Before we were computing it based on the current
+	screen (which may be multiple monitors)
+
+2009-01-14  Ray Strode <rstrode redhat com>
+
 	Don't truncate long pam messages
 
 	At some point I made the greeter login window set it's
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index b5329f3..01596e8 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -1652,16 +1652,22 @@ static void
 gdm_greeter_login_window_size_request (GtkWidget      *widget,
                                        GtkRequisition *requisition)
 {
-        int            screen_w;
-        int            screen_h;
-        GtkRequisition child_requisition;
+        int             monitor;
+        GdkScreen      *screen;
+        GtkRequisition  child_requisition;
+        GdkRectangle    area;
 
         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);
         }
 
-        screen_w = gdk_screen_get_width (gtk_widget_get_screen (widget));
-        screen_h = gdk_screen_get_height (gtk_widget_get_screen (widget));
+        if (!GTK_WIDGET_REALIZED (widget)) {
+                return;
+        }
+
+        screen = gtk_widget_get_screen (widget);
+        monitor = gdk_screen_get_monitor_at_window (screen, widget->window);
+        gdk_screen_get_monitor_geometry (screen, monitor, &area);
 
         gtk_widget_get_child_requisition (GTK_BIN (widget)->child, &child_requisition);
         *requisition = child_requisition;
@@ -1672,8 +1678,8 @@ gdm_greeter_login_window_size_request (GtkWidget      *widget,
         /* Make width be at least 33% screen width
          * and height be at most 80% of screen height
          */
-        requisition->width = MAX (requisition->width, .33 * screen_w);
-        requisition->height = MIN (requisition->height, .80 * screen_h);
+        requisition->width = MAX (requisition->width, .33 * area.width);
+        requisition->height = MIN (requisition->height, .80 * area.height);
 
        /* Don't ever shrink window width
         */



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