[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 3ad99c4: Avoid leaving "ghost" of mouse pointer o
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-25 3ad99c4: Avoid leaving "ghost" of mouse pointer on MS-Windows |
Date: |
Sun, 27 Dec 2015 18:52:12 +0000 |
branch: emacs-25
commit 3ad99c4674e670b73e7dcd8de3fa00b6dec4448f
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
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.
---
src/w32fns.c | 11 +++++++++++
src/w32term.c | 11 +++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/w32fns.c b/src/w32fns.c
index 4be3221..c1d9bff 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
(0, 0) of the selected frame's display. */)
(Lisp_Object x, Lisp_Object y)
{
+ UINT trail_num = 0;
+ BOOL ret = false;
+
CHECK_TYPE_RANGED_INTEGER (int, x);
CHECK_TYPE_RANGED_INTEGER (int, y);
block_input ();
+ /* When "mouse trails" are in effect, moving the mouse cursor
+ sometimes leaves behind an annoying "ghost" of the pointer.
+ Avoid that by momentarily switching off mouse trails. */
+ if (os_subtype == OS_NT
+ && w32_major_version + w32_minor_version >= 6)
+ ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
SetCursorPos (XINT (x), XINT (y));
+ if (ret)
+ SystemParametersInfo (SPI_SETMOUSETRAILS, trail_num, NULL, 0);
unblock_input ();
return Qnil;
diff --git a/src/w32term.c b/src/w32term.c
index 0b8bef2..60d64f7 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/>. */
#include "lisp.h"
#include "blockinput.h"
#include "w32term.h"
+#include "w32common.h" /* for OS version info */
#include <ctype.h>
#include <errno.h>
@@ -6237,6 +6238,8 @@ x_set_window_size (struct frame *f, bool change_gravity,
void
frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
{
+ UINT trail_num = 0;
+ BOOL ret = false;
RECT rect;
POINT pt;
@@ -6247,7 +6250,15 @@ frame_set_mouse_pixel_position (struct frame *f, int
pix_x, int pix_y)
pt.y = rect.top + pix_y;
ClientToScreen (FRAME_W32_WINDOW (f), &pt);
+ /* When "mouse trails" are in effect, moving the mouse cursor
+ sometimes leaves behind an annoying "ghost" of the pointer.
+ Avoid that by momentarily switching off mouse trails. */
+ if (os_subtype == OS_NT
+ && w32_major_version + w32_minor_version >= 6)
+ ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
SetCursorPos (pt.x, pt.y);
+ if (ret)
+ SystemParametersInfo (SPI_SETMOUSETRAILS, trail_num, NULL, 0);
unblock_input ();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 3ad99c4: Avoid leaving "ghost" of mouse pointer on MS-Windows,
Eli Zaretskii <=