unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* w32 hourglass cursor
@ 2014-07-03 10:35 Dmitry Antipov
  2014-07-03 16:18 ` Dani Moncayo
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Antipov @ 2014-07-03 10:35 UTC (permalink / raw)
  To: Emacs development discussions

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

Can someone test this small cleanup with trunk on MS-Windows?
This looks correct, but I can't verify it myself.

Dmitry

[-- Attachment #2: w32_hourglass_cursor.patch --]
[-- Type: text/x-patch, Size: 1198 bytes --]

=== modified file 'src/w32fns.c'
--- src/w32fns.c	2014-06-29 16:12:08 +0000
+++ src/w32fns.c	2014-07-03 10:28:58 +0000
@@ -5501,27 +5501,13 @@
  ***********************************************************************/
 
 void
-w32_note_current_window (void)
-{
-  struct frame * f = SELECTED_FRAME ();
-
-  if (!FRAME_W32_P (f))
-    return;
-
-  hourglass_hwnd = FRAME_W32_WINDOW (f);
-}
-
-void
 show_hourglass (struct atimer *timer)
 {
-  struct frame *f;
+  struct frame *f = (struct frame *) timer->client_data;
 
   hourglass_atimer = NULL;
 
   block_input ();
-  f = x_window_to_frame (&one_w32_display_info,
-				       hourglass_hwnd);
-
   if (f)
     f->output_data.w32->hourglass_p = 0;
   else

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2014-07-03 06:00:53 +0000
+++ src/xdisp.c	2014-07-03 10:29:14 +0000
@@ -30683,15 +30683,8 @@
   else
     delay = make_timespec (DEFAULT_HOURGLASS_DELAY, 0);
 
-#ifdef HAVE_NTGUI
-  {
-    extern void w32_note_current_window (void);
-    w32_note_current_window ();
-  }
-#endif /* HAVE_NTGUI */
-
   hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
-				   show_hourglass, NULL);
+				   show_hourglass, SELECTED_FRAME ());
 }
 
 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: w32 hourglass cursor
  2014-07-03 10:35 w32 hourglass cursor Dmitry Antipov
@ 2014-07-03 16:18 ` Dani Moncayo
  2014-07-03 16:30   ` Dmitry Antipov
  2014-07-03 16:42   ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Dani Moncayo @ 2014-07-03 16:18 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

On Thu, Jul 3, 2014 at 12:35 PM, Dmitry Antipov <dmantipov@yandex.ru> wrote:
> Can someone test this small cleanup with trunk on MS-Windows?
> This looks correct, but I can't verify it myself.

I've applied your patch to a recent trunk revision (r117347).  It
builds fine and the binary seems to work fine too, but I don't know
what specific test to do...

-- 
Dani Moncayo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: w32 hourglass cursor
  2014-07-03 16:18 ` Dani Moncayo
@ 2014-07-03 16:30   ` Dmitry Antipov
  2014-07-03 17:07     ` Dani Moncayo
  2014-07-03 16:42   ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry Antipov @ 2014-07-03 16:30 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: Emacs development discussions

On 07/03/2014 08:18 PM, Dani Moncayo wrote:

> I've applied your patch to a recent trunk revision (r117347).  It
> builds fine and the binary seems to work fine too, but I don't know
> what specific test to do...

That's simple:
1) go to *scratch*
2) define a macro to insert something, for example C-x ( a ENTER C-x )
    defines a macro to insert 'a' and newline;
3) ask to execute it 10000 times with C-u 10000 C-x e;
4) while the macro execution is in progress, move the mouse over
    Emacs frame and make sure that the cursor shape is changed and busy
    cursor appears.
5) Do M-x new-frame then repeat 1)-4) but move mouse between two frames
    and make sure that you have busy cursor in both of them.

Dmitry






^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: w32 hourglass cursor
  2014-07-03 16:18 ` Dani Moncayo
  2014-07-03 16:30   ` Dmitry Antipov
@ 2014-07-03 16:42   ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2014-07-03 16:42 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: dmantipov, emacs-devel

> Date: Thu, 3 Jul 2014 18:18:12 +0200
> From: Dani Moncayo <dmoncayo@gmail.com>
> Cc: Emacs development discussions <emacs-devel@gnu.org>
> 
> On Thu, Jul 3, 2014 at 12:35 PM, Dmitry Antipov <dmantipov@yandex.ru> wrote:
> > Can someone test this small cleanup with trunk on MS-Windows?
> > This looks correct, but I can't verify it myself.
> 
> I've applied your patch to a recent trunk revision (r117347).  It
> builds fine and the binary seems to work fine too

Thanks.

> but I don't know what specific test to do...

Please test the situation where Emacs shows the hourglass cursor,
i.e. some prolonged operation that causes the hourglass display.  The
specific issues to test are: that the hourglass appears after some
delay, and then disappears as soon as the prolonged operation
completes.  Also, try moving the mouse pointer to another frame and
see what happens.

