summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 @@
+2014-07-15 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * lwlib.h (toplevel): Use unsigned int for LWLIB_ID.
+
2014-06-28 Glenn Morris <rgm@gnu.org>
* 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/>. */
#include "lwlib-widget.h"
-typedef unsigned long LWLIB_ID;
+typedef unsigned int LWLIB_ID;
/* Menu separator types. */
diff --git a/src/ChangeLog b/src/ChangeLog
index ee600602895..a640b970b67 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2014-07-15 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * 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.
+
2014-07-14 Paul Eggert <eggert@cs.ucla.edu>
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;
#ifdef USE_X_TOOLKIT
-static int next_menubar_widget_id;
+static LWLIB_ID next_menubar_widget_id;
/* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */
@@ -1273,8 +1273,8 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
/* We need a unique id for each widget handled by the Lucid Widget
library.
- For the main windows, and popup menus, we use this counter,
- which we increment each time after use. This starts from 1<<16.
+ For the main windows, and popup menus, we use this counter, which we
+ increment each time after use. This starts from WIDGET_ID_TICK_START.
For menu bars, we use numbers starting at 0, counted in
next_menubar_widget_id. */
@@ -1286,17 +1286,13 @@ popup_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
menu_item_selection = client_data;
}
-/* ARG is the LWLIB ID of the dialog box, represented
- as a Lisp object as (HIGHPART . LOWPART). */
+/* ID is the LWLIB ID of the dialog box. */
static void
-pop_down_menu (Lisp_Object arg)
+pop_down_menu (int id)
{
- LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID)
- | XINT (XCDR (arg)));
-
block_input ();
- lw_destroy_all_widgets (id);
+ lw_destroy_all_widgets ((LWLIB_ID) id);
unblock_input ();
popup_activated_flag = 0;
}
@@ -1362,11 +1358,9 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
x_activate_timeout_atimer ();
{
- int fact = 4 * sizeof (LWLIB_ID);
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
- record_unwind_protect (pop_down_menu,
- Fcons (make_number (menu_id >> (fact)),
- make_number (menu_id & ~(-1 << (fact)))));
+
+ record_unwind_protect_int (pop_down_menu, (int) menu_id);
/* Process events that apply to the menu. */
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)
Also handle timers. */
{
ptrdiff_t count = SPECPDL_INDEX ();
- int fact = 4 * sizeof (LWLIB_ID);
/* xdialog_show_unwind is responsible for popping the dialog box down. */
- record_unwind_protect (pop_down_menu,
- Fcons (make_number (dialog_id >> (fact)),
- make_number (dialog_id & ~(-1 << (fact)))));
+
+ record_unwind_protect_int (pop_down_menu, (int) dialog_id);
popup_get_selection (0, FRAME_DISPLAY_INFO (f), dialog_id, 1);
@@ -2330,13 +2322,13 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_
void
syms_of_xmenu (void)
{
- DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
-
#ifdef USE_X_TOOLKIT
- widget_id_tick = (1<<16);
+ enum { WIDGET_ID_TICK_START = 1 << 16 };
+ widget_id_tick = WIDGET_ID_TICK_START;
next_menubar_widget_id = 1;
#endif
+ DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
defsubr (&Smenu_or_popup_active_p);
#if defined (USE_GTK) || defined (USE_X_TOOLKIT)