aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-04-11 05:54:04 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-04-11 05:54:04 +0800
commit1362afd4f588036acbc11877eb6b94e54ff7207d (patch)
tree754ff28a8d3641b571d38d52015dea219ed0eea0 /calendar/gui
parent3a05206cb1f740ea79e8f17dca4ab752f2eec5f4 (diff)
downloadgsoc2013-evolution-1362afd4f588036acbc11877eb6b94e54ff7207d.tar.gz
gsoc2013-evolution-1362afd4f588036acbc11877eb6b94e54ff7207d.tar.zst
gsoc2013-evolution-1362afd4f588036acbc11877eb6b94e54ff7207d.zip
added the allocation's X and Y position to the calculated coordinates.
2003-04-10 Rodrigo Moya <rodrigo@ximian.com> * gui/e-meeting-time-sel.c (e_meeting_time_selector_options_menu_position_callback): (e_meeting_time_selector_autopick_menu_position_callback): added the allocation's X and Y position to the calculated coordinates. svn path=/trunk/; revision=20809
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/e-meeting-time-sel.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index a2f06acb4c..e902d01f61 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -1438,12 +1438,22 @@ e_meeting_time_selector_options_menu_position_callback (GtkMenu *menu,
gpointer user_data)
{
EMeetingTimeSelector *mts;
+ GtkRequisition menu_requisition;
+ gint max_x, max_y;
mts = E_MEETING_TIME_SELECTOR (user_data);
/* Calculate our preferred position. */
- *x = mts->options_button->allocation.x;
- *y = mts->options_button->allocation.y + mts->options_button->allocation.height;
+ gdk_window_get_origin (mts->options_button->window, x, y);
+ *x += mts->options_button->allocation.x;
+ *y += mts->options_button->allocation.y + mts->options_button->allocation.height / 2 - 2;
+
+ /* Now make sure we are on the screen. */
+ gtk_widget_size_request (mts->options_menu, &menu_requisition);
+ max_x = MAX (0, gdk_screen_width () - menu_requisition.width);
+ max_y = MAX (0, gdk_screen_height () - menu_requisition.height);
+ *x = CLAMP (*x, 0, max_x);
+ *y = CLAMP (*y, 0, max_y);
}
static void
@@ -1477,12 +1487,22 @@ e_meeting_time_selector_autopick_menu_position_callback (GtkMenu *menu,
gpointer user_data)
{
EMeetingTimeSelector *mts;
+ GtkRequisition menu_requisition;
+ gint max_x, max_y;
mts = E_MEETING_TIME_SELECTOR (user_data);
/* Calculate our preferred position. */
- *x = mts->autopick_button->allocation.x;
- *y = mts->autopick_button->allocation.y + mts->autopick_button->allocation.height;
+ gdk_window_get_origin (mts->autopick_button->window, x, y);
+ *x += mts->autopick_button->allocation.x;
+ *y += mts->autopick_button->allocation.y + mts->autopick_button->allocation.height / 2 - 2;
+
+ /* Now make sure we are on the screen. */
+ gtk_widget_size_request (mts->autopick_menu, &menu_requisition);
+ max_x = MAX (0, gdk_screen_width () - menu_requisition.width);
+ max_y = MAX (0, gdk_screen_height () - menu_requisition.height);
+ *x = CLAMP (*x, 0, max_x);
+ *y = CLAMP (*y, 0, max_y);
}