TIA



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: w32 hourglass cursor
  2014-07-03 16:30   ` Dmitry Antipov
@ 2014-07-03 17:07     ` Dani Moncayo
  2014-07-03 17:33       ` Dmitry Antipov
  0 siblings, 1 reply; 8+ messages in thread
From: Dani Moncayo @ 2014-07-03 17:07 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

> 1) go to *scratch*
> 2) define a macro to insert something, for example C-x ( a ENTER C-x )
>    defines a macro to insert 'a' and newline;
> 3) ask to execute it 10000 times with C-u 10000 C-x e;
> 4) while the macro execution is in progress, move the mouse over
>    Emacs frame and make sure that the cursor shape is changed and busy
>    cursor appears.

The cursor's shape doesn't change until I move it (which doesn't seem
like TRT, but the same happens without the patch).

When I move the cursor, its shape change to busy, yes, but when the
execution ends (either by cancelling it with C-g or when it
completes), the shape remains the same (busy).  This problem is
specific to the patched binary.

> 5) Do M-x new-frame then repeat 1)-4) but move mouse between two frames
>    and make sure that you have busy cursor in both of them.

Here the behavior is equal with or without the patch: the cursor shape
is busy in the original frame (where I started the execution of the
macro) and normal (arrow or I-beam) when I go over the other frame.


-- 
Dani Moncayo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: w32 hourglass cursor
  2014-07-03 17:07     ` Dani Moncayo
@ 2014-07-03 17:33       ` Dmitry Antipov
  2014-07-03 17:53         ` Dani Moncayo
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Antipov @ 2014-07-03 17:33 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: Emacs development discussions

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

On 07/03/2014 09:07 PM, Dani Moncayo wrote:

> When I move the cursor, its shape change to busy, yes, but when the
> execution ends (either by cancelling it with C-g or when it
> completes), the shape remains the same (busy).  This problem is
> specific to the patched binary.

Hm....

>> 5) Do M-x new-frame then repeat 1)-4) but move mouse between two frames
>>     and make sure that you have busy cursor in both of them.
>
> Here the behavior is equal with or without the patch: the cursor shape
> is busy in the original frame (where I started the execution of the
> macro) and normal (arrow or I-beam) when I go over the other frame.

This is completely different from we have under X where busy cursor
is shown on all GUI frames. Could you also please test this stuff (which
is mostly borrowed from the relevant X code)?

Dmitry


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: w32_hourglass_cursor_2.patch --]
[-- Type: text/x-patch; name="w32_hourglass_cursor_2.patch", Size: 4536 bytes --]

=== modified file 'src/w32fns.c'
--- src/w32fns.c	2014-06-29 16:12:08 +0000
+++ src/w32fns.c	2014-07-03 17:25:36 +0000
@@ -89,9 +89,6 @@
 extern const char *map_w32_filename (const char *, const char **);
 extern char * w32_strerror (int error_no);
 
-/* If non-NULL, a handle to a frame where to display the hourglass cursor.  */
-static HWND hourglass_hwnd = NULL;
-
 #ifndef IDC_HAND
 #define IDC_HAND MAKEINTRESOURCE(32649)
 #endif
@@ -233,10 +230,6 @@
 extern void syms_of_w32uniscribe (void);
 extern int uniscribe_available;
 
-/* Function prototypes for hourglass support.  */
-static void w32_show_hourglass (struct frame *);
-static void w32_hide_hourglass (void);
-
 #ifdef WINDOWSNT
 /* From w32inevt.c */
 extern int faked_key;
@@ -5500,95 +5493,62 @@
 				Busy cursor
  ***********************************************************************/
 
-void
-w32_note_current_window (void)
-{
-  struct frame * f = SELECTED_FRAME ();
-
-  if (!FRAME_W32_P (f))
-    return;
-
-  hourglass_hwnd = FRAME_W32_WINDOW (f);
-}
+/* Display an hourglass cursor.  Set the hourglass_p flag in display info
+   to indicate that an hourglass cursor is shown.  */
 
 void
 show_hourglass (struct atimer *timer)
 {
-  struct frame *f;
-
   hourglass_atimer = NULL;
 
-  block_input ();
-  f = x_window_to_frame (&one_w32_display_info,
-				       hourglass_hwnd);
-
-  if (f)
-    f->output_data.w32->hourglass_p = 0;
-  else
-    f = SELECTED_FRAME ();
-
-  if (!FRAME_W32_P (f))
-    {
-      unblock_input ();
-      return;
-    }
-
-  w32_show_hourglass (f);
-  unblock_input ();
-}
-
-void
-hide_hourglass (void)
-{
-  block_input ();
-  w32_hide_hourglass ();
-  unblock_input ();
-}
-
-
-/* Display an hourglass cursor.  Set the hourglass_p flag in display info
-   to indicate that an hourglass cursor is shown.  */
-
-static void
-w32_show_hourglass (struct frame *f)
-{
   if (!hourglass_shown_p)
     {
-      f->output_data.w32->hourglass_p = 1;
-      if (!menubar_in_use && !current_popup_menu)
-	SetCursor (f->output_data.w32->hourglass_cursor);
+      Lisp_Oject tail, frame;
+
+      block_input ();
+      FOR_EACH_FRAME (tail, frame)
+	{
+	  struct frame *f = XFRAME (frame);
+
+	  if (FRAME_W32_P (f) && !menubar_in_use && !current_popup_menu)
+	    {
+	      f->output_data.w32->hourglass_p = 1;
+	      SetCursor (f->output_data.w32->hourglass_cursor);
+	    }
+	}
+      unblock_input ();
       hourglass_shown_p = 1;
     }
 }
 
