[gdm] Position shutdown menu better in multi-monitor displays



commit 7fbb5c0dec8aa42b1d8985c6f62be02c035175da
Author: Ray Strode <rstrode redhat com>
Date:   Mon Oct 26 15:00:43 2009 -0400

    Position shutdown menu better in multi-monitor displays

 gui/simple-greeter/gdm-greeter-panel.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-panel.c b/gui/simple-greeter/gdm-greeter-panel.c
index 43b91d5..caade7a 100644
--- a/gui/simple-greeter/gdm-greeter-panel.c
+++ b/gui/simple-greeter/gdm-greeter-panel.c
@@ -790,10 +790,21 @@ position_shutdown_menu (GtkMenu         *menu,
                         GdmGreeterPanel *panel)
 {
         GtkRequisition menu_requisition;
+        GdkScreen *screen;
+        int monitor;
 
         *push_in = TRUE;
 
-        *x = panel->priv->shutdown_button->allocation.x;
+        screen = gtk_widget_get_screen (GTK_WIDGET (panel));
+        monitor = gdk_screen_get_monitor_at_window (screen, GTK_WIDGET (panel)->window);
+        gtk_menu_set_monitor (menu, monitor);
+
+        gtk_widget_translate_coordinates (GTK_WIDGET (panel->priv->shutdown_button),
+                                          GTK_WIDGET (panel),
+                                          panel->priv->shutdown_button->allocation.x,
+                                          panel->priv->shutdown_button->allocation.y,
+                                          x, y);
+
         gtk_window_get_position (GTK_WINDOW (panel), NULL, y);
 
         gtk_widget_size_request (GTK_WIDGET (menu), &menu_requisition);



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