diff options
Diffstat (limited to 'src/xmenu.c')
| -rw-r--r-- | src/xmenu.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index a7d47188ef5..e3f1a17fbce 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -627,7 +627,6 @@ update_frame_menubar (struct frame *f) | |||
| 627 | xg_update_frame_menubar (f); | 627 | xg_update_frame_menubar (f); |
| 628 | #else | 628 | #else |
| 629 | struct x_output *x; | 629 | struct x_output *x; |
| 630 | /** int columns, rows; **/ | ||
| 631 | 630 | ||
| 632 | eassert (FRAME_X_P (f)); | 631 | eassert (FRAME_X_P (f)); |
| 633 | 632 | ||
| @@ -637,10 +636,6 @@ update_frame_menubar (struct frame *f) | |||
| 637 | return; | 636 | return; |
| 638 | 637 | ||
| 639 | block_input (); | 638 | block_input (); |
| 640 | /* Save the size of the frame because the pane widget doesn't accept | ||
| 641 | to resize itself. So force it. */ | ||
| 642 | /** columns = FRAME_COLS (f); **/ | ||
| 643 | /** rows = FRAME_LINES (f); **/ | ||
| 644 | 639 | ||
| 645 | /* Do the voodoo which means "I'm changing lots of things, don't try | 640 | /* Do the voodoo which means "I'm changing lots of things, don't try |
| 646 | to refigure sizes until I'm done." */ | 641 | to refigure sizes until I'm done." */ |
| @@ -661,8 +656,7 @@ update_frame_menubar (struct frame *f) | |||
| 661 | XtManageChild (x->edit_widget); | 656 | XtManageChild (x->edit_widget); |
| 662 | lw_refigure_widget (x->column_widget, True); | 657 | lw_refigure_widget (x->column_widget, True); |
| 663 | 658 | ||
| 664 | /* Force the pane widget to resize itself with the right values. */ | 659 | /* Force the pane widget to resize itself. */ |
| 665 | /** EmacsFrameSetCharSize (x->edit_widget, columns, rows); **/ | ||
| 666 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 2, 0); | 660 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 2, 0); |
| 667 | unblock_input (); | 661 | unblock_input (); |
| 668 | #endif | 662 | #endif |
| @@ -2023,7 +2017,8 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 2023 | Window root; | 2017 | Window root; |
| 2024 | XMenu *menu; | 2018 | XMenu *menu; |
| 2025 | int pane, selidx, lpane, status; | 2019 | int pane, selidx, lpane, status; |
| 2026 | Lisp_Object entry, pane_prefix; | 2020 | Lisp_Object entry = Qnil; |
| 2021 | Lisp_Object pane_prefix; | ||
| 2027 | char *datap; | 2022 | char *datap; |
| 2028 | int ulx, uly, width, height; | 2023 | int ulx, uly, width, height; |
| 2029 | int dispwidth, dispheight; | 2024 | int dispwidth, dispheight; |
| @@ -2045,6 +2040,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 2045 | return Qnil; | 2040 | return Qnil; |
| 2046 | } | 2041 | } |
| 2047 | 2042 | ||
| 2043 | USE_SAFE_ALLOCA; | ||
| 2048 | block_input (); | 2044 | block_input (); |
| 2049 | 2045 | ||
| 2050 | /* Figure out which root window F is on. */ | 2046 | /* Figure out which root window F is on. */ |
| @@ -2057,8 +2053,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 2057 | if (menu == NULL) | 2053 | if (menu == NULL) |
| 2058 | { | 2054 | { |
| 2059 | *error_name = "Can't create menu"; | 2055 | *error_name = "Can't create menu"; |
| 2060 | unblock_input (); | 2056 | goto return_entry; |
| 2061 | return Qnil; | ||
| 2062 | } | 2057 | } |
| 2063 | 2058 | ||
| 2064 | /* Don't GC while we prepare and show the menu, | 2059 | /* Don't GC while we prepare and show the menu, |
| @@ -2101,8 +2096,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 2101 | { | 2096 | { |
| 2102 | XMenuDestroy (FRAME_X_DISPLAY (f), menu); | 2097 | XMenuDestroy (FRAME_X_DISPLAY (f), menu); |
| 2103 | *error_name = "Can't create pane"; | 2098 | *error_name = "Can't create pane"; |
| 2104 | unblock_input (); | 2099 | goto return_entry; |
| 2105 | return Qnil; | ||
| 2106 | } | 2100 | } |
| 2107 | i += MENU_ITEMS_PANE_LENGTH; | 2101 | i += MENU_ITEMS_PANE_LENGTH; |
| 2108 | 2102 | ||
| @@ -2146,9 +2140,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 2146 | 2140 | ||
| 2147 | if (!NILP (descrip)) | 2141 | if (!NILP (descrip)) |
| 2148 | { | 2142 | { |
| 2149 | /* if alloca is fast, use that to make the space, | 2143 | item_data = SAFE_ALLOCA (maxwidth + SBYTES (descrip) + 1); |
| 2150 | to reduce gc needs. */ | ||
| 2151 | item_data = alloca (maxwidth + SBYTES (descrip) + 1); | ||
| 2152 | memcpy (item_data, SSDATA (item_name), SBYTES (item_name)); | 2144 | memcpy (item_data, SSDATA (item_name), SBYTES (item_name)); |
| 2153 | for (j = SCHARS (item_name); j < maxwidth; j++) | 2145 | for (j = SCHARS (item_name); j < maxwidth; j++) |
| 2154 | item_data[j] = ' '; | 2146 | item_data[j] = ' '; |
| @@ -2166,8 +2158,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 2166 | { | 2158 | { |
| 2167 | XMenuDestroy (FRAME_X_DISPLAY (f), menu); | 2159 | XMenuDestroy (FRAME_X_DISPLAY (f), menu); |
| 2168 | *error_name = "Can't add selection to menu"; | 2160 | *error_name = "Can't add selection to menu"; |
| 2169 | unblock_input (); | 2161 | goto return_entry; |
| 2170 | return Qnil; | ||
| 2171 | } | 2162 | } |
| 2172 | i += MENU_ITEMS_ITEM_LENGTH; | 2163 | i += MENU_ITEMS_ITEM_LENGTH; |
| 2173 | lines++; | 2164 | lines++; |
| @@ -2241,7 +2232,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 2241 | status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx, | 2232 | status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx, |
| 2242 | x, y, ButtonReleaseMask, &datap, | 2233 | x, y, ButtonReleaseMask, &datap, |
| 2243 | menu_help_callback); | 2234 | menu_help_callback); |
| 2244 | entry = pane_prefix = Qnil; | 2235 | pane_prefix = Qnil; |
| 2245 | 2236 | ||
| 2246 | switch (status) | 2237 | switch (status) |
| 2247 | { | 2238 | { |
| @@ -2300,10 +2291,10 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 2300 | break; | 2291 | break; |
| 2301 | } | 2292 | } |
| 2302 | 2293 | ||
| 2294 | return_entry: | ||
| 2303 | unblock_input (); | 2295 | unblock_input (); |
| 2304 | unbind_to (specpdl_count, Qnil); | 2296 | SAFE_FREE (); |
| 2305 | 2297 | return unbind_to (specpdl_count, entry); | |
| 2306 | return entry; | ||
| 2307 | } | 2298 | } |
| 2308 | 2299 | ||
| 2309 | #endif /* not USE_X_TOOLKIT */ | 2300 | #endif /* not USE_X_TOOLKIT */ |