summaryrefslogtreecommitdiff
path: root/src/w32fns.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-01-13 19:16:51 +0200
committerEli Zaretskii <eliz@gnu.org>2015-01-13 19:16:51 +0200
commit5aa618b05807d560126dfd09b9c9cb6b957b98de (patch)
treeb739bec3884c4ed03158b8be0edd0c831540d0d7 /src/w32fns.c
parent30c5f5cdef8db72c007efecfc8436479631b45d0 (diff)
downloademacs-5aa618b05807d560126dfd09b9c9cb6b957b98de.tar.gz
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/w32fns.c')
-rw-r--r--src/w32fns.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index 3b8346a07fd..2dd92ff8a3a 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2543,7 +2543,7 @@ w32_msg_pump (deferred_msg * msg_buf)
thread-safe. The next line is okay because the cons
cell is never made into garbage and is not relocated by
GC. */
- XSETCAR (XIL ((EMACS_INT) msg.lParam), Qnil);
+ XSETCAR (make_lisp_ptr ((void *)msg.lParam, Lisp_Cons), Qnil);
if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
emacs_abort ();
break;
@@ -2551,16 +2551,10 @@ w32_msg_pump (deferred_msg * msg_buf)
{
int vk_code = (int) msg.wParam;
int cur_state = (GetKeyState (vk_code) & 1);
- Lisp_Object new_state = XIL ((EMACS_INT) msg.lParam);
-
- /* NB: This code must be thread-safe. It is safe to
- call NILP because symbols are not relocated by GC,
- and pointer here is not touched by GC (so the markbit
- can't be set). Numbers are safe because they are
- immediate values. */
- if (NILP (new_state)
- || (NUMBERP (new_state)
- && ((XUINT (new_state)) & 1) != cur_state))
+ int new_state = msg.lParam;
+
+ if (new_state == -1
+ || ((new_state & 1) != cur_state))
{
one_w32_display_info.faked_key = vk_code;
@@ -4523,7 +4517,9 @@ This function is an internal primitive--use `make-frame' instead. */)
/* Specify the parent under which to make this window. */
if (!NILP (parent))
{
- f->output_data.w32->parent_desc = (Window) XFASTINT (parent);
+ /* Cast to UINT_PTR shuts up compiler warnings about cast to
+ pointer from integer of different size. */
+ f->output_data.w32->parent_desc = (Window) (UINT_PTR) XFASTINT (parent);
f->output_data.w32->explicit_parent = 1;
}
else
@@ -7260,10 +7256,17 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
if (!NILP (item))
{
+ LPARAM lparam;
+
+ eassert (CONSP (item));
+ /* Pass the tail of the list as a pointer to a Lisp_Cons cell,
+ so that it works in a --with-wide-int build as well. */
+ lparam = (LPARAM) XUNTAG (item, Lisp_Cons);
+
/* Notify input thread about hot-key definition being removed, so
that it takes effect without needing focus switch. */
if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
- (WPARAM) XINT (XCAR (item)), (LPARAM) XLI (item)))
+ (WPARAM) XINT (XCAR (item)), lparam))
{
MSG msg;
GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -7318,10 +7321,15 @@ DEFUN ("w32-toggle-lock-key", Fw32_toggle_lock_key,
doc: /* Toggle the state of the lock key KEY.
KEY can be `capslock', `kp-numlock', or `scroll'.
If the optional parameter NEW-STATE is a number, then the state of KEY
-is set to off if the low bit of NEW-STATE is zero, otherwise on. */)
+is set to off if the low bit of NEW-STATE is zero, otherwise on.
+If NEW-STATE is omitted or nil, the function toggles the state,
+
+Value is the new state of the key, or nil if the function failed
+to change the state. */)
(Lisp_Object key, Lisp_Object new_state)
{
int vk_code;
+ LPARAM lparam;
if (EQ (key, intern ("capslock")))
vk_code = VK_CAPITAL;
@@ -7335,8 +7343,12 @@ is set to off if the low bit of NEW-STATE is zero, otherwise on. */)
if (!dwWindowsThreadId)
return make_number (w32_console_toggle_lock_key (vk_code, new_state));
+ if (NILP (new_state))
+ lparam = -1;
+ else
+ lparam = (XUINT (new_state)) & 1;
if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
- (WPARAM) vk_code, (LPARAM) XLI (new_state)))
+ (WPARAM) vk_code, lparam))
{
MSG msg;
GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);