]> git.eshelyaron.com Git - emacs.git/commitdiff
Provide invisible mouse pointers on Windows. (Bug#6105) (Bug#12922)
authorMartin Rudalics <rudalics@gmx.at>
Fri, 26 Jun 2015 06:28:08 +0000 (08:28 +0200)
committerMartin Rudalics <rudalics@gmx.at>
Fri, 26 Jun 2015 06:28:08 +0000 (08:28 +0200)
* src/w32fns.c (w32_wnd_proc): Handle f->pointer_invisible
for WM_SETCURSOR and WM_EMACS_SETCURSOR cases.
* src/w32term.c (w32_hide_hourglass): Handle
f->pointer_invisible.
(w32_toggle_invisible_pointer): New function.
(w32_create_terminal): Add w32_toggle_invisible_pointer as
toggle_invisible_pointer_hook for this terminal.

src/w32fns.c
src/w32term.c

index 5f40729011e91628e430580109e1eae3299c1767..180d326bc98ff7fe8ae51df76bb72604f74b9947 100644 (file)
@@ -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;
       }
index b7c6e13c8a88dd9f581935c08b463e7a7772c6e4..7c5f2db3a4cd8e29251daf8590527114170de5fb 100644 (file)
@@ -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;