diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2012-03-26 05:41:49 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2012-03-26 05:41:49 +0000 |
commit | c0e22aef9eecfddde486a62a4d366edd45d86d00 (patch) | |
tree | da055d82ef1c632429fda4a701fb4ce3161085cc /src/menu.c | |
parent | 7eba3af6a0470bf25ec360cc714c1ffd75cb3e7d (diff) |
src/folderview.c: enabled menu popup with Menu key.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3029 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/menu.c')
-rw-r--r-- | src/menu.c | 41 |
1 files changed, 40 insertions, 1 deletions
@@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2004 Hiroyuki Yamamoto + * Copyright (C) 1999-2012 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -222,6 +222,45 @@ void menu_button_position(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, *y = ypos; } +void menu_widget_position(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, + gpointer user_data) +{ + GtkWidget *widget; + GtkRequisition requisition; + gint w_xpos, w_ypos; + gint xpos, ypos; + gint width, height; + gint scr_width, scr_height; + + g_return_if_fail(x != NULL && y != NULL && push_in != NULL); + + widget = GTK_WIDGET(user_data); + + gtk_widget_get_child_requisition(GTK_WIDGET(menu), &requisition); + width = requisition.width; + height = requisition.height; + gdk_window_get_origin(widget->window, &w_xpos, &w_ypos); + + xpos = w_xpos; + ypos = w_ypos; + + scr_width = gdk_screen_width(); + scr_height = gdk_screen_height(); + + if (xpos + width > scr_width) + xpos -= (xpos + width) - scr_width; + if (ypos + height > scr_height) + ypos -= height; + if (xpos < 0) + xpos = 0; + if (ypos < 0) + ypos = 0; + + *x = xpos; + *y = ypos; + *push_in = FALSE; +} + gint menu_find_option_menu_index(GtkOptionMenu *optmenu, gpointer data, GCompareFunc func) { |