------------------------------------------------------------ revno: 117256 committer: Eli Zaretskii branch nick: trunk timestamp: Wed 2014-06-04 10:54:16 +0300 message: Fix TTY menus on MS-Windows broken by last commit. src/w32console.c (initialize_w32_display): Set the console menu_show_hook, otherwise TTY menus on w32 crash and burn. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-04 04:58:31 +0000 +++ src/ChangeLog 2014-06-04 07:54:16 +0000 @@ -1,3 +1,8 @@ +2014-06-04 Eli Zaretskii + + * w32console.c (initialize_w32_display): Set the console + menu_show_hook, otherwise TTY menus are broken on w32. + 2014-06-04 Dmitry Antipov Use terminal-specific hooks to display menus. === modified file 'src/w32console.c' --- src/w32console.c 2014-01-01 07:43:34 +0000 +++ src/w32console.c 2014-06-04 07:54:16 +0000 @@ -36,8 +36,9 @@ #include "termhooks.h" #include "termchar.h" #include "dispextern.h" +#include "menu.h" /* for tty_menu_show */ #include "w32term.h" -#include "w32common.h" /* for os_subtype */ +#include "w32common.h" /* for os_subtype */ #include "w32inevt.h" /* from window.c */ @@ -650,6 +651,7 @@ term->read_socket_hook = w32_console_read_socket; term->mouse_position_hook = w32_console_mouse_position; + term->menu_show_hook = tty_menu_show; /* The following are not used on the console. */ term->frame_rehighlight_hook = 0; ------------------------------------------------------------ revno: 117255 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2014-06-04 08:58:31 +0400 message: Use terminal-specific hooks to display menus. * termhooks.h (struct terminal): New field menu_show_hook. * menu.h (): Bit flags for menu hooks. (x_menu_show, w32_menu_show, ns_menu_show, tty_menu_show): Adjust prototypes. * menu.c (Fx_popup_menu): Use bit flags and menu_show_hook. * nsmenu.m (ns_menu_show): * w32menu.c (w32_menu_show): * xmenu.c (x_menu_show): * term.c (tty_menu_show): Adjust to use bit flags. (set_tty_hooks): Set menu_show_hook. * xterm.c (x_create_terminal): * nsterm.m (ns_create_terminal): * msdos.c (initialize_msdos_display): * w32term.c (w32_create_terminal): Likewise. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-03 22:13:17 +0000 +++ src/ChangeLog 2014-06-04 04:58:31 +0000 @@ -1,3 +1,21 @@ +2014-06-04 Dmitry Antipov + + Use terminal-specific hooks to display menus. + * termhooks.h (struct terminal): New field menu_show_hook. + * menu.h (): Bit flags for menu hooks. + (x_menu_show, w32_menu_show, ns_menu_show, tty_menu_show): + Adjust prototypes. + * menu.c (Fx_popup_menu): Use bit flags and menu_show_hook. + * nsmenu.m (ns_menu_show): + * w32menu.c (w32_menu_show): + * xmenu.c (x_menu_show): + * term.c (tty_menu_show): Adjust to use bit flags. + (set_tty_hooks): Set menu_show_hook. + * xterm.c (x_create_terminal): + * nsterm.m (ns_create_terminal): + * msdos.c (initialize_msdos_display): + * w32term.c (w32_create_terminal): Likewise. + 2014-06-03 Juanma Barranquero * w32heap.c (DUMPED_HEAP_SIZE) [!_WIN64]: Reduce to 11 MB. === modified file 'src/menu.c' --- src/menu.c 2014-06-02 18:01:21 +0000 +++ src/menu.c 2014-06-04 04:58:31 +0000 @@ -1161,9 +1161,7 @@ Lisp_Object selection = Qnil; struct frame *f = NULL; Lisp_Object x, y, window; - bool keymaps = 0; - bool for_click = 0; - bool kbd_menu_navigation = 0; + int menuflags = 0; ptrdiff_t specpdl_count = SPECPDL_INDEX (); struct gcpro gcpro1; @@ -1193,12 +1191,12 @@ } else { - for_click = 1; + menuflags |= MENU_FOR_CLICK; tem = Fcar (Fcdr (position)); /* EVENT_START (position) */ window = Fcar (tem); /* POSN_WINDOW (tem) */ tem2 = Fcar (Fcdr (tem)); /* POSN_POSN (tem) */ - /* The kbd_menu_navigation flag is set when the menu was - invoked by F10, which probably means they have no + /* The MENU_KBD_NAVIGATION field is set when the menu + was invoked by F10, which probably means they have no mouse. In that case, we let them switch between top-level menu-bar menus by using C-f/C-b and horizontal arrow keys, since they cannot click the @@ -1211,7 +1209,7 @@ if (!EQ (POSN_POSN (last_nonmenu_event), POSN_POSN (position)) && CONSP (tem2) && EQ (Fcar (tem2), Qmenu_bar)) - kbd_menu_navigation = 1; + menuflags |= MENU_KBD_NAVIGATION; tem = Fcar (Fcdr (Fcdr (tem))); /* POSN_WINDOW_POSN (tem) */ x = Fcar (tem); y = Fcdr (tem); @@ -1340,7 +1338,7 @@ if (!NILP (prompt) && menu_items_n_panes >= 0) ASET (menu_items, MENU_ITEMS_PANE_NAME, prompt); - keymaps = 1; + menuflags |= MENU_KEYMAPS; } else if (CONSP (menu) && KEYMAPP (XCAR (menu))) { @@ -1373,7 +1371,7 @@ if (!NILP (title) && menu_items_n_panes >= 0) ASET (menu_items, MENU_ITEMS_PANE_NAME, title); - keymaps = 1; + menuflags |= MENU_KEYMAPS; SAFE_FREE (); } @@ -1385,7 +1383,7 @@ list_of_panes (Fcdr (menu)); - keymaps = 0; + menuflags &= ~MENU_KEYMAPS; } unbind_to (specpdl_count, Qnil); @@ -1416,39 +1414,8 @@ #endif /* Display them in a menu. */ - - /* FIXME: Use a terminal hook! */ -#if defined HAVE_NTGUI - if (FRAME_W32_P (f)) - selection = w32_menu_show (f, xpos, ypos, for_click, - keymaps, title, &error_name); - else -#endif -#if defined HAVE_NS - if (FRAME_NS_P (f)) - selection = ns_menu_show (f, xpos, ypos, for_click, - keymaps, title, &error_name); - else -#endif -#if (defined (HAVE_X_WINDOWS) || defined (MSDOS)) - if (FRAME_X_P (f) || FRAME_MSDOS_P (f)) - selection = xmenu_show (f, xpos, ypos, for_click, - keymaps, title, &error_name); - else -#endif -#ifndef MSDOS - if (FRAME_TERMCAP_P (f)) - { - ptrdiff_t count1 = SPECPDL_INDEX (); - - /* Avoid crashes if, e.g., another client will connect while we - are in a menu. */ - temporarily_switch_to_single_kboard (f); - selection = tty_menu_show (f, xpos, ypos, for_click, keymaps, title, - kbd_menu_navigation, &error_name); - unbind_to (count1, Qnil); - } -#endif + selection = FRAME_TERMINAL (f)->menu_show_hook (f, xpos, ypos, menuflags, + title, &error_name); #ifdef HAVE_NS unbind_to (specpdl_count, Qnil); === modified file 'src/menu.h' --- src/menu.h 2014-06-03 19:59:55 +0000 +++ src/menu.h 2014-06-04 04:58:31 +0000 @@ -26,6 +26,14 @@ extern Lisp_Object Qunsupported__w32_dialog; #endif +/* Bit fields used by terminal-specific menu_show_hook. */ + +enum { + MENU_KEYMAPS = 0x1, + MENU_FOR_CLICK = 0x2, + MENU_KBD_NAVIGATION = 0x4 +}; + extern void x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval); @@ -49,14 +57,19 @@ #ifdef HAVE_X_WINDOWS extern void mouse_position_for_popup (struct frame *f, int *x, int *y); #endif - -extern Lisp_Object w32_menu_show (struct frame *, int, int, int, int, +#if defined (HAVE_X_WINDOWS) || defined (MSDOS) +extern Lisp_Object x_menu_show (struct frame *, int, int, int, + Lisp_Object, const char **); +#endif +#ifdef HAVE_NTGUI +extern Lisp_Object w32_menu_show (struct frame *, int, int, int, Lisp_Object, const char **); -extern Lisp_Object ns_menu_show (struct frame *, int, int, bool, bool, +#endif +#ifdef HAVE_NS +extern Lisp_Object ns_menu_show (struct frame *, int, int, int, Lisp_Object, const char **); -extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool, - Lisp_Object, const char **); -extern Lisp_Object tty_menu_show (struct frame *, int, int, bool, bool, - Lisp_Object, bool, const char **); +#endif +extern Lisp_Object tty_menu_show (struct frame *, int, int, int, + Lisp_Object, const char **); extern ptrdiff_t menu_item_width (const unsigned char *); #endif /* MENU_H */ === modified file 'src/msdos.c' --- src/msdos.c 2014-04-16 19:43:46 +0000 +++ src/msdos.c 2014-06-04 04:58:31 +0000 @@ -1863,6 +1863,7 @@ term->update_end_hook = IT_update_end; term->frame_up_to_date_hook = IT_frame_up_to_date; term->mouse_position_hook = 0; /* set later by dos_ttraw */ + term->menu_show_hook = x_menu_show; term->frame_rehighlight_hook = 0; term->frame_raise_lower_hook = 0; term->set_vertical_scroll_bar_hook = 0; === modified file 'src/nsmenu.m' --- src/nsmenu.m 2014-06-03 19:59:55 +0000 +++ src/nsmenu.m 2014-06-04 04:58:31 +0000 @@ -812,7 +812,7 @@ ========================================================================== */ Lisp_Object -ns_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, +ns_menu_show (struct frame *f, int x, int y, int menuflags, Lisp_Object title, const char **error) { EmacsMenu *pmenu; @@ -820,6 +820,7 @@ Lisp_Object tem; ptrdiff_t specpdl_count = SPECPDL_INDEX (); widget_value *wv, *first_wv = 0; + bool keymaps = (menuflags & MENU_KEYMAPS); block_input (); === modified file 'src/nsterm.m' --- src/nsterm.m 2014-05-28 13:53:22 +0000 +++ src/nsterm.m 2014-06-04 04:58:31 +0000 @@ -54,7 +54,7 @@ #include "termhooks.h" #include "termchar.h" - +#include "menu.h" #include "window.h" #include "keyboard.h" #include "buffer.h" @@ -4164,6 +4164,7 @@ terminal->frame_rehighlight_hook = ns_frame_rehighlight; terminal->frame_raise_lower_hook = ns_frame_raise_lower; terminal->fullscreen_hook = ns_fullscreen_hook; + terminal->menu_show_hook = ns_menu_show; terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars; terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar; === modified file 'src/term.c' --- src/term.c 2014-05-14 13:55:37 +0000 +++ src/term.c 2014-06-04 04:58:31 +0000 @@ -3583,8 +3583,8 @@ } Lisp_Object -tty_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, - Lisp_Object title, bool kbd_navigation, const char **error_name) +tty_menu_show (struct frame *f, int x, int y, int menuflags, + Lisp_Object title, const char **error_name) { tty_menu *menu; int pane, selidx, lpane, status; @@ -3621,6 +3621,10 @@ menu functions pointers to the contents of strings. */ specpdl_count = inhibit_garbage_collection (); + /* Avoid crashes if, e.g., another client will connect while we + are in a menu. */ + temporarily_switch_to_single_kboard (f); + /* Adjust coordinates to be root-window-relative. */ item_x = x += f->left_pos; item_y = y += f->top_pos; @@ -3642,7 +3646,7 @@ prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); pane_string = (NILP (pane_name) ? "" : SSDATA (pane_name)); - if (keymaps && !NILP (prefix)) + if ((menuflags & MENU_KEYMAPS) && !NILP (prefix)) pane_string++; lpane = tty_menu_add_pane (menu, pane_string); @@ -3782,7 +3786,8 @@ specbind (Qoverriding_terminal_local_map, Fsymbol_value (Qtty_menu_navigation_map)); status = tty_menu_activate (menu, &pane, &selidx, x, y, &datap, - tty_menu_help_callback, kbd_navigation); + tty_menu_help_callback, + menuflags & MENU_KBD_NAVIGATION); entry = pane_prefix = Qnil; switch (status) @@ -3808,7 +3813,7 @@ { entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); - if (keymaps != 0) + if (menuflags & MENU_KEYMAPS) { entry = Fcons (entry, Qnil); if (!NILP (pane_prefix)) @@ -3841,7 +3846,7 @@ Ftop_level (); /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means the menu was invoked with a mouse event as POSITION). */ - if (! for_click) + if (!(menuflags & MENU_FOR_CLICK)) Fsignal (Qquit, Qnil); break; } @@ -3922,6 +3927,7 @@ terminal->frame_rehighlight_hook = 0; terminal->frame_raise_lower_hook = 0; terminal->fullscreen_hook = 0; + terminal->menu_show_hook = 0; terminal->set_vertical_scroll_bar_hook = 0; terminal->condemn_scroll_bars_hook = 0; terminal->redeem_scroll_bar_hook = 0; @@ -3953,6 +3959,7 @@ terminal->reset_terminal_modes_hook = &tty_reset_terminal_modes; terminal->set_terminal_modes_hook = &tty_set_terminal_modes; terminal->update_end_hook = &tty_update_end; + terminal->menu_show_hook = &tty_menu_show; terminal->set_terminal_window_hook = &tty_set_terminal_window; terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */ terminal->delete_frame_hook = &tty_free_frame_resources; === modified file 'src/termhooks.h' --- src/termhooks.h 2014-05-14 13:55:37 +0000 +++ src/termhooks.h 2014-06-04 04:58:31 +0000 @@ -478,7 +478,10 @@ may do something OS dependent, like extended window manager hints on X11. */ void (*fullscreen_hook) (struct frame *f); - + /* This hook is called to display menus. */ + Lisp_Object (*menu_show_hook) (struct frame *f, int x, int y, int menuflags, + Lisp_Object title, const char **error_name); + /* Scroll bar hooks. */ /* The representation of scroll bars is determined by the code which === modified file 'src/w32menu.c' --- src/w32menu.c 2014-06-03 06:51:18 +0000 +++ src/w32menu.c 2014-06-04 04:58:31 +0000 @@ -549,8 +549,9 @@ /* F is the frame the menu is for. X and Y are the frame-relative specified position, relative to the inside upper left corner of the frame F. - FOR_CLICK is nonzero if this menu was invoked for a mouse click. - KEYMAPS is 1 if this menu was specified with keymaps; + Bitfield MENUFLAGS bits are: + MENU_FOR_CLICK is set if this menu was invoked for a mouse click. + MENU_KEYMAPS is set if this menu was specified with keymaps; in that case, we return a list containing the chosen item's value and perhaps also the pane's prefix. TITLE is the specified menu title. @@ -558,7 +559,7 @@ (We return nil on failure, but the value doesn't actually matter.) */ Lisp_Object -w32_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, +w32_menu_show (struct frame *f, int x, int y, int menuflags, Lisp_Object title, const char **error) { int i; @@ -647,14 +648,14 @@ /* If the pane has a meaningful name, make the pane a top-level menu item with its items as a submenu beneath it. */ - if (!keymaps && strcmp (pane_string, "")) + if (!(menuflags & MENU_KEYMAPS) && strcmp (pane_string, "")) { wv = make_widget_value (pane_string, NULL, true, Qnil); if (save_wv) save_wv->next = wv; else first_wv->contents = wv; - if (keymaps && !NILP (prefix)) + if ((menuflags & MENU_KEYMAPS) && !NILP (prefix)) wv->name++; wv->button_type = BUTTON_TYPE_NONE; save_wv = wv; @@ -811,10 +812,10 @@ i += 1; else { - entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); + entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); if (menu_item_selection == i) { - if (keymaps != 0) + if (menuflags & MENU_KEYMAPS) { int j; @@ -832,7 +833,7 @@ } } } - else if (!for_click) + else if (!(menuflags & MENU_FOR_CLICK)) { unblock_input (); /* Make "Cancel" equivalent to C-g. */ === modified file 'src/w32term.c' --- src/w32term.c 2014-05-28 13:53:22 +0000 +++ src/w32term.c 2014-06-04 04:58:31 +0000 @@ -50,6 +50,7 @@ #include "process.h" #include "atimer.h" #include "keymap.h" +#include "menu.h" #ifdef WINDOWSNT #include "w32.h" /* for filename_from_utf16, filename_from_ansi */ @@ -6272,6 +6273,7 @@ terminal->frame_rehighlight_hook = w32_frame_rehighlight; terminal->frame_raise_lower_hook = w32_frame_raise_lower; terminal->fullscreen_hook = w32fullscreen_hook; + terminal->menu_show_hook = w32_menu_show; terminal->set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar; terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars; terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar; === modified file 'src/xmenu.c' --- src/xmenu.c 2014-06-02 18:01:21 +0000 +++ src/xmenu.c 2014-06-04 04:58:31 +0000 @@ -179,7 +179,7 @@ unblock_input (); - /* xmenu_show expects window coordinates, not root window + /* x_menu_show expects window coordinates, not root window coordinates. Translate. */ *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f); *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f); @@ -1158,16 +1158,17 @@ #endif /* USE_X_TOOLKIT || USE_GTK */ -/* xmenu_show actually displays a menu using the panes and items in menu_items +/* x_menu_show actually displays a menu using the panes and items in menu_items and returns the value selected from it. - There are two versions of xmenu_show, one for Xt and one for Xlib. + There are two versions of x_menu_show, one for Xt and one for Xlib. Both assume input is blocked by the caller. */ /* F is the frame the menu is for. X and Y are the frame-relative specified position, relative to the inside upper left corner of the frame F. - FOR_CLICK is true if this menu was invoked for a mouse click. - KEYMAPS is true if this menu was specified with keymaps; + Bitfield MENUFLAGS bits are: + MENU_FOR_CLICK is set if this menu was invoked for a mouse click. + MENU_KEYMAPS is set if this menu was specified with keymaps; in that case, we return a list containing the chosen item's value and perhaps also the pane's prefix. TITLE is the specified menu title. @@ -1433,8 +1434,8 @@ } Lisp_Object -xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, - Lisp_Object title, const char **error_name) +x_menu_show (struct frame *f, int x, int y, int menuflags, + Lisp_Object title, const char **error_name) { int i; widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; @@ -1519,14 +1520,14 @@ /* If the pane has a meaningful name, make the pane a top-level menu item with its items as a submenu beneath it. */ - if (!keymaps && strcmp (pane_string, "")) + if (!(menuflags & MENU_KEYMAPS) && strcmp (pane_string, "")) { wv = make_widget_value (pane_string, NULL, true, Qnil); if (save_wv) save_wv->next = wv; else first_wv->contents = wv; - if (keymaps && !NILP (prefix)) + if ((menuflags & MENU_KEYMAPS) && !NILP (prefix)) wv->name++; wv->button_type = BUTTON_TYPE_NONE; save_wv = wv; @@ -1625,7 +1626,8 @@ record_unwind_protect_ptr (cleanup_widget_value_tree, first_wv); /* Actually create and show the menu until popped down. */ - create_and_show_popup_menu (f, first_wv, x, y, for_click); + create_and_show_popup_menu (f, first_wv, x, y, + menuflags & MENU_FOR_CLICK); unbind_to (specpdl_count, Qnil); @@ -1666,7 +1668,7 @@ = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); if (menu_item_selection == aref_addr (menu_items, i)) { - if (keymaps) + if (menuflags & MENU_KEYMAPS) { int j; @@ -1684,7 +1686,7 @@ } } } - else if (!for_click) + else if (!(menuflags & MENU_FOR_CLICK)) { unblock_input (); /* Make "Cancel" equivalent to C-g. */ @@ -2022,7 +2024,7 @@ if (EQ (first_item[0], Qt)) pane_name = first_item[MENU_ITEMS_PANE_NAME]; else if (EQ (first_item[0], Qquote)) - /* This shouldn't happen, see xmenu_show. */ + /* This shouldn't happen, see x_menu_show. */ pane_name = empty_unibyte_string; else pane_name = first_item[MENU_ITEMS_ITEM_NAME]; @@ -2064,8 +2066,8 @@ Lisp_Object -xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, - Lisp_Object title, const char **error_name) +x_menu_show (struct frame *f, int x, int y, int menuflags, + Lisp_Object title, const char **error_name) { Window root; XMenu *menu; @@ -2140,7 +2142,7 @@ prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); pane_string = (NILP (pane_name) ? "" : SSDATA (pane_name)); - if (keymaps && !NILP (prefix)) + if ((menuflags & MENU_KEYMAPS) && !NILP (prefix)) pane_string++; lpane = XMenuAddPane (FRAME_X_DISPLAY (f), menu, pane_string, TRUE); @@ -2263,7 +2265,7 @@ if (ulx < 0) x -= ulx; if (uly < 0) y -= uly; - if (! for_click) + if (!(menuflags & MENU_FOR_CLICK)) { /* If position was not given by a mouse click, adjust so upper left corner of the menu as a whole ends up at given coordinates. This @@ -2317,7 +2319,7 @@ { entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); - if (keymaps) + if (menuflags & MENU_KEYMAPS) { entry = list1 (entry); if (!NILP (pane_prefix)) @@ -2339,7 +2341,7 @@ case XM_NO_SELECT: /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means the menu was invoked with a mouse event as POSITION). */ - if (! for_click) + if (!(menuflags & MENU_FOR_CLICK)) { unblock_input (); Fsignal (Qquit, Qnil); === modified file 'src/xterm.c' --- src/xterm.c 2014-06-02 00:18:22 +0000 +++ src/xterm.c 2014-06-04 04:58:31 +0000 @@ -75,6 +75,7 @@ #include "xsettings.h" #include "xgselect.h" #include "sysselect.h" +#include "menu.h" #ifdef USE_X_TOOLKIT #include @@ -10531,6 +10532,7 @@ terminal->frame_rehighlight_hook = XTframe_rehighlight; terminal->frame_raise_lower_hook = XTframe_raise_lower; terminal->fullscreen_hook = XTfullscreen_hook; + terminal->menu_show_hook = x_menu_show; terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars; terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; ------------------------------------------------------------ revno: 117254 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2014-06-04 07:20:11 +0400 message: * lwlib-widget.h (widget_value) [USE_X_TOOLKIT]: Use X toolkit fields conditionally. diff: === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2014-06-03 19:59:55 +0000 +++ lwlib/ChangeLog 2014-06-04 03:20:11 +0000 @@ -1,3 +1,8 @@ +2014-06-04 Dmitry Antipov + + * lwlib-widget.h (widget_value) [USE_X_TOOLKIT]: Use X toolkit + fields conditionally. + 2014-06-03 Paul Eggert Do not require libXt-devel when building with gtk. === modified file 'lwlib/lwlib-widget.h' --- lwlib/lwlib-widget.h 2014-06-03 19:59:55 +0000 +++ lwlib/lwlib-widget.h 2014-06-04 03:20:11 +0000 @@ -73,13 +73,6 @@ /* The type of a button. */ enum button_type button_type; - /* Type of change (maintained by lw library). */ - change_type change; - - /* Type of this widget's change, but not counting the other widgets - found in the `next' field. */ - change_type this_one_change; - /* Contents of the sub-widgets, also selected slot for checkbox. */ struct _widget_value *contents; @@ -89,12 +82,22 @@ /* Next one in the list. */ struct _widget_value *next; +#ifdef USE_X_TOOLKIT + /* Type of change (maintained by lw library). */ + change_type change; + + /* Type of this widget's change, but not counting the other widgets + found in the `next' field. */ + change_type this_one_change; + /* Slot for the toolkit dependent part. Always initialize to NULL. */ void *toolkit_data; /* Whether we should free the toolkit data slot when freeing the widget_value itself. */ bool free_toolkit_data; +#endif + } widget_value; #endif ------------------------------------------------------------ revno: 117253 committer: Juanma Barranquero branch nick: trunk timestamp: Wed 2014-06-04 00:13:17 +0200 message: src/w32heap.c (DUMPED_HEAP_SIZE) [!_WIN64]: Reduce to 11 MB. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-03 21:00:40 +0000 +++ src/ChangeLog 2014-06-03 22:13:17 +0000 @@ -1,3 +1,7 @@ +2014-06-03 Juanma Barranquero + + * w32heap.c (DUMPED_HEAP_SIZE) [!_WIN64]: Reduce to 11 MB. + 2014-06-03 Eli Zaretskii * sysselect.h (fd_CLR, fd_ISSET, fd_SET, FD_CLR, FD_ISSET) === modified file 'src/w32heap.c' --- src/w32heap.c 2014-06-03 10:01:08 +0000 +++ src/w32heap.c 2014-06-03 22:13:17 +0000 @@ -117,7 +117,7 @@ #ifdef _WIN64 # define DUMPED_HEAP_SIZE (18*1024*1024) #else -# define DUMPED_HEAP_SIZE (12*1024*1024) +# define DUMPED_HEAP_SIZE (11*1024*1024) #endif static unsigned char dumped_data[DUMPED_HEAP_SIZE]; ------------------------------------------------------------ revno: 117252 committer: Eli Zaretskii branch nick: trunk timestamp: Wed 2014-06-04 00:00:40 +0300 message: Fix the MS-Windows build broken by few last commits. src/sysselect.h (fd_CLR, fd_ISSET, fd_SET, FD_CLR, FD_ISSET) (FD_SET): Don't define on WINDOWSNT. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-03 20:08:08 +0000 +++ src/ChangeLog 2014-06-03 21:00:40 +0000 @@ -1,3 +1,8 @@ +2014-06-03 Eli Zaretskii + + * sysselect.h (fd_CLR, fd_ISSET, fd_SET, FD_CLR, FD_ISSET) + (FD_SET): Don't define on WINDOWSNT. + 2014-06-03 Paul Eggert * emacs.c: Include "sysselect.h", to define its inline functions. === modified file 'src/sysselect.h' --- src/sysselect.h 2014-06-03 16:15:43 +0000 +++ src/sysselect.h 2014-06-03 21:00:40 +0000 @@ -51,6 +51,7 @@ #define pselect sys_select #endif +#ifndef WINDOWSNT INLINE_HEADER_BEGIN /* Check for out-of-range errors if ENABLE_CHECKING is defined. */ @@ -85,4 +86,6 @@ INLINE_HEADER_END +#endif /* !WINDOWSNT */ + #endif ------------------------------------------------------------ revno: 117251 author: Paul Eggert committer: Paul Eggert branch nick: trunk timestamp: Tue 2014-06-03 13:08:08 -0700 message: * emacs.c: Include "sysselect.h", to define its inline functions. Problem reported by Glenn Morris in: http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00077.html diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-03 19:59:55 +0000 +++ src/ChangeLog 2014-06-03 20:08:08 +0000 @@ -1,5 +1,9 @@ 2014-06-03 Paul Eggert + * emacs.c: Include "sysselect.h", to define its inline functions. + Problem reported by Glenn Morris in: + http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00077.html + Do not require libXt-devel when building with gtk. * gtkutil.h, menu.h: Include lwlib-widget.h, not lwlib-h, to avoid dependency on libXt-devel. === modified file 'src/emacs.c' --- src/emacs.c 2014-05-29 14:52:47 +0000 +++ src/emacs.c 2014-06-03 20:08:08 +0000 @@ -80,6 +80,7 @@ #include "composite.h" #include "dispextern.h" #include "syntax.h" +#include "sysselect.h" #include "systime.h" #ifdef HAVE_GNUTLS ------------------------------------------------------------ revno: 117250 committer: Paul Eggert branch nick: trunk timestamp: Tue 2014-06-03 12:59:55 -0700 message: Do not require libXt-devel when building with gtk. * lwlib/lwlib-widget.h: New file, with contents taken from lwlib.h. (widget_value) [HAVE_NTGUI]: New member 'title'. * lwlib/lwlib.h: Include lwlib-widget.h. (change_type, enum button_type, widget_value): Move to lwlib-widget.h. * src/gtkutil.h, src/menu.h: Include lwlib-widget.h, not lwlib-h, to avoid dependency on libXt-devel. * src/menu.h [HAVE_NTGUI]: Include lwlib-widget.h in this case too. (enum button_type, widget_value) [HAVE_NTGUI]: Remove, as lwlib-widget.h now does this. * src/nsmenu.m (ns_menu_show): "enabled" -> "enable" to fix typo. diff: === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2014-06-03 04:17:53 +0000 +++ lwlib/ChangeLog 2014-06-03 19:59:55 +0000 @@ -1,3 +1,12 @@ +2014-06-03 Paul Eggert + + Do not require libXt-devel when building with gtk. + * lwlib-widget.h: New file, with contents taken from lwlib.h. + (widget_value) [HAVE_NTGUI]: New member 'title'. + * lwlib.h: Include lwlib-widget.h. + (change_type, enum button_type, widget_value): + Move to lwlib-widget.h. + 2014-06-03 Dmitry Antipov * xlwmenu.c (openXftFont): Do not load regular X font here. === added file 'lwlib/lwlib-widget.h' --- lwlib/lwlib-widget.h 1970-01-01 00:00:00 +0000 +++ lwlib/lwlib-widget.h 2014-06-03 19:59:55 +0000 @@ -0,0 +1,100 @@ +/* +Copyright (C) 1992, 1993 Lucid, Inc. +Copyright (C) 1994, 1999-2014 Free Software Foundation, Inc. + +This file is part of the Lucid Widget Library. + +The Lucid Widget Library is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 1, or (at your option) +any later version. + +The Lucid Widget Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + +/* This part is separate from lwlib.h because it does not need X, + and thus can be used by non-X code in Emacs proper. */ + +#ifndef LWLIB_WIDGET_H +#define LWLIB_WIDGET_H + +typedef enum +{ + NO_CHANGE = 0, + INVISIBLE_CHANGE = 1, + VISIBLE_CHANGE = 2, + STRUCTURAL_CHANGE = 3 +} change_type; + +enum button_type +{ + BUTTON_TYPE_NONE, + BUTTON_TYPE_TOGGLE, + BUTTON_TYPE_RADIO +}; + +typedef struct _widget_value +{ + /* Name of widget. */ + Lisp_Object lname; + char *name; + + /* Value (meaning depend on widget type). */ + char *value; + + /* Keyboard equivalent. no implications for XtTranslations. */ + Lisp_Object lkey; + char *key; + + /* Help string or nil if none. + GC finds this string through the frame's menu_bar_vector + or through menu_items. */ + Lisp_Object help; + + /* True if enabled. */ + bool enabled; + + /* True if selected. */ + bool selected; + + /* True if was edited (maintained by get_value). */ + bool edited; + +#ifdef HAVE_NTGUI + /* True if menu title. */ + bool title; +#endif + + /* The type of a button. */ + enum button_type button_type; + + /* Type of change (maintained by lw library). */ + change_type change; + + /* Type of this widget's change, but not counting the other widgets + found in the `next' field. */ + change_type this_one_change; + + /* Contents of the sub-widgets, also selected slot for checkbox. */ + struct _widget_value *contents; + + /* Data passed to callback. */ + void *call_data; + + /* Next one in the list. */ + struct _widget_value *next; + + /* Slot for the toolkit dependent part. Always initialize to NULL. */ + void *toolkit_data; + + /* Whether we should free the toolkit data slot when freeing the + widget_value itself. */ + bool free_toolkit_data; +} widget_value; + +#endif === modified file 'lwlib/lwlib.h' --- lwlib/lwlib.h 2014-06-02 18:01:21 +0000 +++ lwlib/lwlib.h 2014-06-03 19:59:55 +0000 @@ -42,23 +42,10 @@ ** main: ("name") */ +#include "lwlib-widget.h" + typedef unsigned long LWLIB_ID; -typedef enum _change_type -{ - NO_CHANGE = 0, - INVISIBLE_CHANGE = 1, - VISIBLE_CHANGE = 2, - STRUCTURAL_CHANGE = 3 -} change_type; - -enum button_type -{ - BUTTON_TYPE_NONE, - BUTTON_TYPE_TOGGLE, - BUTTON_TYPE_RADIO -}; - /* Menu separator types. */ enum menu_separator @@ -81,46 +68,6 @@ SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT_DASH }; -typedef struct _widget_value -{ - /* name of widget */ - Lisp_Object lname; - char* name; - /* value (meaning depend on widget type) */ - char* value; - /* keyboard equivalent. no implications for XtTranslations */ - Lisp_Object lkey; - char* key; - /* Help string or nil if none. - GC finds this string through the frame's menu_bar_vector - or through menu_items. */ - Lisp_Object help; - /* true if enabled */ - Boolean enabled; - /* true if selected */ - Boolean selected; - /* true if was edited (maintained by get_value) */ - Boolean edited; - /* The type of a button. */ - enum button_type button_type; - /* true if has changed (maintained by lw library) */ - change_type change; - /* true if this widget itself has changed, - but not counting the other widgets found in the `next' field. */ - change_type this_one_change; - /* Contents of the sub-widgets, also selected slot for checkbox */ - struct _widget_value* contents; - /* data passed to callback */ - XtPointer call_data; - /* next one in the list */ - struct _widget_value* next; - /* slot for the toolkit dependent part. Always initialize to NULL. */ - void* toolkit_data; - /* tell us if we should free the toolkit data slot when freeing the - widget_value itself. */ - Boolean free_toolkit_data; -} widget_value; - typedef void (*lw_callback) (Widget w, LWLIB_ID id, void* data); === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-03 16:15:43 +0000 +++ src/ChangeLog 2014-06-03 19:59:55 +0000 @@ -1,3 +1,13 @@ +2014-06-03 Paul Eggert + + Do not require libXt-devel when building with gtk. + * gtkutil.h, menu.h: Include lwlib-widget.h, not lwlib-h, to avoid + dependency on libXt-devel. + * menu.h [HAVE_NTGUI]: Include lwlib-widget.h in this case too. + (enum button_type, widget_value) [HAVE_NTGUI]: Remove, as + lwlib-widget.h now does this. + * nsmenu.m (ns_menu_show): "enabled" -> "enable" to fix typo. + 2014-06-03 Paul Eggert If ENABLE_CHECKING, range-check args of FD_CLR, FD_ISSET, FD_SET. === modified file 'src/gtkutil.h' --- src/gtkutil.h 2014-06-02 18:01:21 +0000 +++ src/gtkutil.h 2014-06-03 19:59:55 +0000 @@ -24,7 +24,7 @@ #ifdef USE_GTK #include -#include "../lwlib/lwlib.h" +#include "../lwlib/lwlib-widget.h" #include "frame.h" #include "xterm.h" === modified file 'src/menu.h' --- src/menu.h 2014-06-03 06:51:18 +0000 +++ src/menu.h 2014-06-03 19:59:55 +0000 @@ -20,52 +20,9 @@ #define MENU_H #include "systime.h" /* for Time */ -#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) -#include "../lwlib/lwlib.h" /* for widget_value */ -#endif +#include "../lwlib/lwlib-widget.h" #ifdef HAVE_NTGUI -/* This is based on the one in ../lwlib/lwlib.h, with unused portions - removed. HAVE_NTGUI cannot include lwlib.h, as that pulls in X11 - headers. */ - -enum button_type -{ - BUTTON_TYPE_NONE, - BUTTON_TYPE_TOGGLE, - BUTTON_TYPE_RADIO -}; - -typedef struct _widget_value -{ - /* name of widget */ - Lisp_Object lname; - const char* name; - /* value (meaning depend on widget type) */ - const char* value; - /* keyboard equivalent. no implications for XtTranslations */ - Lisp_Object lkey; - const char* key; - /* Help string or nil if none. - GC finds this string through the frame's menu_bar_vector - or through menu_items. */ - Lisp_Object help; - /* true if enabled */ - unsigned char enabled; - /* true if selected */ - unsigned char selected; - /* The type of a button. */ - enum button_type button_type; - /* true if menu title */ - unsigned char title; - /* Contents of the sub-widgets, also selected slot for checkbox */ - struct _widget_value* contents; - /* data passed to callback */ - void *call_data; - /* next one in the list */ - struct _widget_value* next; -} widget_value; - extern Lisp_Object Qunsupported__w32_dialog; #endif === modified file 'src/nsmenu.m' --- src/nsmenu.m 2014-06-02 18:01:21 +0000 +++ src/nsmenu.m 2014-06-03 19:59:55 +0000 @@ -943,7 +943,7 @@ } #endif /* not HAVE_MULTILINGUAL_MENU */ - wv = make_widget_value (SSDATA (item_name), NULL, !NILP (enabled), + wv = make_widget_value (SSDATA (item_name), NULL, !NILP (enable), STRINGP (help) ? help : Qnil); if (prev_wv) prev_wv->next = wv;