aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32menu.c
diff options
context:
space:
mode:
authorEli Zaretskii2015-01-13 19:16:51 +0200
committerEli Zaretskii2015-01-13 19:16:51 +0200
commit5aa618b05807d560126dfd09b9c9cb6b957b98de (patch)
treeb739bec3884c4ed03158b8be0edd0c831540d0d7 /src/w32menu.c
parent30c5f5cdef8db72c007efecfc8436479631b45d0 (diff)
downloademacs-5aa618b05807d560126dfd09b9c9cb6b957b98de.tar.gz
emacs-5aa618b05807d560126dfd09b9c9cb6b957b98de.zip
Fix problems with 32-bit wide-int build exposed by MinGW
lisp.h (XPNTR): Move definition to after XTYPE, to avoid compilation error in an unoptimized build when !USE_LSB_TAG. src/w32heap.c (DUMPED_HEAP_SIZE): For 32-bit wide-int build, use the same larger value as for the 64-bit build. src/w32term.h (SCROLL_BAR_PACK): Cast the result to UINT_PTR to avoid compiler warnings. src/w32proc.c (Fw32_get_codepage_charset, Fw32_set_keyboard_layout): Avoid compiler warnings about cast from integer to pointer of different size. src/w32menu.c (menubar_selection_callback, w32_menu_show): Cast to UINT_PTR instead of EMACS_INT, to avoid compiler warnings about casting from integer to pointer of different size. (add_menu_item): Pass the help-echo string as a pointer to Lisp_String, not as a Lisp_Object. (w32_menu_display_help): Use make_lisp_ptr to reconstruct a Lisp string object from its C pointer. src/w32fns.c (w32_msg_pump) <WM_EMACS_UNREGISTER_HOT_KEY>: Use make_lisp_ptr instead of XIL, to reconstruct a Lisp_Cons from its C pointer. <WM_EMACS_TOGGLE_LOCK_KEY>: msg.lparam is now a C integer. (Fx_create_frame): Type-cast the result of XFASTINT to avoild compiler warnings about size differences. (Fw32_unregister_hot_key): Pass the tail of w32_grabbed_keys as a pointer to a Lisp_Cons struct, not as a disguised EMACS_INT. (Fw32_toggle_lock_key): Pass the new state of the key as a C integer; use -1 for nil. Doc fix. src/.gdbinit (xgetsym): New subroutine. (xsymname, xsymbol): Use it. (xprintsym): No need to call xgetptr.
Diffstat (limited to 'src/w32menu.c')
-rw-r--r--src/w32menu.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/w32menu.c b/src/w32menu.c
index a65e399ba5b..2742276d3f6 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -217,9 +217,9 @@ menubar_selection_callback (struct frame *f, void * client_data)
217 else 217 else
218 { 218 {
219 entry = AREF (vector, i + MENU_ITEMS_ITEM_VALUE); 219 entry = AREF (vector, i + MENU_ITEMS_ITEM_VALUE);
220 /* The EMACS_INT cast avoids a warning. There's no problem 220 /* The UINT_PTR cast avoids a warning. There's no problem
221 as long as pointers have enough bits to hold small integers. */ 221 as long as pointers have enough bits to hold small integers. */
222 if ((int) (EMACS_INT) client_data == i) 222 if ((int) (UINT_PTR) client_data == i)
223 { 223 {
224 int j; 224 int j;
225 struct input_event buf; 225 struct input_event buf;
@@ -706,7 +706,7 @@ w32_menu_show (struct frame *f, int x, int y, int menuflags,
706 wv->key = SSDATA (descrip); 706 wv->key = SSDATA (descrip);
707 /* Use the contents index as call_data, since we are 707 /* Use the contents index as call_data, since we are
708 restricted to 16-bits. */ 708 restricted to 16-bits. */
709 wv->call_data = !NILP (def) ? (void *) (EMACS_INT) i : 0; 709 wv->call_data = !NILP (def) ? (void *) (UINT_PTR) i : 0;
710 710
711 if (NILP (type)) 711 if (NILP (type))
712 wv->button_type = BUTTON_TYPE_NONE; 712 wv->button_type = BUTTON_TYPE_NONE;
@@ -1401,17 +1401,21 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1401 info.cbSize = sizeof (info); 1401 info.cbSize = sizeof (info);
1402 info.fMask = MIIM_DATA; 1402 info.fMask = MIIM_DATA;
1403 1403
1404 /* Set help string for menu item. Leave it as a Lisp_Object 1404 /* Set help string for menu item. Leave it as a pointer to
1405 until it is ready to be displayed, since GC can happen while 1405 a Lisp_String until it is ready to be displayed, since GC
1406 menus are active. */ 1406 can happen while menus are active. */
1407 if (!NILP (wv->help)) 1407 if (!NILP (wv->help))
1408 { 1408 {
1409 /* We use XUNTAG below because in a 32-bit build
1410 --with-wide-int we cannot pass a Lisp_Object
1411 via a DWORD member of MENUITEMINFO. */
1409 /* As of Jul-2012, w32api headers say that dwItemData 1412 /* As of Jul-2012, w32api headers say that dwItemData
1410 has DWORD type, but that's a bug: it should actually 1413 has DWORD type, but that's a bug: it should actually
1411 be ULONG_PTR, which is correct for 32-bit and 64-bit 1414 be ULONG_PTR, which is correct for 32-bit and 64-bit
1412 Windows alike. MSVC headers get it right; hopefully, 1415 Windows alike. MSVC headers get it right; hopefully,
1413 MinGW headers will, too. */ 1416 MinGW headers will, too. */
1414 info.dwItemData = (ULONG_PTR) XLI (wv->help); 1417 eassert (STRINGP (wv->help));
1418 info.dwItemData = (ULONG_PTR) XUNTAG (wv->help, Lisp_String);
1415 } 1419 }
1416 if (wv->button_type == BUTTON_TYPE_RADIO) 1420 if (wv->button_type == BUTTON_TYPE_RADIO)
1417 { 1421 {
@@ -1487,7 +1491,10 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
1487 info.fMask = MIIM_DATA; 1491 info.fMask = MIIM_DATA;
1488 get_menu_item_info (menu, item, FALSE, &info); 1492 get_menu_item_info (menu, item, FALSE, &info);
1489 1493
1490 help = info.dwItemData ? XIL (info.dwItemData) : Qnil; 1494 help =
1495 info.dwItemData
1496 ? make_lisp_ptr ((void *) info.dwItemData, Lisp_String)
1497 : Qnil;
1491 } 1498 }
1492 1499
1493 /* Store the help echo in the keyboard buffer as the X toolkit 1500 /* Store the help echo in the keyboard buffer as the X toolkit