From 91d37680179bb74be77a3ad9c849b4e98bf03663 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 13 Aug 2003 20:45:37 +0000 Subject: [PATCH] Fix some places that weren't properly Xinerama-ified. Wed Aug 13 16:32:43 2003 Owen Taylor * gtk/gtkmenu.c (gtk_menu_position, gtk_menu_window_size_request): Fix some places that weren't properly Xinerama-ified. * gtk/gtkmenu.c: Fix problem with windows that scroll at the top of the screen. --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ ChangeLog.pre-2-4 | 8 ++++++++ ChangeLog.pre-2-6 | 8 ++++++++ ChangeLog.pre-2-8 | 8 ++++++++ gtk/gtkmenu.c | 39 +++++++++++++++++++++++---------------- 6 files changed, 63 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ccfa84b8e..b4a7e2cced 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Aug 13 16:32:43 2003 Owen Taylor + + * gtk/gtkmenu.c (gtk_menu_position, gtk_menu_window_size_request): + Fix some places that weren't properly Xinerama-ified. + + * gtk/gtkmenu.c: Fix problem with windows that scroll + at the top of the screen. + Wed Aug 13 11:34:53 2003 Owen Taylor * gtk/gtkcombo.c (gtk_combo_init): connect_after() to diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 6ccfa84b8e..b4a7e2cced 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +Wed Aug 13 16:32:43 2003 Owen Taylor + + * gtk/gtkmenu.c (gtk_menu_position, gtk_menu_window_size_request): + Fix some places that weren't properly Xinerama-ified. + + * gtk/gtkmenu.c: Fix problem with windows that scroll + at the top of the screen. + Wed Aug 13 11:34:53 2003 Owen Taylor * gtk/gtkcombo.c (gtk_combo_init): connect_after() to diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 6ccfa84b8e..b4a7e2cced 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +Wed Aug 13 16:32:43 2003 Owen Taylor + + * gtk/gtkmenu.c (gtk_menu_position, gtk_menu_window_size_request): + Fix some places that weren't properly Xinerama-ified. + + * gtk/gtkmenu.c: Fix problem with windows that scroll + at the top of the screen. + Wed Aug 13 11:34:53 2003 Owen Taylor * gtk/gtkcombo.c (gtk_combo_init): connect_after() to diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 6ccfa84b8e..b4a7e2cced 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +Wed Aug 13 16:32:43 2003 Owen Taylor + + * gtk/gtkmenu.c (gtk_menu_position, gtk_menu_window_size_request): + Fix some places that weren't properly Xinerama-ified. + + * gtk/gtkmenu.c: Fix problem with windows that scroll + at the top of the screen. + Wed Aug 13 11:34:53 2003 Owen Taylor * gtk/gtkcombo.c (gtk_combo_init): connect_after() to diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 6ccfa84b8e..b4a7e2cced 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +Wed Aug 13 16:32:43 2003 Owen Taylor + + * gtk/gtkmenu.c (gtk_menu_position, gtk_menu_window_size_request): + Fix some places that weren't properly Xinerama-ified. + + * gtk/gtkmenu.c: Fix problem with windows that scroll + at the top of the screen. + Wed Aug 13 11:34:53 2003 Owen Taylor * gtk/gtkcombo.c (gtk_combo_init): connect_after() to diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 81c518ea59..aff76d1275 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -505,10 +505,18 @@ gtk_menu_window_size_request (GtkWidget *window, if (private->have_position) { GdkScreen *screen = gtk_widget_get_screen (window); - gint screen_height = gdk_screen_get_height (screen); + 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); - if (private->y + requisition->height > screen_height) - requisition->height = screen_height - private->y; + if (private->y + requisition->height > monitor.y + monitor.height) + requisition->height = monitor.y + monitor.height - private->y; + + if (private->y < monitor.y) + requisition->height -= monitor.y - private->y; } } @@ -2878,7 +2886,7 @@ gtk_menu_position (GtkMenu *menu) if (y < monitor.y) { - scroll_offset -= y; + scroll_offset += monitor.y - y; y = monitor.y; } } @@ -2886,13 +2894,21 @@ gtk_menu_position (GtkMenu *menu) /* FIXME: should this be done in the various position_funcs ? */ x = CLAMP (x, monitor.x, MAX (monitor.x, monitor.x + monitor.width - requisition.width)); + if (GTK_MENU_SHELL (menu)->active) + { + private = gtk_menu_get_private (menu); + private->have_position = TRUE; + private->x = x; + private->y = y; + } + if (y + requisition.height > monitor.y + monitor.height) requisition.height = (monitor.y + monitor.height) - y; if (y < monitor.y) { - scroll_offset -= y; - requisition.height -= -y; + scroll_offset += monitor.y - y; + requisition.height -= monitor.y - y; y = monitor.y; } @@ -2902,16 +2918,7 @@ gtk_menu_position (GtkMenu *menu) gtk_window_move (GTK_WINDOW (GTK_MENU_SHELL (menu)->active ? menu->toplevel : menu->tearoff_window), x, y); - if (GTK_MENU_SHELL (menu)->active) - { - private = gtk_menu_get_private (menu); - private->have_position = TRUE; - private->x = x; - private->y = y; - - gtk_widget_queue_resize (menu->toplevel); - } - else + if (!GTK_MENU_SHELL (menu)->active) { gtk_window_resize (GTK_WINDOW (menu->tearoff_window), requisition.width, requisition.height);