New unwind-protect flavors to better type-check C callbacks.
[bpt/emacs.git] / src / w32inevt.c
index 878106d..88a3f97 100644 (file)
@@ -1,5 +1,6 @@
 /* Input event support for Emacs on the Microsoft Windows API.
-   Copyright (C) 1992-1993, 1995, 2001-2012  Free Software Foundation, Inc.
+   Copyright (C) 1992-1993, 1995, 2001-2013 Free Software Foundation,
+   Inc.
 
 This file is part of GNU Emacs.
 
@@ -576,6 +577,7 @@ maybe_generate_resize_event (void)
                     0, 0, 0);
 }
 
+#if HAVE_W32NOTIFY
 static int
 handle_file_notifications (struct input_event *hold_quit)
 {
@@ -599,7 +601,7 @@ handle_file_notifications (struct input_event *hold_quit)
     {
       DWORD info_size = notifications_size;
       Lisp_Object cs = intern ("utf-16le");
-      Lisp_Object obj = w32_get_watch_object (make_number (notifications_desc));
+      Lisp_Object obj = w32_get_watch_object (notifications_desc);
 
       /* notifications_size could be zero when the buffer of
         notifications overflowed on the OS level, or when the
@@ -624,7 +626,7 @@ 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)notifications_desc;
+             inev.code = (ptrdiff_t)XINT (XIL ((EMACS_INT)notifications_desc));
              inev.timestamp = GetTickCount ();
              inev.modifiers = 0;
              inev.frame_or_window = callback;
@@ -643,6 +645,13 @@ handle_file_notifications (struct input_event *hold_quit)
   leave_crit ();
   return nevents;
 }
+#else  /* !HAVE_W32NOTIFY */
+static int
+handle_file_notifications (struct input_event *hold_quit)
+{
+  return 0;
+}
+#endif /* !HAVE_W32NOTIFY */
 
 /* Here's an overview of how Emacs input works in non-GUI sessions on
    MS-Windows.  (For description of the GUI input, see the commentary