-
 /* Hide the hourglass cursor on all frames, if it is currently shown.  */
 
-static void
-w32_hide_hourglass (void)
+void
+hide_hourglass (void)
 {
   if (hourglass_shown_p)
     {
-      struct frame *f = x_window_to_frame (&one_w32_display_info,
-					   hourglass_hwnd);
-      if (f)
-	f->output_data.w32->hourglass_p = 0;
-      else
-	/* If frame was deleted, restore to selected frame's cursor.  */
-	f = SELECTED_FRAME ();
-
-      if (FRAME_W32_P (f))
-	SetCursor (f->output_data.w32->current_cursor);
-      else
-	/* No cursors on non GUI frames - restore to stock arrow cursor.  */
-	SetCursor (w32_load_cursor (IDC_ARROW));
-
+      Lisp_Object tail, frame;
+
+      block_input ();
+      FOR_EACH_FRAME (tail, frame)
+	{
+	  struct frame *f = XFRAME (frame);
+
+	  if (FRAME_W32_P (f))
+	    {
+	      f->output_data.w32->hourglass_p = 0;
+	      SetCursor (f->output_data.w32->current_cursor);
+	    }
+	  else
+	    /* No cursors on non GUI frames - restore to stock arrow cursor.  */
+	    SetCursor (w32_load_cursor (IDC_ARROW));
+	}
+      unblock_input ();
       hourglass_shown_p = 0;
     }
 }
 
-
-\f
 /***********************************************************************
 				Tool tips
  ***********************************************************************/
@@ -8415,9 +8375,6 @@
 #endif
 
   defsubr (&Sset_message_beep);
-
-  hourglass_hwnd = NULL;
-
   defsubr (&Sx_show_tip);
   defsubr (&Sx_hide_tip);
   tip_timer = Qnil;

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2014-07-03 06:00:53 +0000
+++ src/xdisp.c	2014-07-03 17:24:15 +0000
@@ -30683,13 +30683,6 @@
   else
     delay = make_timespec (DEFAULT_HOURGLASS_DELAY, 0);
 
-#ifdef HAVE_NTGUI
-  {
-    extern void w32_note_current_window (void);
-    w32_note_current_window ();
-  }
-#endif /* HAVE_NTGUI */
-
   hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
 				   show_hourglass, NULL);
 }


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: w32 hourglass cursor
  2014-07-03 17:33       ` Dmitry Antipov
@ 2014-07-03 17:53         ` Dani Moncayo
  2014-07-03 18:15           ` Dmitry Antipov
  0 siblings, 1 reply; 8+ messages in thread
From: Dani Moncayo @ 2014-07-03 17:53 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

> This is completely different from we have under X where busy cursor
> is shown on all GUI frames. Could you also please test this stuff (which
> is mostly borrowed from the relevant X code)?

Your second patch has a typo: "Lisp_Oject" should be "Lisp_Object".

With this one, things seem to go better.

When I run the macro:
* The cursor shape doesn't change automatically to busy after any
delay (I've waited for 10-15 seconds).  Ok, this problem isn't new.
* When I move the cursor, its shape changes to busy.

When I cancel the macro, its shape changes back to normal.

With two frames, the shape is busy on both of them while the macro is
running, and changes back to normal on both frames after cancelling
the execution.

-- 
Dani Moncayo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: w32 hourglass cursor
  2014-07-03 17:53         ` Dani Moncayo
@ 2014-07-03 18:15           ` Dmitry Antipov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Antipov @ 2014-07-03 18:15 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: Emacs development discussions

On 07/03/2014 09:53 PM, Dani Moncayo wrote:

> With this one, things seem to go better.

I hope so. Installed in trunk as revision 117473. Thank you for testing.

Dmitry




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-07-03 18:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-03 10:35 w32 hourglass cursor Dmitry Antipov
2014-07-03 16:18 ` Dani Moncayo
2014-07-03 16:30   ` Dmitry Antipov
2014-07-03 17:07     ` Dani Moncayo
2014-07-03 17:33       ` Dmitry Antipov
2014-07-03 17:53         ` Dani Moncayo
2014-07-03 18:15           ` Dmitry Antipov
2014-07-03 16:42   ` Eli Zaretskii

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).