diff options
| author | Jan Djärv | 2004-12-07 13:11:59 +0000 |
|---|---|---|
| committer | Jan Djärv | 2004-12-07 13:11:59 +0000 |
| commit | 453a4f1b8a46822a9f56dc733fefeca5999ea90b (patch) | |
| tree | 4cbc8bbfd17a9897cd9559980da3b5ccf59c09fd /src | |
| parent | 8dad6f6234570af56cf88a87b9de63c217e60092 (diff) | |
| download | emacs-453a4f1b8a46822a9f56dc733fefeca5999ea90b.tar.gz emacs-453a4f1b8a46822a9f56dc733fefeca5999ea90b.zip | |
* xmenu.c (Fx_popup_menu): Correct documentation about position.
(xmenu_show): Do not call XTranslateCoordinates. Adjust position
if not given by a mouse click to correspond with x-popup-menu
documentation.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xmenu.c | 48 |
2 files changed, 24 insertions, 29 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ae14af117da..3064999717f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2004-12-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 1 | 2004-12-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 2 | ||
| 3 | * xmenu.c (Fx_popup_menu): Correct documentation about position. | ||
| 4 | (xmenu_show): Do not call XTranslateCoordinates. Adjust position | ||
| 5 | if not given by a mouse click to correspond with x-popup-menu | ||
| 6 | documentation. | ||
| 7 | |||
| 3 | * config.in: Regenerate. | 8 | * config.in: Regenerate. |
| 4 | 9 | ||
| 5 | * gtkutil.c: Include signal.h and syssignal.h. | 10 | * gtkutil.c: Include signal.h and syssignal.h. |
diff --git a/src/xmenu.c b/src/xmenu.c index 6f990bd11b1..ff012634b50 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -741,8 +741,7 @@ POSITION is a position specification. This is either a mouse button event | |||
| 741 | or a list ((XOFFSET YOFFSET) WINDOW) | 741 | or a list ((XOFFSET YOFFSET) WINDOW) |
| 742 | where XOFFSET and YOFFSET are positions in pixels from the top left | 742 | where XOFFSET and YOFFSET are positions in pixels from the top left |
| 743 | corner of WINDOW's frame. (WINDOW may be a frame object instead of a window.) | 743 | corner of WINDOW's frame. (WINDOW may be a frame object instead of a window.) |
| 744 | This controls the position of the center of the first line | 744 | This controls the position of the top left of the menu as a whole. |
| 745 | in the first pane of the menu, not the top left of the menu as a whole. | ||
| 746 | If POSITION is t, it means to use the current mouse position. | 745 | If POSITION is t, it means to use the current mouse position. |
| 747 | 746 | ||
| 748 | MENU is a specifier for a menu. For the simplest case, MENU is a keymap. | 747 | MENU is a specifier for a menu. For the simplest case, MENU is a keymap. |
| @@ -3256,7 +3255,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 3256 | char *datap; | 3255 | char *datap; |
| 3257 | int ulx, uly, width, height; | 3256 | int ulx, uly, width, height; |
| 3258 | int dispwidth, dispheight; | 3257 | int dispwidth, dispheight; |
| 3259 | int i, j; | 3258 | int i, j, lines, maxlines; |
| 3260 | int maxwidth; | 3259 | int maxwidth; |
| 3261 | int dummy_int; | 3260 | int dummy_int; |
| 3262 | unsigned int dummy_uint; | 3261 | unsigned int dummy_uint; |
| @@ -3287,31 +3286,8 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 3287 | 3286 | ||
| 3288 | #ifdef HAVE_X_WINDOWS | 3287 | #ifdef HAVE_X_WINDOWS |
| 3289 | /* Adjust coordinates to relative to the outer (window manager) window. */ | 3288 | /* Adjust coordinates to relative to the outer (window manager) window. */ |
| 3290 | { | 3289 | x += FRAME_OUTER_TO_INNER_DIFF_X (f); |
| 3291 | Window child; | 3290 | y += FRAME_OUTER_TO_INNER_DIFF_Y (f); |
| 3292 | int win_x = 0, win_y = 0; | ||
| 3293 | |||
| 3294 | /* Find the position of the outside upper-left corner of | ||
| 3295 | the inner window, with respect to the outer window. */ | ||
| 3296 | if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window) | ||
| 3297 | { | ||
| 3298 | BLOCK_INPUT; | ||
| 3299 | XTranslateCoordinates (FRAME_X_DISPLAY (f), | ||
| 3300 | |||
| 3301 | /* From-window, to-window. */ | ||
| 3302 | f->output_data.x->window_desc, | ||
| 3303 | f->output_data.x->parent_desc, | ||
| 3304 | |||
| 3305 | /* From-position, to-position. */ | ||
| 3306 | 0, 0, &win_x, &win_y, | ||
| 3307 | |||
| 3308 | /* Child of window. */ | ||
| 3309 | &child); | ||
| 3310 | UNBLOCK_INPUT; | ||
| 3311 | x += win_x; | ||
| 3312 | y += win_y; | ||
| 3313 | } | ||
| 3314 | } | ||
| 3315 | #endif /* HAVE_X_WINDOWS */ | 3291 | #endif /* HAVE_X_WINDOWS */ |
| 3316 | 3292 | ||
| 3317 | /* Adjust coordinates to be root-window-relative. */ | 3293 | /* Adjust coordinates to be root-window-relative. */ |
| @@ -3319,7 +3295,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 3319 | y += f->top_pos; | 3295 | y += f->top_pos; |
| 3320 | 3296 | ||
| 3321 | /* Create all the necessary panes and their items. */ | 3297 | /* Create all the necessary panes and their items. */ |
| 3322 | i = 0; | 3298 | maxlines = lines = i = 0; |
| 3323 | while (i < menu_items_used) | 3299 | while (i < menu_items_used) |
| 3324 | { | 3300 | { |
| 3325 | if (EQ (XVECTOR (menu_items)->contents[i], Qt)) | 3301 | if (EQ (XVECTOR (menu_items)->contents[i], Qt)) |
| @@ -3328,6 +3304,8 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 3328 | Lisp_Object pane_name, prefix; | 3304 | Lisp_Object pane_name, prefix; |
| 3329 | char *pane_string; | 3305 | char *pane_string; |
| 3330 | 3306 | ||
| 3307 | maxlines = max (maxlines, lines); | ||
| 3308 | lines = 0; | ||
| 3331 | pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; | 3309 | pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; |
| 3332 | prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; | 3310 | prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; |
| 3333 | pane_string = (NILP (pane_name) | 3311 | pane_string = (NILP (pane_name) |
| @@ -3420,9 +3398,12 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 3420 | return Qnil; | 3398 | return Qnil; |
| 3421 | } | 3399 | } |
| 3422 | i += MENU_ITEMS_ITEM_LENGTH; | 3400 | i += MENU_ITEMS_ITEM_LENGTH; |
| 3401 | lines++; | ||
| 3423 | } | 3402 | } |
| 3424 | } | 3403 | } |
| 3425 | 3404 | ||
| 3405 | maxlines = max (maxlines, lines); | ||
| 3406 | |||
| 3426 | /* All set and ready to fly. */ | 3407 | /* All set and ready to fly. */ |
| 3427 | XMenuRecompute (FRAME_X_DISPLAY (f), menu); | 3408 | XMenuRecompute (FRAME_X_DISPLAY (f), menu); |
| 3428 | dispwidth = DisplayWidth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)); | 3409 | dispwidth = DisplayWidth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)); |
| @@ -3446,6 +3427,15 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 3446 | if (ulx < 0) x -= ulx; | 3427 | if (ulx < 0) x -= ulx; |
| 3447 | if (uly < 0) y -= uly; | 3428 | if (uly < 0) y -= uly; |
| 3448 | 3429 | ||
| 3430 | if (! for_click) | ||
| 3431 | { | ||
| 3432 | /* If position was not given by a mouse click, adjust so upper left | ||
| 3433 | corner of the menu as a whole ends up at given coordinates. This | ||
| 3434 | is what x-popup-menu says in its documentation. */ | ||
| 3435 | x += width/2; | ||
| 3436 | y += 1.5*height/(maxlines+2); | ||
| 3437 | } | ||
| 3438 | |||
| 3449 | XMenuSetAEQ (menu, TRUE); | 3439 | XMenuSetAEQ (menu, TRUE); |
| 3450 | XMenuSetFreeze (menu, TRUE); | 3440 | XMenuSetFreeze (menu, TRUE); |
| 3451 | pane = selidx = 0; | 3441 | pane = selidx = 0; |