emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117535: * lwlib/lwlib.h (toplevel): Use unsigned in


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117535: * lwlib/lwlib.h (toplevel): Use unsigned int for LWLIB_ID.
Date: Tue, 15 Jul 2014 09:59:48 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117535
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-07-15 13:59:05 +0400
message:
  * 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.
modified:
  lwlib/ChangeLog                changelog-20091113204419-o5vbwnq5f7feedwu-1447
  lwlib/lwlib.h                  lwlib.h-20091113204419-o5vbwnq5f7feedwu-673
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/xmenu.c                    xmenu.c-20091113204419-o5vbwnq5f7feedwu-161
=== modified file 'lwlib/ChangeLog'
--- a/lwlib/ChangeLog   2014-06-28 22:57:23 +0000
+++ b/lwlib/ChangeLog   2014-07-15 09:59:05 +0000
@@ -1,3 +1,7 @@
+2014-07-15  Dmitry Antipov  <address@hidden>
+
+       * lwlib.h (toplevel): Use unsigned int for LWLIB_ID.
+
 2014-06-28  Glenn Morris  <address@hidden>
 
        * Makefile.in: Use gcc auto-dependency information.

=== modified file 'lwlib/lwlib.h'
--- a/lwlib/lwlib.h     2014-06-03 19:59:55 +0000
+++ b/lwlib/lwlib.h     2014-07-15 09:59:05 +0000
@@ -44,7 +44,7 @@
 
 #include "lwlib-widget.h"
 
-typedef unsigned long LWLIB_ID;
+typedef unsigned int LWLIB_ID;
 
 /* Menu separator types.  */
 

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-07-14 19:23:18 +0000
+++ b/src/ChangeLog     2014-07-15 09:59:05 +0000
@@ -1,3 +1,11 @@
+2014-07-15  Dmitry Antipov  <address@hidden>
+
+       * 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  <address@hidden>
 
        Use binary-io module, O_BINARY, and "b" flag (Bug#18006).

=== modified file 'src/xmenu.c'
--- a/src/xmenu.c       2014-06-22 05:00:14 +0000
+++ b/src/xmenu.c       2014-07-15 09:59:05 +0000
@@ -117,7 +117,7 @@
 
 #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 @@
 /* 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 @@
   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 @@
   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 @@
      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 @@
 void
 syms_of_xmenu (void)
 {
+#ifdef USE_X_TOOLKIT
+  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");
-
-#ifdef USE_X_TOOLKIT
-  widget_id_tick = (1<<16);
-  next_menubar_widget_id = 1;
-#endif
-
   defsubr (&Smenu_or_popup_active_p);
 
 #if defined (USE_GTK) || defined (USE_X_TOOLKIT)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]