unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
@ 2014-05-27 13:43 Jan Tatarik
  2014-05-27 17:52 ` Dmitry Antipov
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Tatarik @ 2014-05-27 13:43 UTC (permalink / raw)
  To: 17609


Starting with revision 117096, the X cursor will sometimes disappear and
remain invisible until as long as emacs is running.

Steps to reproduce (emacs with X support):

1) emacs -Q and the initial frame (frame A) appears

2) C-x 5 2 and new frame (frame B) appears

3) switch to frame B and position the mouse cursor inside the frame

4) start typing in frame B's scratch buffer - the mouse cursor
   disappears

5) C-x 5 0  to kill frame B

6) back in frame A, but the cursor is still invisible. It remains
   invisible until emacs is exited.


Expected behavior: in step 6, the cursor should have appeared
again. This is working correctly in revision 117095.











In GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.17)
 of 2014-05-27 on nb-jtatarik2
Repository revision: 117165 eggert@cs.ucla.edu-20140527063729-rdl39wb178p4v6xj
Windowing system distributor `The X.Org Foundation', version 11.0.11303000
System Description:	Linux Mint 15 Olivia

Configured using:
 `configure --with-x-toolkit=gtk2'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY
GNUTLS LIBXML2 FREETYPE XFT ZLIB

Important settings:
  value of $LC_COLLATE: C
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_GB.UTF8
  value of $LANG: en_US.UTF8
  locale-coding-system: utf-8-unix






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

* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
  2014-05-27 13:43 bug#17609: 24.4.50; trunk r117096: disappearing cursor in X Jan Tatarik
@ 2014-05-27 17:52 ` Dmitry Antipov
  2014-05-27 20:16   ` Jan Tatarik
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Antipov @ 2014-05-27 17:52 UTC (permalink / raw)
  To: Jan Tatarik; +Cc: 17609

On 05/27/2014 05:43 PM, Jan Tatarik wrote:

> Starting with revision 117096, the X cursor will sometimes disappear and
> remain invisible until as long as emacs is running.

Reproduced. Could you please verify that old (fallback) code
still works?  I.e. with Xfixes extension always disabled?

=== modified file 'src/xterm.c'
--- src/xterm.c	2014-05-14 13:55:37 +0000
+++ src/xterm.c	2014-05-27 17:49:02 +0000
@@ -9752,8 +9752,7 @@
  x_probe_xfixes_extension (Display *dpy)
  {
  #ifdef HAVE_XFIXES
-  int major, minor;
-  return XFixesQueryVersion (dpy, &major, &minor) && major >= 4;
+  return false;
  #else
    return false;
  #endif /* HAVE_XFIXES */

Dmitry







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

* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
  2014-05-27 17:52 ` Dmitry Antipov
@ 2014-05-27 20:16   ` Jan Tatarik
  2014-05-27 23:30     ` Stefan Monnier
  2014-05-28  4:17     ` Dmitry Antipov
  0 siblings, 2 replies; 11+ messages in thread
From: Jan Tatarik @ 2014-05-27 20:16 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: 17609, Jan Tatarik

On Tue, May 27 2014, Dmitry Antipov wrote:

> On 05/27/2014 05:43 PM, Jan Tatarik wrote:

>> Starting with revision 117096, the X cursor will sometimes disappear and
>> remain invisible until as long as emacs is running.

> Reproduced. Could you please verify that old (fallback) code
> still works?  I.e. with Xfixes extension always disabled?

That works indeed.





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

* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
  2014-05-27 20:16   ` Jan Tatarik
@ 2014-05-27 23:30     ` Stefan Monnier
  2014-05-28  4:17     ` Dmitry Antipov
  1 sibling, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2014-05-27 23:30 UTC (permalink / raw)
  To: Jan Tatarik; +Cc: Dmitry Antipov, 17609

>>> Starting with revision 117096, the X cursor will sometimes disappear and
>>> remain invisible until as long as emacs is running.

Ha, I see this as well, but I upgraded my window manager right around
the same time, so I assumed the bug was in the window-manager.


        Stefan





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

* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
  2014-05-27 20:16   ` Jan Tatarik
  2014-05-27 23:30     ` Stefan Monnier
