aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32fns.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/w32fns.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/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)
2543 thread-safe. The next line is okay because the cons 2543 thread-safe. The next line is okay because the cons
2544 cell is never made into garbage and is not relocated by 2544 cell is never made into garbage and is not relocated by
2545 GC. */ 2545 GC. */
2546 XSETCAR (XIL ((EMACS_INT) msg.lParam), Qnil); 2546 XSETCAR (make_lisp_ptr ((void *)msg.lParam, Lisp_Cons), Qnil);
2547 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) 2547 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
2548 emacs_abort (); 2548 emacs_abort ();
2549 break; 2549 break;
@@ -2551,16 +2551,10 @@ w32_msg_pump (deferred_msg * msg_buf)
2551 { 2551 {
2552 int vk_code = (int) msg.wParam; 2552 int vk_code = (int) msg.wParam;
2553 int cur_state = (GetKeyState (vk_code) & 1); 2553 int cur_state = (GetKeyState (vk_code) & 1);
2554 Lisp_Object new_state = XIL ((EMACS_INT) msg.lParam); 2554 int new_state = msg.lParam;
2555 2555
2556 /* NB: This code must be thread-safe. It is safe to 2556 if (new_state == -1
2557 call NILP because symbols are not relocated by GC, 2557 || ((new_state & 1) != cur_state))
2558 and pointer here is not touched by GC (so the markbit
2559 can't be set). Numbers are safe because they are
2560 immediate values. */
2561 if (NILP (new_state)
2562 || (NUMBERP (new_state)
2563 && ((XUINT (new_state)) & 1) != cur_state))
2564 { 2558 {
2565 one_w32_display_info.faked_key = vk_code; 2559 one_w32_display_info.faked_key = vk_code;
2566 2560
@@ -4523,7 +4517,9 @@ This function is an internal primitive--use `make-frame' instead. */)
4523 /* Specify the parent under which to make this window. */ 4517 /* Specify the parent under which to make this window. */
4524 if (!NILP (parent)) 4518 if (!NILP (parent))
4525 { 4519 {
4526 f->output_data.w32->parent_desc = (Window) XFASTINT (parent); 4520 /* Cast to UINT_PTR shuts up compiler warnings about cast to
4521 pointer from integer of different size. */
4522 f->output_data.w32->parent_desc = (Window) (UINT_PTR) XFASTINT (parent);
4527 f->output_data.w32->explicit_parent = 1; 4523 f->output_data.w32->explicit_parent = 1;
4528 } 4524 }
4529 else 4525 else
@@ -7260,10 +7256,17 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
7260 7256
7261 if (!NILP (item)) 7257 if (!NILP (item))
7262 { 7258 {
7259 LPARAM lparam;
7260
7261 eassert (CONSP (item));
7262 /* Pass the tail of the list as a pointer to a Lisp_Cons cell,
7263 so that it works in a --with-wide-int build as well. */
7264 lparam = (LPARAM) XUNTAG (item, Lisp_Cons);
7265
7263 /* Notify input thread about hot-key definition being removed, so 7266 /* Notify input thread about hot-key definition being removed, so
7264 that it takes effect without needing focus switch. */ 7267 that it takes effect without needing focus switch. */
7265 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY, 7268 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
7266 (WPARAM) XINT (XCAR (item)), (LPARAM) XLI (item))) 7269 (WPARAM) XINT (XCAR (item)), lparam))
7267 { 7270 {
7268 MSG msg; 7271 MSG msg;
7269 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); 7272 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -7318,10 +7321,15 @@ DEFUN ("w32-toggle-lock-key", Fw32_toggle_lock_key,
7318 doc: /* Toggle the state of the lock key KEY. 7321 doc: /* Toggle the state of the lock key KEY.
7319KEY can be `capslock', `kp-numlock', or `scroll'. 7322KEY can be `capslock', `kp-numlock', or `scroll'.
7320If the optional parameter NEW-STATE is a number, then the state of KEY 7323If the optional parameter NEW-STATE is a number, then the state of KEY
7321is set to off if the low bit of NEW-STATE is zero, otherwise on. */) 7324is set to off if the low bit of NEW-STATE is zero, otherwise on.
7325If NEW-STATE is omitted or nil, the function toggles the state,
7326
7327Value is the new state of the key, or nil if the function failed
7328to change the state. */)
7322 (Lisp_Object key, Lisp_Object new_state) 7329 (Lisp_Object key, Lisp_Object new_state)
7323{ 7330{
7324 int vk_code; 7331 int vk_code;
7332 LPARAM lparam;
7325 7333
7326 if (EQ (key, intern ("capslock"))) 7334 if (EQ (key, intern ("capslock")))
7327 vk_code = VK_CAPITAL; 7335 vk_code = VK_CAPITAL;
@@ -7335,8 +7343,12 @@ is set to off if the low bit of NEW-STATE is zero, otherwise on. */)
7335 if (!dwWindowsThreadId) 7343 if (!dwWindowsThreadId)
7336 return make_number (w32_console_toggle_lock_key (vk_code, new_state)); 7344 return make_number (w32_console_toggle_lock_key (vk_code, new_state));
7337 7345
7346 if (NILP (new_state))
7347 lparam = -1;
7348 else
7349 lparam = (XUINT (new_state)) & 1;
7338 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY, 7350 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
7339 (WPARAM) vk_code, (LPARAM) XLI (new_state))) 7351 (WPARAM) vk_code, lparam))
7340 { 7352 {
7341 MSG msg; 7353 MSG msg;
7342 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); 7354 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);