aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2015-12-27 20:52:21 +0200
committerEli Zaretskii2015-12-27 20:52:21 +0200
commit3ad99c4674e670b73e7dcd8de3fa00b6dec4448f (patch)
treef3a40bad541f0e97499fee390040089c209bebcc /src
parentf9d87dd8791d4e77929f21e4f73d92ef966722cc (diff)
downloademacs-3ad99c4674e670b73e7dcd8de3fa00b6dec4448f.tar.gz
emacs-3ad99c4674e670b73e7dcd8de3fa00b6dec4448f.zip
Avoid leaving "ghost" of mouse pointer on MS-Windows
* src/w32term.c (frame_set_mouse_pixel_position): * src/w32fns.c (Fw32_mouse_absolute_pixel_position): Momentarily disable "mouse trails" when moving the mouse pointer. (Bug#22247) * src/w32term.c (frame_set_mouse_pixel_position): Include w32common.h.
Diffstat (limited to 'src')
-rw-r--r--src/w32fns.c11
-rw-r--r--src/w32term.c11
2 files changed, 22 insertions, 0 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index 4be322182ce..c1d9bff98ab 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -8093,11 +8093,22 @@ The coordinates X and Y are interpreted in pixels relative to a position
8093(0, 0) of the selected frame's display. */) 8093(0, 0) of the selected frame's display. */)
8094 (Lisp_Object x, Lisp_Object y) 8094 (Lisp_Object x, Lisp_Object y)
8095{ 8095{
8096 UINT trail_num = 0;
8097 BOOL ret = false;
8098
8096 CHECK_TYPE_RANGED_INTEGER (int, x); 8099 CHECK_TYPE_RANGED_INTEGER (int, x);
8097 CHECK_TYPE_RANGED_INTEGER (int, y); 8100 CHECK_TYPE_RANGED_INTEGER (int, y);
8098 8101
8099 block_input (); 8102 block_input ();
8103 /* When "mouse trails" are in effect, moving the mouse cursor
8104 sometimes leaves behind an annoying "ghost" of the pointer.
8105 Avoid that by momentarily switching off mouse trails. */
8106 if (os_subtype == OS_NT
8107 && w32_major_version + w32_minor_version >= 6)
8108 ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
8100 SetCursorPos (XINT (x), XINT (y)); 8109 SetCursorPos (XINT (x), XINT (y));
8110 if (ret)
8111 SystemParametersInfo (SPI_SETMOUSETRAILS, trail_num, NULL, 0);
8101 unblock_input (); 8112 unblock_input ();
8102 8113
8103 return Qnil; 8114 return Qnil;
diff --git a/src/w32term.c b/src/w32term.c
index 0b8bef239f8..60d64f7fd0f 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -23,6 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include "lisp.h" 23#include "lisp.h"
24#include "blockinput.h" 24#include "blockinput.h"
25#include "w32term.h" 25#include "w32term.h"
26#include "w32common.h" /* for OS version info */
26 27
27#include <ctype.h> 28#include <ctype.h>
28#include <errno.h> 29#include <errno.h>
@@ -6237,6 +6238,8 @@ x_set_window_size (struct frame *f, bool change_gravity,
6237void 6238void
6238frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) 6239frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
6239{ 6240{
6241 UINT trail_num = 0;
6242 BOOL ret = false;
6240 RECT rect; 6243 RECT rect;
6241 POINT pt; 6244 POINT pt;
6242 6245
@@ -6247,7 +6250,15 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
6247 pt.y = rect.top + pix_y; 6250 pt.y = rect.top + pix_y;
6248 ClientToScreen (FRAME_W32_WINDOW (f), &pt); 6251 ClientToScreen (FRAME_W32_WINDOW (f), &pt);
6249 6252
6253 /* When "mouse trails" are in effect, moving the mouse cursor
6254 sometimes leaves behind an annoying "ghost" of the pointer.
6255 Avoid that by momentarily switching off mouse trails. */
6256 if (os_subtype == OS_NT
6257 && w32_major_version + w32_minor_version >= 6)
6258 ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
6250 SetCursorPos (pt.x, pt.y); 6259 SetCursorPos (pt.x, pt.y);
6260 if (ret)
6261 SystemParametersInfo (SPI_SETMOUSETRAILS, trail_num, NULL, 0);
6251 6262
6252 unblock_input (); 6263 unblock_input ();
6253} 6264}