@ 2014-05-28  4:17     ` Dmitry Antipov
  2014-05-28  7:44       ` Jan Tatarik
  2014-06-02 11:47       ` Jan Tatarik
  1 sibling, 2 replies; 11+ messages in thread
From: Dmitry Antipov @ 2014-05-28  4:17 UTC (permalink / raw)
  To: Jan Tatarik; +Cc: 17609

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

On 05/28/2014 12:16 AM, Jan Tatarik wrote:

> That works indeed.

Hm... the whole thing (totally disappeared pointer) makes me think that
Xfixes functions operates on X screens but not X windows :-(. Anyway,
please try this patch.

Dmitry


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

=== modified file 'src/cmds.c'
--- src/cmds.c	2014-03-04 03:14:11 +0000
+++ src/cmds.c	2014-05-28 03:08:40 +0000
@@ -315,7 +315,7 @@
     int val = internal_self_insert (character, XFASTINT (n));
     if (val == 2)
       nonundocount = 0;
-    frame_make_pointer_invisible ();
+    frame_make_pointer_invisible (SELECTED_FRAME ());
   }
 
   return Qnil;

=== modified file 'src/frame.c'
--- src/frame.c	2014-04-03 20:46:04 +0000
+++ src/frame.c	2014-05-28 03:49:01 +0000
@@ -4373,16 +4373,11 @@
 #endif /* HAVE_WINDOW_SYSTEM */
 
 void
-frame_make_pointer_invisible (void)
+frame_make_pointer_invisible (struct frame *f)
 {
   if (! NILP (Vmake_pointer_invisible))
     {
-      struct frame *f;
-      if (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame)))
-        return;
-
-      f = SELECTED_FRAME ();
-      if (f && !f->pointer_invisible
+      if (f && FRAME_LIVE_P (f) && !f->pointer_invisible
           && FRAME_TERMINAL (f)->toggle_invisible_pointer_hook)
         {
           f->mouse_moved = 0;
@@ -4393,17 +4388,11 @@
 }
 
 void
-frame_make_pointer_visible (void)
+frame_make_pointer_visible (struct frame *f)
 {
   /* We don't check Vmake_pointer_invisible here in case the
      pointer was invisible when Vmake_pointer_invisible was set to nil.  */
-  struct frame *f;
-
-  if (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame)))
-    return;
-
-  f = SELECTED_FRAME ();
-  if (f && f->pointer_invisible && f->mouse_moved
+  if (f && FRAME_LIVE_P (f) && f->pointer_invisible && f->mouse_moved
       && FRAME_TERMINAL (f)->toggle_invisible_pointer_hook)
     {
       FRAME_TERMINAL (f)->toggle_invisible_pointer_hook (f, 0);

=== modified file 'src/frame.h'
--- src/frame.h	2014-04-04 16:59:50 +0000
+++ src/frame.h	2014-05-28 03:08:21 +0000
@@ -995,8 +995,8 @@
 #endif /* HAVE_WINDOW_SYSTEM */
 extern bool window_system_available (struct frame *);
 extern void check_window_system (struct frame *);
-extern void frame_make_pointer_invisible (void);
-extern void frame_make_pointer_visible (void);
+extern void frame_make_pointer_invisible (struct frame *);
+extern void frame_make_pointer_visible (struct frame *);
 extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object);
 
 extern Lisp_Object Vframe_list;

=== modified file 'src/keyboard.c'
--- src/keyboard.c	2014-05-28 00:50:44 +0000
+++ src/keyboard.c	2014-05-28 04:05:53 +0000
@@ -6877,6 +6877,20 @@
 	      }
             }
 
+	  /* If there was no error, make sure the cursor
+	     is visible for all frames on this terminal.  */
+	  if (nr >= 0)
+	    {
+	      Lisp_Object tail, frame;
+
+	      FOR_EACH_FRAME (tail, frame)
+		{
+		  struct frame *f = XFRAME (frame);
+		  if (FRAME_TERMINAL (f) == t)
+		    frame_make_pointer_visible (f);
+		}
+	    }
+
           if (hold_quit.kind != NO_EVENT)
             kbd_buffer_store_event (&hold_quit);
         }
@@ -6887,8 +6901,6 @@
   if (err && !nread)
     nread = -1;
 
-  frame_make_pointer_visible ();
-
   return nread;
 }
 

=== modified file 'src/xterm.c'
--- src/xterm.c	2014-05-14 13:55:37 +0000
+++ src/xterm.c	2014-05-28 04:10:30 +0000
@@ -9233,6 +9233,10 @@
      commands to the X server.  */
   if (dpyinfo->display)
     {
+      /* Always exit with visible pointer to avoid weird issue
+	 with Xfixes (Bug#17609).  */
+      FRAME_DISPLAY_INFO (f)->toggle_visible_pointer (f, 0);
+
       /* We must free faces before destroying windows because some
 	 font-driver (e.g. xft) access a window while finishing a
 	 face.  */


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

* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
  2014-05-28  4:17     ` Dmitry Antipov
