]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix invisible mouse pointers on Windows.
authorEli Zaretskii <eliz@gnu.org>
Fri, 26 Jun 2015 06:45:29 +0000 (08:45 +0200)
committerMartin Rudalics <rudalics@gmx.at>
Fri, 26 Jun 2015 06:45:29 +0000 (08:45 +0200)
* src/w32fns.c: Include windowsx.h.
(w32_wnd_proc): If the mouse moved and the mouse pointer is
invisible, make it visible again even when the main (Lisp)
thread is busy.
* src/w32term.c (w32_toggle_invisible_pointer): Rather then
garbaging the frame have the input thread call SetCursor.

src/w32fns.c
src/w32term.c

index 180d326bc98ff7fe8ae51df76bb72604f74b9947..836dc10118d6ebf46d62ac92ca7e4f57247ecbac 100644 (file)
@@ -73,6 +73,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <dlgs.h>
 #include <imm.h>
+#include <windowsx.h>
 
 #include "font.h"
 #include "w32font.h"
@@ -3493,13 +3494,31 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
       return (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONUP);
 
     case WM_MOUSEMOVE:
-      /* Ignore mouse movements as long as the menu is active.  These
-        movements are processed by the window manager anyway, and
-        it's wrong to handle them as if they happened on the
-        underlying frame.  */
       f = x_window_to_frame (dpyinfo, hwnd);
-      if (f && f->output_data.w32->menubar_active)
-       return 0;
+      if (f)
+       {
+         /* Ignore mouse movements as long as the menu is active.
+            These movements are processed by the window manager
+            anyway, and it's wrong to handle them as if they happened
+            on the underlying frame.  */
+         if (f->output_data.w32->menubar_active)
+           return 0;
+
+         /* If the mouse moved, and the mouse pointer is invisible,
+            make it visible again.  We do this here so as to be able
+            to show the mouse pointer even when the main
+            (a.k.a. "Lisp") thread is busy doing something.  */
+         static int last_x, last_y;
+         int x = GET_X_LPARAM (lParam);
+         int y = GET_Y_LPARAM (lParam);
+
+         if (f->pointer_invisible
+             && (x != last_x || y != last_y))
+           f->pointer_invisible = false;
+
+         last_x = x;
+         last_y = y;
+       }
 
       /* If the mouse has just moved into the frame, start tracking
         it, so we will be notified when it leaves the frame.  Mouse
index 7c5f2db3a4cd8e29251daf8590527114170de5fb..fbd31b15de2de8c4dbc8f4777053d964e255623c 100644 (file)
@@ -6613,14 +6613,10 @@ w32_toggle_invisible_pointer (struct frame *f, bool invisible)
   if (f->pointer_invisible != invisible)
     {
       f->pointer_invisible = invisible;
-      SET_FRAME_GARBAGED (f);
+      w32_define_cursor (FRAME_W32_WINDOW (f),
+                        f->output_data.w32->current_cursor);
     }
 
-  if (invisible)
-    SetCursor (NULL);
-  else
-    SetCursor (f->output_data.w32->current_cursor);
-
   unblock_input ();
 }