[libgnomekbd] Using primary monitor screen size, not the screen size



commit 678bd9ced6da21fc6c5980df318e1c1cd2e6aed2
Author: Sergey V. Udaltsov <svu gnome org>
Date:   Tue May 3 23:22:59 2011 +0100

    Using primary monitor screen size, not the screen size
    
    Using large screens can cause bad, huge, windows
    http://bugzilla.gnome.org/show_bug.cgi?id=647646

 libgnomekbd/gkbd-keyboard-drawing.c |    5 ++++-
 libgnomekbd/gkbd-util.c             |    6 ++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/libgnomekbd/gkbd-keyboard-drawing.c b/libgnomekbd/gkbd-keyboard-drawing.c
index 95d2ba4..434a122 100644
--- a/libgnomekbd/gkbd-keyboard-drawing.c
+++ b/libgnomekbd/gkbd-keyboard-drawing.c
@@ -2145,8 +2145,11 @@ static void
 get_preferred_width (GtkWidget * widget,
 		     gint * minimum_width, gint * natural_width)
 {
+	GdkRectangle rect;
 	GdkScreen *scr = gdk_screen_get_default ();
-	gint w = gdk_screen_get_width (scr);
+	gint w, monitor = gdk_screen_get_primary_monitor (scr);
+	gdk_screen_get_monitor_geometry (scr, monitor, &rect);
+	w = rect.width;
 	*minimum_width = *natural_width = w - (w >> 2);
 }
 
diff --git a/libgnomekbd/gkbd-util.c b/libgnomekbd/gkbd-util.c
index ede0b0a..abd093e 100644
--- a/libgnomekbd/gkbd-util.c
+++ b/libgnomekbd/gkbd-util.c
@@ -78,9 +78,11 @@ gkbd_preview_load_position (void)
 	if (x == -1 || y == -1 || w == -1 || h == -1) {
 		/* default values should be treated as 
 		 * "0.75 of the screen size" */
+		GdkRectangle rect;
 		GdkScreen *scr = gdk_screen_get_default ();
-		gint w = gdk_screen_get_width (scr);
-		gint h = gdk_screen_get_height (scr);
+		gint w, h, monitor = gdk_screen_get_primary_monitor (scr);
+		gdk_screen_get_monitor_geometry (scr, monitor, &rect);
+		w = rect.width; h = rect.height;
 		rv->x = w >> 3;
 		rv->y = h >> 3;
 		rv->width = w - (w >> 2);



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