@ 2014-05-28  7:44       ` Jan Tatarik
  2014-06-02 11:47       ` Jan Tatarik
  1 sibling, 0 replies; 11+ messages in thread
From: Jan Tatarik @ 2014-05-28  7:44 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: 17609

On Wed, May 28 2014, Dmitry Antipov wrote:

> On 05/28/2014 12:16 AM, Jan Tatarik wrote:

>> That works indeed.

> Hm... the whole thing (totally disappeared pointer) makes me think that
> Xfixes functions operates on X screens but not X windows :-(. Anyway,
> please try this patch.

Works.





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

* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
  2014-05-28  4:17     ` Dmitry Antipov
  2014-05-28  7:44       ` Jan Tatarik
@ 2014-06-02 11:47       ` Jan Tatarik
  2014-06-03 12:40         ` Dmitry Antipov
  1 sibling, 1 reply; 11+ messages in thread
From: Jan Tatarik @ 2014-06-02 11:47 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: 17609

On Wed, May 28 2014, Dmitry Antipov wrote:

> Hm... the whole thing (totally disappeared pointer) makes me think that
> Xfixes functions operates on X screens but not X windows :-(. Anyway,
> please try this patch.

There's still an issue. Pop-up notifications (notifications.el)
triggered by emacs make the cursor disappear. The cursor remains hidden
until emacs gets focus again.

At this moment I cannot provide exact steps to reproduce, as executing
the notifications-notify function manually doesn't exhibit the problem.

I'm using erc with the desktop-notification plugin. I am also using
appt.el, with the following advice:

(defadvice appt-disp-window (after my:appt-notify activate compile)
  "Pop up notification for upcoming appointments."
  (with-current-buffer appt-buffer-name
    (let ((body (buffer-string)))
      (notifications-notify
       :title "Appointment"
       :body body
       :app-icon "/usr/share/icons/gnome/48x48/status/appointment-soon.png"))))

I'm not 100% sure about the notifications coming from erc, but I have
confirmed with the ones from appt - if emacs triggers the notification
while some other, non-emacs window is focused (e.g. my browser), the
cursor will disappear. It reappears when I switch back to emacs.

Hope this helps.





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

* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
  2014-06-02 11:47       ` Jan Tatarik
@ 2014-06-03 12:40         ` Dmitry Antipov
  2014-06-05 20:42           ` Stefan Monnier
  2020-09-09 11:59           ` Lars Ingebrigtsen
  0 siblings, 2 replies; 11+ messages in thread
From: Dmitry Antipov @ 2014-06-03 12:40 UTC (permalink / raw)
  To: Jan Tatarik; +Cc: 17609

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

On 06/02/2014 03:47 PM, Jan Tatarik wrote:

> There's still an issue. Pop-up notifications (notifications.el)
> triggered by emacs make the cursor disappear. The cursor remains hidden
> until emacs gets focus again.

I'm not familiar with this code and don't know how the notifications popup
window is created. Anyway, please try this tiny patch.

Dmitry



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

=== modified file 'src/menu.c'
--- src/menu.c	2014-06-02 18:01:21 +0000
+++ src/menu.c	2014-06-03 12:29:28 +0000
@@ -1558,6 +1558,12 @@
      string contents, because Fredisplay may GC and relocate them.  */
   Fredisplay (Qt);
 
+#ifdef HAVE_X_WINDOWS
+  /* Don't confuse user with invisible cursor.  */
+  if (FRAME_X_P (f) && f->pointer_invisible)
+    FRAME_DISPLAY_INFO (f)->toggle_visible_pointer (f, 0);
+#endif
+
 #if defined USE_X_TOOLKIT || defined USE_GTK
   if (FRAME_WINDOW_P (f))
     return xw_popup_dialog (f, header, contents);


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

* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
  2014-06-03 12:40         ` Dmitry Antipov
@ 2014-06-05 20:42           ` Stefan Monnier
  2020-09-09 11:59           ` Lars Ingebrigtsen
  1 sibling, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2014-06-05 20:42 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: 17609, Jan Tatarik

>> There's still an issue. Pop-up notifications (notifications.el)
>> triggered by emacs make the cursor disappear. The cursor remains hidden
>> until emacs gets focus again.
> I'm not familiar with this code and don't know how the notifications popup
> window is created. Anyway, please try this tiny patch.

I'm still seeing disappearing cursors as well in trunk.
These seem to be remaining bugs in the new Xfixes code in Emacs.
I haven't tracked down a recipe yet, but I'll try and do that soon.
In the mean time I have another related problem:

Apparently the xfixes code itself is buggy in the xinerama X11 server:
- when I hit a key in Emacs, the mouse cursor is not "undrawn" and so
  the drawing of that cursor lingers on the screen until the next time
  this part of the screen gets redisplayed.
- better yet, the "undrawing" actually takes place but in the wrong
  screen (and with the wrong pixmap).  So in the right screen I get lots
  of ghost cursors and in the left screen I get matching "square blobs".
[ See https://bugs.freedesktop.org/show_bug.cgi?id=79703 ]

So, while I'm not necessarily advocating reverting to the non-xfixes
code, I think it would be good if the user could tell Emacs not to use
xfixes, in order to work around these bugs.


        Stefan





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

* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
  2014-06-03 12:40         ` Dmitry Antipov
  2014-06-05 20:42           ` Stefan Monnier
@ 2020-09-09 11:59           ` Lars Ingebrigtsen
  2020-12-06 15:56             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-09 11:59 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: 17609, Jan Tatarik, Stefan Monnier

Dmitry Antipov <dmantipov@yandex.ru> writes:

>> There's still an issue. Pop-up notifications (notifications.el)
>> triggered by emacs make the cursor disappear. The cursor remains hidden
>> until emacs gets focus again.
>
> I'm not familiar with this code and don't know how the notifications popup
> window is created. Anyway, please try this tiny patch.

[...]

> +#ifdef HAVE_X_WINDOWS
> +  /* Don't confuse user with invisible cursor.  */
> +  if (FRAME_X_P (f) && f->pointer_invisible)
> +    FRAME_DISPLAY_INFO (f)->toggle_visible_pointer (f, 0);
> +#endif
> +
>  #if defined USE_X_TOOLKIT || defined USE_GTK
>    if (FRAME_WINDOW_P (f))
>      return xw_popup_dialog (f, header, contents);

This patch wasn't discussed or applied, as far as I can tell.

This was six years ago, though -- is this still an issue?  I can't
recall seeing the cursor disappearing lately, at least.

Stefan had some comments about xfixes in xinerama.  The issue in the bug
tracker there got no response, though:

https://gitlab.freedesktop.org/xorg/driver/xf86-video-fbdev/-/issues/4

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#17609: 24.4.50; trunk r117096: disappearing cursor in X
  2020-09-09 11:59           ` Lars Ingebrigtsen
@ 2020-12-06 15:56             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-06 15:56 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: 17609, Jan Tatarik, Stefan Monnier

Lars Ingebrigtsen <larsi@gnus.org> writes:

> This patch wasn't discussed or applied, as far as I can tell.
>
> This was six years ago, though -- is this still an issue?  I can't
> recall seeing the cursor disappearing lately, at least.

More information was requested, but none was received, so I'm closing
this bug report.  If this is still an issue, please respond to the
debbugs address and we'll reopen the report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2020-12-06 15:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-27 13:43 bug#17609: 24.4.50; trunk r117096: disappearing cursor in X Jan Tatarik
2014-05-27 17:52 ` Dmitry Antipov
2014-05-27 20:16   ` Jan Tatarik
2014-05-27 23:30     ` Stefan Monnier
2014-05-28  4:17     ` Dmitry Antipov
2014-05-28  7:44       ` Jan Tatarik
2014-06-02 11:47       ` Jan Tatarik
2014-06-03 12:40         ` Dmitry Antipov
2014-06-05 20:42           ` Stefan Monnier
2020-09-09 11:59           ` Lars Ingebrigtsen
2020-12-06 15:56             ` Lars Ingebrigtsen

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