unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: emacs-devel <emacs-devel@gnu.org>
Subject: make-pointer-invisible on Windows
Date: Wed, 24 Jun 2015 11:17:58 +0200	[thread overview]
Message-ID: <558A75C6.7040003@gmx.at> (raw)

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

I intend to apply the attached patch in order to fix this problem for
the Windows build (see Bug#6105 and Bug#12922).  Comments welcome.

Thanks, martin

[-- Attachment #2: make-pointer-invisible.diff --]
[-- Type: text/plain, Size: 2639 bytes --]

--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -3974,11 +3974,17 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
       if (LOWORD (lParam) == HTCLIENT)
 	{
 	  f = x_window_to_frame (dpyinfo, hwnd);
-	  if (f && f->output_data.w32->hourglass_p
-	      && !menubar_in_use && !current_popup_menu)
-	    SetCursor (f->output_data.w32->hourglass_cursor);
-	  else if (f)
-	    SetCursor (f->output_data.w32->current_cursor);
+	  if (f)
+	    {
+	      if (f->output_data.w32->hourglass_p
+		  && !menubar_in_use && !current_popup_menu)
+		SetCursor (f->output_data.w32->hourglass_cursor);
+	      else if (f->pointer_invisible)
+		SetCursor (NULL);
+	      else
+		SetCursor (f->output_data.w32->current_cursor);
+	    }
+
 	  return 0;
 	}
       goto dflt;
@@ -3991,7 +3997,12 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 	  {
 	    f->output_data.w32->current_cursor = cursor;
 	    if (!f->output_data.w32->hourglass_p)
-	      SetCursor (cursor);
+	      {
+		if (f->pointer_invisible)
+		  SetCursor (NULL);
+		else
+		  SetCursor (cursor);
+	      }
 	  }
 	return 0;
       }
diff --git a/src/w32term.c b/src/w32term.c
index b7c6e13..7c5f2db 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -6590,7 +6590,10 @@ w32_hide_hourglass (struct frame *f)
   struct w32_output *w32 = FRAME_X_OUTPUT (f);
 
   w32->hourglass_p = 0;
-  SetCursor (w32->current_cursor);
+  if (f->pointer_invisible)
+    SetCursor (NULL);
+  else
+    SetCursor (w32->current_cursor);
 }
 
 /* FIXME: old code did that, but I don't know why.  Anyway,
@@ -6602,6 +6605,25 @@ w32_arrow_cursor (void)
   SetCursor (w32_load_cursor (IDC_ARROW));
 }
 
+static void
+w32_toggle_invisible_pointer (struct frame *f, bool invisible)
+{
+  block_input ();
+
+  if (f->pointer_invisible != invisible)
+    {
+      f->pointer_invisible = invisible;
+      SET_FRAME_GARBAGED (f);
+    }
+
+  if (invisible)
+    SetCursor (NULL);
+  else
+    SetCursor (f->output_data.w32->current_cursor);
+
+  unblock_input ();
+}
+
 /***********************************************************************
 			    Initialization
  ***********************************************************************/
@@ -6741,6 +6763,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
   terminal->ins_del_lines_hook = x_ins_del_lines;
   terminal->delete_glyphs_hook = x_delete_glyphs;
   terminal->ring_bell_hook = w32_ring_bell;
+  terminal->toggle_invisible_pointer_hook = w32_toggle_invisible_pointer;
   terminal->update_begin_hook = x_update_begin;
   terminal->update_end_hook = x_update_end;
   terminal->read_socket_hook = w32_read_socket;


             reply	other threads:[~2015-06-24  9:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24  9:17 martin rudalics [this message]
2015-06-24 14:50 ` make-pointer-invisible on Windows Eli Zaretskii
2015-06-24 17:40   ` martin rudalics
2015-06-24 19:21     ` Eli Zaretskii
2015-06-25  6:36       ` martin rudalics
2015-06-25 15:02         ` Eli Zaretskii
2015-06-26  6:55           ` martin rudalics
2015-06-26  8:43             ` Eli Zaretskii
2015-06-26  9:15               ` martin rudalics
2015-06-26  9:39                 ` Eli Zaretskii
2015-06-26 10:14                   ` martin rudalics
2015-06-26 10:24                     ` Eli Zaretskii
2015-06-28 14:52                       ` Eli Zaretskii
2015-06-29  9:46                         ` martin rudalics
2015-06-28 14:51                   ` Eli Zaretskii
2015-06-29  9:45                     ` martin rudalics
2015-06-29 14:43                       ` Eli Zaretskii
2015-06-29 17:16                         ` martin rudalics
2015-06-29 17:40                           ` Eli Zaretskii
2015-06-30  6:01                             ` martin rudalics
2015-06-30 15:09                               ` Eli Zaretskii
2015-07-02 13:21                                 ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=558A75C6.7040003@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).