From 485763c0dcdc4f5ab1030f4bae6acbbe0ce9497e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 10 Jan 2015 13:27:35 +0200 Subject: [PATCH] MS-Windows followup for change in semantics of XIL and XLI. (Bug#15880) src/w32fns.c (Fw32_register_hot_key): Use XINT instead of XLI. src/w32notify.c (Fw32notify_add_watch, w32_get_watch_object): Use make_pointer_integer instead of XIL. (Fw32notify_rm_watch): Use XINTPTR instead of XLI. src/w32inevt.c (handle_file_notifications): Use make_pointer_integer instead of XIL. Put a list of the descriptor, action, and file name in event->arg, instead of spreading them between event->code and event->arg. src/w32term.c (queue_notifications): Use make_pointer_integer instead of XIL. Put a list of the descriptor, action, and file name in event->arg, instead of spreading them between event->code and event->arg. src/keyboard.c (kbd_buffer_get_event) [HAVE_W32NOTIFY]: Adjust Lisp event creation to changes in w32term.c and w32inevt.c above. --- src/ChangeLog | 21 +++++++++++++++++++++ src/keyboard.c | 6 +----- src/w32fns.c | 2 +- src/w32inevt.c | 3 ++- src/w32notify.c | 6 +++--- src/w32term.c | 5 ++--- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c11ba11715b..b6358d0e66d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,24 @@ +2015-01-10 Eli Zaretskii + + * w32fns.c (Fw32_register_hot_key): Use XINT instead of XLI. + + * w32notify.c (Fw32notify_add_watch, w32_get_watch_object): Use + make_pointer_integer instead of XIL. + (Fw32notify_rm_watch): Use XINTPTR instead of XLI. + + * w32inevt.c (handle_file_notifications): Use make_pointer_integer + instead of XIL. Put a list of the descriptor, action, and file + name in event->arg, instead of spreading them between event->code + and event->arg. + + * w32term.c (queue_notifications): Use make_pointer_integer + instead of XIL. Put a list of the descriptor, action, and file + name in event->arg, instead of spreading them between event->code + and event->arg. + + * keyboard.c (kbd_buffer_get_event) [HAVE_W32NOTIFY]: Adjust Lisp + event creation to changes in w32term.c and w32inevt.c above. + 2015-01-09 Paul Eggert Refactor pointer-to-integer conversion diff --git a/src/keyboard.c b/src/keyboard.c index c177c804bad..2a50003038d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4025,11 +4025,7 @@ kbd_buffer_get_event (KBOARD **kbp, { #ifdef HAVE_W32NOTIFY /* Make an event (file-notify (DESCRIPTOR ACTION FILE) CALLBACK). */ - obj = list3 (Qfile_notify, - list3 (make_number (event->code), - XCAR (event->arg), - XCDR (event->arg)), - event->frame_or_window); + obj = list3 (Qfile_notify, event->arg, event->frame_or_window); #else obj = make_lispy_event (event); #endif diff --git a/src/w32fns.c b/src/w32fns.c index ced3d87dd66..789a91a3c96 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -7235,7 +7235,7 @@ The return value is the hotkey-id if registered, otherwise nil. */) /* Notify input thread about new hot-key definition, so that it takes effect without needing to switch focus. */ PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY, - (WPARAM) XLI (key), 0); + (WPARAM) XINT (key), 0); } return key; diff --git a/src/w32inevt.c b/src/w32inevt.c index daf4a5c2375..e09903f99be 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -657,11 +657,12 @@ handle_file_notifications (struct input_event *hold_quit) Lisp_Object action = lispy_file_action (fni->Action); inev.kind = FILE_NOTIFY_EVENT; - inev.code = (ptrdiff_t)XINT (XIL ((EMACS_INT)notifications_desc)); inev.timestamp = GetTickCount (); inev.modifiers = 0; inev.frame_or_window = callback; inev.arg = Fcons (action, fname); + inev.arg = list3 (make_pointer_integer (notifications_desc), + action, fname); kbd_buffer_store_event_hold (&inev, hold_quit); if (!fni->NextEntryOffset) diff --git a/src/w32notify.c b/src/w32notify.c index a0d555b4786..ab6cd12ab93 100644 --- a/src/w32notify.c +++ b/src/w32notify.c @@ -580,7 +580,7 @@ generate notifications correctly, though. */) report_file_error ("Cannot watch file", Fcons (file, Qnil)); } /* Store watch object in watch list. */ - watch_descriptor = XIL ((EMACS_INT)dirwatch); + watch_descriptor = make_pointer_integer (dirwatch); watch_object = Fcons (watch_descriptor, callback); watch_list = Fcons (watch_object, watch_list); @@ -605,7 +605,7 @@ WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. */) if (!NILP (watch_object)) { watch_list = Fdelete (watch_object, watch_list); - dirwatch = (struct notification *)XLI (watch_descriptor); + dirwatch = (struct notification *)XINTPTR (watch_descriptor); if (w32_valid_pointer_p (dirwatch, sizeof(struct notification))) status = remove_watch (dirwatch); } @@ -620,7 +620,7 @@ WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. */) Lisp_Object w32_get_watch_object (void *desc) { - Lisp_Object descriptor = XIL ((EMACS_INT)desc); + Lisp_Object descriptor = make_pointer_integer (desc); /* This is called from the input queue handling code, inside a critical section, so we cannot possibly QUIT if watch_list is not diff --git a/src/w32term.c b/src/w32term.c index 8a53a58189a..ce28e05a45b 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -3247,12 +3247,11 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f, Lisp_Object action = lispy_file_action (fni->Action); event->kind = FILE_NOTIFY_EVENT; - event->code - = (ptrdiff_t)XINT (XIL ((EMACS_INT)notifications_desc)); event->timestamp = msg->msg.time; event->modifiers = 0; event->frame_or_window = callback; - event->arg = Fcons (action, fname); + event->arg = list3 (make_pointer_integer (notifications_desc), + action, fname); kbd_buffer_store_event (event); (*evcount)++; -- 2.39.2