aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2014-07-15 13:59:05 +0400
committerDmitry Antipov2014-07-15 13:59:05 +0400
commit60c6e448ebdde76452283c60c2fb0f8b7cfccbe8 (patch)
treeb8ab0b81dd3345bb25e64efbbfd727c7b518459b
parentfb32e9f8f3962c63a5edb0a36283ae543601b115 (diff)
downloademacs-60c6e448ebdde76452283c60c2fb0f8b7cfccbe8.tar.gz
emacs-60c6e448ebdde76452283c60c2fb0f8b7cfccbe8.zip
* lwlib/lwlib.h (toplevel): Use unsigned int for LWLIB_ID.
* src/xmenu.c (toplevel): Use LWLIB_ID for next_menubar_widget_id. (pop_down_menu) [USE_X_TOOLKIT]: Accept integer arg. (create_and_show_popup_menu, create_and_show_dialog) [USE_X_TOOLKIT]: Use record_unwind_protect_int and avoid consing. (syms_of_xmenu) [USE_X_TOOLKIT]: Declare WIDGET_ID_TICK_START.
-rw-r--r--lwlib/ChangeLog4
-rw-r--r--lwlib/lwlib.h2
-rw-r--r--src/ChangeLog8
-rw-r--r--src/xmenu.c34
4 files changed, 26 insertions, 22 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index 20ace660739..11ee10edac2 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -1,3 +1,7 @@
12014-07-15 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * lwlib.h (toplevel): Use unsigned int for LWLIB_ID.
4
12014-06-28 Glenn Morris <rgm@gnu.org> 52014-06-28 Glenn Morris <rgm@gnu.org>
2 6
3 * Makefile.in: Use gcc auto-dependency information. 7 * Makefile.in: Use gcc auto-dependency information.
diff --git a/lwlib/lwlib.h b/lwlib/lwlib.h
index 46e2d7a4891..7d87facb903 100644
--- a/lwlib/lwlib.h
+++ b/lwlib/lwlib.h
@@ -44,7 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
44 44
45#include "lwlib-widget.h" 45#include "lwlib-widget.h"
46 46
47typedef unsigned long LWLIB_ID; 47typedef unsigned int LWLIB_ID;
48 48
49/* Menu separator types. */ 49/* Menu separator types. */
50 50
diff --git a/src/ChangeLog b/src/ChangeLog
index ee600602895..a640b970b67 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12014-07-15 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * xmenu.c (toplevel): Use LWLIB_ID for next_menubar_widget_id.
4 (pop_down_menu) [USE_X_TOOLKIT]: Accept integer arg.
5 (create_and_show_popup_menu, create_and_show_dialog) [USE_X_TOOLKIT]:
6 Use record_unwind_protect_int and avoid consing.
7 (syms_of_xmenu) [USE_X_TOOLKIT]: Declare WIDGET_ID_TICK_START.
8
12014-07-14 Paul Eggert <eggert@cs.ucla.edu> 92014-07-14 Paul Eggert <eggert@cs.ucla.edu>
2 10
3 Use binary-io module, O_BINARY, and "b" flag (Bug#18006). 11 Use binary-io module, O_BINARY, and "b" flag (Bug#18006).
diff --git a/src/xmenu.c b/src/xmenu.c
index e04a801ef71..eb98125f6bb 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -117,7 +117,7 @@ static int popup_activated_flag;
117 117
118#ifdef USE_X_TOOLKIT 118#ifdef USE_X_TOOLKIT
119 119
120static int next_menubar_widget_id; 120static LWLIB_ID next_menubar_widget_id;
121 121
122/* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */ 122/* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */
123 123
@@ -1273,8 +1273,8 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1273/* We need a unique id for each widget handled by the Lucid Widget 1273/* We need a unique id for each widget handled by the Lucid Widget
1274 library. 1274 library.
1275 1275
1276 For the main windows, and popup menus, we use this counter, 1276 For the main windows, and popup menus, we use this counter, which we
1277 which we increment each time after use. This starts from 1<<16. 1277 increment each time after use. This starts from WIDGET_ID_TICK_START.
1278 1278
1279 For menu bars, we use numbers starting at 0, counted in 1279 For menu bars, we use numbers starting at 0, counted in
1280 next_menubar_widget_id. */ 1280 next_menubar_widget_id. */
@@ -1286,17 +1286,13 @@ popup_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
1286 menu_item_selection = client_data; 1286 menu_item_selection = client_data;
1287} 1287}
1288 1288
1289/* ARG is the LWLIB ID of the dialog box, represented 1289/* ID is the LWLIB ID of the dialog box. */
1290 as a Lisp object as (HIGHPART . LOWPART). */
1291 1290
1292static void 1291static void
1293pop_down_menu (Lisp_Object arg) 1292pop_down_menu (int id)
1294{ 1293{
1295 LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID)
1296 | XINT (XCDR (arg)));
1297
1298 block_input (); 1294 block_input ();
1299 lw_destroy_all_widgets (id); 1295 lw_destroy_all_widgets ((LWLIB_ID) id);
1300 unblock_input (); 1296 unblock_input ();
1301 popup_activated_flag = 0; 1297 popup_activated_flag = 0;
1302} 1298}
@@ -1362,11 +1358,9 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1362 x_activate_timeout_atimer (); 1358 x_activate_timeout_atimer ();
1363 1359
1364 { 1360 {
1365 int fact = 4 * sizeof (LWLIB_ID);
1366 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 1361 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
1367 record_unwind_protect (pop_down_menu, 1362
1368 Fcons (make_number (menu_id >> (fact)), 1363 record_unwind_protect_int (pop_down_menu, (int) menu_id);
1369 make_number (menu_id & ~(-1 << (fact)))));
1370 1364
1371 /* Process events that apply to the menu. */ 1365 /* Process events that apply to the menu. */
1372 popup_get_selection (0, FRAME_DISPLAY_INFO (f), menu_id, 1); 1366 popup_get_selection (0, FRAME_DISPLAY_INFO (f), menu_id, 1);
@@ -1732,12 +1726,10 @@ create_and_show_dialog (struct frame *f, widget_value *first_wv)
1732 Also handle timers. */ 1726 Also handle timers. */
1733 { 1727 {
1734 ptrdiff_t count = SPECPDL_INDEX (); 1728 ptrdiff_t count = SPECPDL_INDEX ();
1735 int fact = 4 * sizeof (LWLIB_ID);
1736 1729
1737 /* xdialog_show_unwind is responsible for popping the dialog box down. */ 1730 /* xdialog_show_unwind is responsible for popping the dialog box down. */
1738 record_unwind_protect (pop_down_menu, 1731
1739 Fcons (make_number (dialog_id >> (fact)), 1732 record_unwind_protect_int (pop_down_menu, (int) dialog_id);
1740 make_number (dialog_id & ~(-1 << (fact)))));
1741 1733
1742 popup_get_selection (0, FRAME_DISPLAY_INFO (f), dialog_id, 1); 1734 popup_get_selection (0, FRAME_DISPLAY_INFO (f), dialog_id, 1);
1743 1735
@@ -2330,13 +2322,13 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_
2330void 2322void
2331syms_of_xmenu (void) 2323syms_of_xmenu (void)
2332{ 2324{
2333 DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
2334
2335#ifdef USE_X_TOOLKIT 2325#ifdef USE_X_TOOLKIT
2336 widget_id_tick = (1<<16); 2326 enum { WIDGET_ID_TICK_START = 1 << 16 };
2327 widget_id_tick = WIDGET_ID_TICK_START;
2337 next_menubar_widget_id = 1; 2328 next_menubar_widget_id = 1;
2338#endif 2329#endif
2339 2330
2331 DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
2340 defsubr (&Smenu_or_popup_active_p); 2332 defsubr (&Smenu_or_popup_active_p);
2341 2333
2342#if defined (USE_GTK) || defined (USE_X_TOOLKIT) 2334#if defined (USE_GTK) || defined (USE_X_TOOLKIT)