]> code.delx.au - gnu-emacs/blobdiff - src/w32fns.c
Merge latest Org fixes (commit 7524ef2).
[gnu-emacs] / src / w32fns.c
index 28a689ddc6c67106bffe8db9977eddf754b6eb8a..289b1e6043c71254ae180062dfa14969613a440d 100644 (file)
@@ -1,6 +1,6 @@
 /* Graphical user interface functions for the Microsoft Windows API.
 
-Copyright (C) 1989, 1992-201 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2013 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -80,7 +80,6 @@ void syms_of_w32fns (void);
 void globals_of_w32fns (void);
 
 extern void free_frame_menubar (struct frame *);
-extern double atof (const char *);
 extern int w32_console_toggle_lock_key (int, Lisp_Object);
 extern void w32_menu_display_help (HWND, HMENU, UINT, UINT);
 extern void w32_free_menu_strings (HWND);
@@ -211,7 +210,7 @@ static void w32_show_hourglass (struct frame *);
 static void w32_hide_hourglass (void);
 
 #ifdef WINDOWSNT
-/* From w32inevet.c */
+/* From w32inevt.c */
 extern int faked_key;
 #endif /* WINDOWSNT */
 
@@ -221,7 +220,7 @@ SYSTEM_INFO sysinfo_cache;
 /* This gives us version, build, and platform identification.  */
 OSVERSIONINFO osinfo_cache;
 
-unsigned long syspage_mask = 0;
+DWORD_PTR syspage_mask = 0;
 
 /* The major and minor versions of NT.  */
 int w32_major_version;
@@ -2333,7 +2332,9 @@ w32_name_of_message (UINT msg)
 }
 #endif /* EMACSDEBUG */
 
-/* Here's an overview of how Emacs input works on MS-Windows.
+/* Here's an overview of how Emacs input works in GUI sessions on
+   MS-Windows.  (For description of non-GUI input, see the commentary
+   before w32_console_read_socket in w32inevt.c.)
 
    System messages are read and processed by w32_msg_pump below.  This
    function runs in a separate thread.  It handles a small number of
@@ -2422,7 +2423,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 ((Lisp_Object) ((EMACS_INT) msg.lParam), Qnil);
+             XSETCAR (XIL ((EMACS_INT) msg.lParam), Qnil);
              if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
                emacs_abort ();
              break;
@@ -2430,7 +2431,7 @@ w32_msg_pump (deferred_msg * msg_buf)
              {
                int vk_code = (int) msg.wParam;
                int cur_state = (GetKeyState (vk_code) & 1);
-               Lisp_Object new_state = (Lisp_Object) ((EMACS_INT) msg.lParam);
+               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,
@@ -3329,7 +3330,19 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         versions, there is no way of telling when the mouse leaves the
         frame, so we just have to put up with help-echo and mouse
         highlighting remaining while the frame is not active.  */
-      if (track_mouse_event_fn && !track_mouse_window)
+      if (track_mouse_event_fn && !track_mouse_window
+         /* If the menu bar is active, turning on tracking of mouse
+            movement events might send these events to the tooltip
+            frame, if the user happens to move the mouse pointer over
+            the tooltip.  But since we don't process events for
+            tooltip frames, this causes Windows to present a
+            hourglass cursor, which is ugly and unexpected.  So don't
+            enable tracking mouse events in this case; they will be
+            restarted when the menu pops down.  (Confusingly, the
+            menubar_active member of f->output_data.w32, tested
+            above, is only set when a menu was popped up _not_ from
+            the frame's menu bar, but via x-popup-menu.)  */
+         && !menubar_in_use)
        {
          TRACKMOUSEEVENT tme;
          tme.cbSize = sizeof (tme);
@@ -6005,7 +6018,7 @@ typedef char guichar_t;
    read-only when "Directories" is selected in the filter.  This
    allows us to work around the fact that the standard Open File
    dialog does not support directories.  */
-static UINT CALLBACK
+static UINT_PTR CALLBACK
 file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
   if (msg == WM_NOTIFY)
@@ -6137,9 +6150,9 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories.  */)
       filename = empty_unibyte_string;
 
 #ifdef CYGWIN
-    dir = Fcygwin_convert_path_to_windows (dir, Qt);
+    dir = Fcygwin_convert_file_name_to_windows (dir, Qt);
     if (SCHARS (filename) > 0)
-      filename = Fcygwin_convert_path_to_windows (filename, Qnil);
+      filename = Fcygwin_convert_file_name_to_windows (filename, Qnil);
 #endif
 
     CHECK_STRING (dir);
@@ -6240,7 +6253,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories.  */)
 #endif /* NTGUI_UNICODE */
 
 #ifdef CYGWIN
-        filename = Fcygwin_convert_path_from_windows (filename, Qt);
+        filename = Fcygwin_convert_file_name_from_windows (filename, Qt);
 #endif /* CYGWIN */
 
         /* Strip the dummy filename off the end of the string if we
@@ -7019,7 +7032,7 @@ cache_system_info (void)
 
   /* Cache page size, allocation unit, processor type, etc.  */
   GetSystemInfo (&sysinfo_cache);
-  syspage_mask = sysinfo_cache.dwPageSize - 1;
+  syspage_mask = (DWORD_PTR)sysinfo_cache.dwPageSize - 1;
 
   /* Cache os info.  */
   osinfo_cache.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
@@ -7709,4 +7722,3 @@ emacs_abort (void)
       break;
     }
 }
-