changeset 2234:ba07fe36bfb4 trunk

[svn] - ensure that popup menus are always fully displayed
author giacomo
date Tue, 02 Jan 2007 17:28:38 -0800
parents 10aba78dc8eb
children 72d593e5d7e4
files ChangeLog audacious/ui_manager.c
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jan 02 16:56:11 2007 -0800
+++ b/ChangeLog	Tue Jan 02 17:28:38 2007 -0800
@@ -1,3 +1,10 @@
+2007-01-03 00:56:11 +0000  Giacomo Lozito <james@develia.org>
+  revision [3471]
+  - add missing header actions-mainwin.h
+  trunk/audacious/actions-mainwin.h |   83 ++++++++++++++++++++++++++++++++++++++
+  1 file changed, 83 insertions(+)
+
+
 2007-01-03 00:48:38 +0000  Giacomo Lozito <james@develia.org>
   revision [3469]
   - migration from gtkitemfactory to actions and uimanager; main menu has been ported, still much work and test to do
--- a/audacious/ui_manager.c	Tue Jan 02 16:56:11 2007 -0800
+++ b/audacious/ui_manager.c	Tue Jan 02 17:28:38 2007 -0800
@@ -418,8 +418,18 @@
 static void
 menu_popup_pos_func (GtkMenu * menu , gint * x , gint * y , gboolean * push_in , gint * point )
 {
-  *x = point[0];
-  *y = point[1];
+  GtkRequisition requisition;
+  gint screen_width;
+  gint screen_height;
+
+  gtk_widget_size_request(GTK_WIDGET(menu), &requisition);
+
+  screen_width = gdk_screen_width();
+  screen_height = gdk_screen_height();
+
+  *x = CLAMP(point[0] - 2, 0, MAX(0, screen_width - requisition.width));
+  *y = CLAMP(point[1] - 2, 0, MAX(0, screen_height - requisition.height));
+
   *push_in = FALSE;
 }