diff options
| author | Jan Djärv | 2003-02-08 11:18:32 +0000 |
|---|---|---|
| committer | Jan Djärv | 2003-02-08 11:18:32 +0000 |
| commit | 7b76ca1c43fcaa58bf2c7c3503c8f33399eab8eb (patch) | |
| tree | 49d7e7cb08c701db988a1cda2304040439674921 /src/xmenu.c | |
| parent | fea8973a15f90e36abfe4b6c40d520161b0ea1b8 (diff) | |
| download | emacs-7b76ca1c43fcaa58bf2c7c3503c8f33399eab8eb.tar.gz emacs-7b76ca1c43fcaa58bf2c7c3503c8f33399eab8eb.zip | |
xterm.c (x_make_frame_visible): Call gtk_window_deiconify.
xmenu.c (menu_position_func): Adjust menu popup position so that
the menu is fully visible.
Diffstat (limited to 'src/xmenu.c')
| -rw-r--r-- | src/xmenu.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index 2709a7641dd..6c289c45316 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -2241,6 +2241,7 @@ static Lisp_Object *volatile menu_item_selection; | |||
| 2241 | create_and_show_popup_menu below. */ | 2241 | create_and_show_popup_menu below. */ |
| 2242 | struct next_popup_x_y | 2242 | struct next_popup_x_y |
| 2243 | { | 2243 | { |
| 2244 | FRAME_PTR f; | ||
| 2244 | int x; | 2245 | int x; |
| 2245 | int y; | 2246 | int y; |
| 2246 | }; | 2247 | }; |
| @@ -2252,7 +2253,7 @@ struct next_popup_x_y | |||
| 2252 | PUSH_IN is not documented in the GTK manual. | 2253 | PUSH_IN is not documented in the GTK manual. |
| 2253 | USER_DATA is any data passed in when calling gtk_menu_popup. | 2254 | USER_DATA is any data passed in when calling gtk_menu_popup. |
| 2254 | Here it points to a struct next_popup_x_y where the coordinates | 2255 | Here it points to a struct next_popup_x_y where the coordinates |
| 2255 | to store in *X and *Y are. | 2256 | to store in *X and *Y are as well as the frame for the popup. |
| 2256 | 2257 | ||
| 2257 | Here only X and Y are used. */ | 2258 | Here only X and Y are used. */ |
| 2258 | static void | 2259 | static void |
| @@ -2263,8 +2264,21 @@ menu_position_func (menu, x, y, push_in, user_data) | |||
| 2263 | gboolean *push_in; | 2264 | gboolean *push_in; |
| 2264 | gpointer user_data; | 2265 | gpointer user_data; |
| 2265 | { | 2266 | { |
| 2266 | *x = ((struct next_popup_x_y*)user_data)->x; | 2267 | struct next_popup_x_y* data = (struct next_popup_x_y*)user_data; |
| 2267 | *y = ((struct next_popup_x_y*)user_data)->y; | 2268 | GtkRequisition req; |
| 2269 | int disp_width = FRAME_X_DISPLAY_INFO (data->f)->width; | ||
| 2270 | int disp_height = FRAME_X_DISPLAY_INFO (data->f)->height; | ||
| 2271 | |||
| 2272 | *x = data->x; | ||
| 2273 | *y = data->y; | ||
| 2274 | |||
| 2275 | /* Check if there is room for the menu. If not, adjust x/y so that | ||
| 2276 | the menu is fully visible. */ | ||
| 2277 | gtk_widget_size_request (GTK_WIDGET (menu), &req); | ||
| 2278 | if (data->x + req.width > disp_width) | ||
| 2279 | *x -= data->x + req.width - disp_width; | ||
| 2280 | if (data->y + req.height > disp_height) | ||
| 2281 | *y -= data->y + req.height - disp_height; | ||
| 2268 | } | 2282 | } |
| 2269 | 2283 | ||
| 2270 | static void | 2284 | static void |
| @@ -2316,6 +2330,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) | |||
| 2316 | 2330 | ||
| 2317 | popup_x_y.x = x; | 2331 | popup_x_y.x = x; |
| 2318 | popup_x_y.y = y; | 2332 | popup_x_y.y = y; |
| 2333 | popup_x_y.f = f; | ||
| 2319 | } | 2334 | } |
| 2320 | 2335 | ||
| 2321 | /* Display the menu. */ | 2336 | /* Display the menu. */ |