summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2004-01-27 00:49:03 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-01-27 00:49:03 +0000
commit519a586ac4056a9dad0119f08f2e2d8600bd5e33 (patch)
tree22dce31b61b8f5e8bc50b5aafb18e6d6f324182e /gtk
parentae395158daade6f07fd3a9c73952fc1128a76670 (diff)
downloadgtk+-519a586ac4056a9dad0119f08f2e2d8600bd5e33.tar.gz
Make menus work better on Xinerama (#126150):
Tue Jan 27 01:46:54 2004 Matthias Clasen <maclas@gmx.de> Make menus work better on Xinerama (#126150): * gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Calculate the monitor_num on the screen of the menu, not of the attach widget. * gtk/gtkmenu.c (menu_change_screen): Forget the stored monitor_num. (gtk_menu_window_size_request): Remember the monitor_num.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkmenu.c8
-rw-r--r--gtk/gtkmenuitem.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 86e4deafe9..15ad9743f5 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -696,11 +696,8 @@ gtk_menu_window_size_request (GtkWidget *window,
{
GdkScreen *screen = gtk_widget_get_screen (window);
GdkRectangle monitor;
- gint monitor_num;
- monitor_num = gdk_screen_get_monitor_at_point (screen,
- private->x, private->y);
- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+ gdk_screen_get_monitor_geometry (screen, private->monitor_num, &monitor);
if (private->y + requisition->height > monitor.y + monitor.height)
requisition->height = monitor.y + monitor.height - private->y;
@@ -819,6 +816,8 @@ static void
menu_change_screen (GtkMenu *menu,
GdkScreen *new_screen)
{
+ GtkMenuPrivate *private = gtk_menu_get_private (menu);
+
if (menu->torn_off)
{
gtk_window_set_screen (GTK_WINDOW (menu->tearoff_window), new_screen);
@@ -826,6 +825,7 @@ menu_change_screen (GtkMenu *menu,
}
gtk_window_set_screen (GTK_WINDOW (menu->toplevel), new_screen);
+ private->monitor_num = -1;
}
static void
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index c3c41b2154..519fbab79f 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -1048,7 +1048,7 @@ gtk_menu_item_position_menu (GtkMenu *menu,
twidth = GTK_WIDGET (menu)->requisition.width;
theight = GTK_WIDGET (menu)->requisition.height;
- screen = gtk_widget_get_screen (widget);
+ screen = gtk_widget_get_screen (GTK_WIDGET (menu));
monitor_num = gdk_screen_get_monitor_at_window (screen, menu_item->event_window);
if (monitor_num < 0)
monitor_num = 0;