aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-06-26 08:45:29 +0200
committerMartin Rudalics2015-06-26 08:45:29 +0200
commitf14275633851b047e5aecfa6d12f160ee4c2f149 (patch)
tree202f93d6fd80e173f7e1b0f04d0cc07738ea7649
parent605765af40831390be93264b36b31fad56907554 (diff)
downloademacs-f14275633851b047e5aecfa6d12f160ee4c2f149.tar.gz
emacs-f14275633851b047e5aecfa6d12f160ee4c2f149.zip
Fix invisible mouse pointers on Windows.
* 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.
-rw-r--r--src/w32fns.c31
-rw-r--r--src/w32term.c8
2 files changed, 27 insertions, 12 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index 180d326bc98..836dc10118d 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -73,6 +73,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
73 73
74#include <dlgs.h> 74#include <dlgs.h>
75#include <imm.h> 75#include <imm.h>
76#include <windowsx.h>
76 77
77#include "font.h" 78#include "font.h"
78#include "w32font.h" 79#include "w32font.h"
@@ -3493,13 +3494,31 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3493 return (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONUP); 3494 return (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONUP);
3494 3495
3495 case WM_MOUSEMOVE: 3496 case WM_MOUSEMOVE:
3496 /* Ignore mouse movements as long as the menu is active. These
3497 movements are processed by the window manager anyway, and
3498 it's wrong to handle them as if they happened on the
3499 underlying frame. */
3500 f = x_window_to_frame (dpyinfo, hwnd); 3497 f = x_window_to_frame (dpyinfo, hwnd);
3501 if (f && f->output_data.w32->menubar_active) 3498 if (f)
3502 return 0; 3499 {
3500 /* Ignore mouse movements as long as the menu is active.
3501 These movements are processed by the window manager
3502 anyway, and it's wrong to handle them as if they happened
3503 on the underlying frame. */
3504 if (f->output_data.w32->menubar_active)
3505 return 0;
3506
3507 /* If the mouse moved, and the mouse pointer is invisible,
3508 make it visible again. We do this here so as to be able
3509 to show the mouse pointer even when the main
3510 (a.k.a. "Lisp") thread is busy doing something. */
3511 static int last_x, last_y;
3512 int x = GET_X_LPARAM (lParam);
3513 int y = GET_Y_LPARAM (lParam);
3514
3515 if (f->pointer_invisible
3516 && (x != last_x || y != last_y))
3517 f->pointer_invisible = false;
3518
3519 last_x = x;
3520 last_y = y;
3521 }
3503 3522
3504 /* If the mouse has just moved into the frame, start tracking 3523 /* If the mouse has just moved into the frame, start tracking
3505 it, so we will be notified when it leaves the frame. Mouse 3524 it, so we will be notified when it leaves the frame. Mouse
diff --git a/src/w32term.c b/src/w32term.c
index 7c5f2db3a4c..fbd31b15de2 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -6613,14 +6613,10 @@ w32_toggle_invisible_pointer (struct frame *f, bool invisible)
6613 if (f->pointer_invisible != invisible) 6613 if (f->pointer_invisible != invisible)
6614 { 6614 {
6615 f->pointer_invisible = invisible; 6615 f->pointer_invisible = invisible;
6616 SET_FRAME_GARBAGED (f); 6616 w32_define_cursor (FRAME_W32_WINDOW (f),
6617 f->output_data.w32->current_cursor);
6617 } 6618 }
6618 6619
6619 if (invisible)
6620 SetCursor (NULL);
6621 else
6622 SetCursor (f->output_data.w32->current_cursor);
6623
6624 unblock_input (); 6620 unblock_input ();
6625} 6621}
6626 6622