GNU bug report logs - #4930
23.1.50; C-mouse-1 undefined?

Previous Next

Package: emacs;

Reported by: Peter Dyballa <Peter_Dyballa <at> GMX.DE>

Date: Sun, 15 Nov 2009 14:45:04 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4930 in the body.
You can then email your comments to 4930 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4930; Package emacs. (Sun, 15 Nov 2009 14:45:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Dyballa <Peter_Dyballa <at> GMX.DE>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 15 Nov 2009 14:45:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Peter Dyballa <Peter_Dyballa <at> GMX.DE>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.1.50; C-mouse-1 undefined?
Date: Sun, 15 Nov 2009 15:39:56 +0100
Hello!

I don't have a real mouse, only a trackpad. In GNU Emacs 22.3 C- 
mouse-1 lets pop up the Buffer Menu, GNU Emacs 23.1.50 with NS from  
middle of October or today shows the same behaviour. X11 client from  
2009-11-08 and from 2009-11-15 show both a faulty behaviour... (since  
last weekend, previously, i.e., in October, they were working,  
popping up the menu)

C-h k C-trackpad tells me:

	<C-down-mouse-1> at that spot runs the command mouse-buffer-menu,
	which is an interactive compiled Lisp function in `mouse.el'.
	
	It is bound to <C-down-mouse-1>.
	
	(mouse-buffer-menu EVENT)
	
	Pop up a menu of buffers for selection with the mouse.
	This switches buffers in the window that you clicked on,
	and selects that window.

but when I actually control-click the trackpad I receive in echo area:

	"<C-mouse-1> is undefined"


In GNU Emacs 23.1.50.1 (powerpc-apple-darwin8.11.0, GTK+ Version 2.18.2)
 of 2009-11-15 on Latsche.local
Windowing system distributor `The XFree86 Project, Inc', version  
11.0.40400000
configured using `configure  '--without-sound' '--without-pop' '-- 
with-dbus' '--with-libotf' '--with-xpm' '--with-jpeg' '--with-tiff'  
'--with-gif' '--with-png' '--x-libraries=/opt/local/lib' '--x- 
includes=/opt/local/include' '--enable-locallisppath=/Library/ 
Application Support/Emacs/calendar23:/Library/Application Support/ 
Emacs' 'PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/opt/local/share/ 
pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig' 'CPPFLAGS=-no- 
cpp-precomp' 'CFLAGS=-ggdb3 -gfull -mtraceback=full -Wno-pointer-sign  
-H -pipe -fPIC -mcpu=7450 -mtune=7450 -mtune=G4 -fast -mpim-altivec - 
ftree-vectorize -foptimize-register-move -freorder-blocks -fthread- 
jumps -fpeephole -fno-crossjumping' 'LDFLAGS=-dead_strip - 
multiply_defined suppress''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: de_DE.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<down-mouse-1> <mouse-1> C-h k <C-down-mouse-1> <C-mouse-1>
<down-mouse-1> <mouse-1> <C-down-mouse-1> <C-mouse-1>
<help-echo> <down-mouse-1> <mouse-1> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <menu-bar>
<help-menu> <send-emacs-bug-report>


Features:
(shadow mail-extr message ecomplete rfc822 mml mml-sec password-cache
mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045
qp ietf-drums mailabbrev nnheader gnus-util netrc time-date mm-util
mail-prsvr gmm-utils wid-edit mailheader canlock sha1 hex-util hashcash
mail-utils emacsbug sendmail regexp-opt help-fns help-mode easymenu view
tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces
cus-face text-properties overlay md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gtk x-toolkit x multi-tty emacs)


--
Greetings

  Pete

These are my principles and if you don't like them... well, I have  
others.
				- Groucho Marx




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4930; Package emacs. (Sun, 15 Nov 2009 15:30:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Dyballa <Peter_Dyballa <at> Freenet.DE>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 15 Nov 2009 15:30:05 GMT) Full text and rfc822 format available.

Message #10 received at 4930 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>
To: 4930 <at> debbugs.gnu.org
Subject: 23.1.50; C-mouse-1 undefined?
Date: Sun, 15 Nov 2009 16:21:51 +0100
Hello!

<S-mouse-1> is also undefined...

--
Greetings

  Pete

If you don't find it in the index, look very carefully through the  
entire catalogue.
		–  Sears, Roebuck, and Co., Consumer's Guide, 1897




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4930; Package emacs. (Thu, 31 Dec 2009 17:31:02 GMT) Full text and rfc822 format available.

Message #13 received at 4930 <at> debbugs.gnu.org (full text, mbox):

From: Clathrate Boink <clathrate.boink <at> gmail.com>
To: 4930 <at> debbugs.gnu.org
Subject: bug#4930
Date: Thu, 31 Dec 2009 17:54:30 +0200
[Message part 1 (text/plain, inline)]
I get this too.  I did a git bisect, and have found the offending change:

commit 2789519cf18504fd045b3384f011184ac66b8e89
Author: Chong Yidong <cyd <at> stupidchicken.com>
Date:   Sat Nov 7 23:49:08 2009 +0000

    * xmenu.c (Fx_popup_menu): Extract event timestamp.  Pass it to
    xmenu_show.
    (xmenu_show): New arg.  Pass it to create_and_show_popup_menu.
    (create_and_show_popup_menu): New arg.  Pass it to gtk_menu_popup.

I appreciate that emacs is using bzr, not git, but this is what I have set
up right now.

I don't have an immediate fix, but I'm confident that the above change is
causing the problem.

I will continue to investigate, but I'm new to emacs hacking so please bear
with me...

Clathrate
[Message part 2 (text/html, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4930; Package emacs. (Tue, 05 Jan 2010 14:09:10 GMT) Full text and rfc822 format available.

Message #16 received at 4930 <at> debbugs.gnu.org (full text, mbox):

From: Clathrate Boink <clathrate.boink <at> gmail.com>
To: 4930 <at> debbugs.gnu.org
Subject: 23.1.50; C-mouse-1 undefined?
Date: Tue, 5 Jan 2010 14:45:04 +0200
With further investigation I think I may have found the problem.
Emacs lisp ints are only 30 bits wide.  Timestamps come in from
XButtonEvent and make_lispy_event calls make_lispy_position, which
uses make_number to stash away the event timestamp.  Unfortunately
this will truncate the top two bits of the timestamp.  This is
subsequently passed to gtk_menu_popup via
xmenu_show/create_and_show_popup_menu.  It ends up going to XGrab<xxx>
which appears to be failing when given such a truncated timestamp.

As for what to do about it, I'm a bit stuck...

Clathrate




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4930; Package emacs. (Sun, 10 Jan 2010 21:38:01 GMT) Full text and rfc822 format available.

Message #19 received at 4930 <at> debbugs.gnu.org (full text, mbox):

From: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>
To: 4930 <at> debbugs.gnu.org
Subject: Re: 23.1.50; C-mouse-1 undefined?
Date: Sun, 10 Jan 2010 22:37:36 +0100
Am 15.11.2009 um 16:21 schrieb Peter Dyballa:

> Hello!
>
> <S-mouse-1> is also undefined...
>


Since some days/maybe a week I have C-mouse-1 and S-mouse-1 reliably  
working...

--
Greetings

  Pete

Globalisation – communism from above.





bug closed, send any further explanations to Peter Dyballa <Peter_Dyballa <at> GMX.DE> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 15 Jan 2010 02:35:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 12 Feb 2010 12:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 22 Mar 2010 23:28:01 GMT) Full text and rfc822 format available.

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 22 Mar 2010 23:28:01 GMT) Full text and rfc822 format available.

Message #28 received at 4930-quiet <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Herzog <bh <at> intevation.de>
To: 4930-quiet <at> debbugs.gnu.org
Subject: Fix for timestamp related popup-menu problem with some X servers
Date: Mon, 22 Mar 2010 20:02:46 +0100
[Message part 1 (text/plain, inline)]
[ resent from
  http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01011.html ]


Hi,

I'm regularly running into a problem with the popup menus bound by
default to C-down-mouse-1 and other events.  The symptom is that instead
of a popup menu, I only get the error message: <C-mouse-1> is undefined.
This is exactly the same problem as described in
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4930. 

The root cause is as described in there in message #16:

   Emacs lisp ints are only 30 bits wide.  Timestamps come in from
   XButtonEvent and make_lispy_event calls make_lispy_position, which
   uses make_number to stash away the event timestamp.  Unfortunately
   this will truncate the top two bits of the timestamp.  This is
   subsequently passed to gtk_menu_popup via
   xmenu_show/create_and_show_popup_menu.  It ends up going to
   XGrab<xxx> which appears to be failing when given such a truncated
   timestamp.

So, whether this defect can be observed depends on the value of the
timestamp.  That timestamp is a 32 bit value giving the time since an
X-server dependent point in time in milliseconds.  This means it will
wrap around about every 50 days.

Different servers seem to choose different starting points for the
timestamp.  Some may reset the timer when the server is reset or
started, others, including one I regularly use at work (the one coming
with Debian etch), apparently base the timestamp on the system time,
which has the effect that for a quarter of the 50 days the timestamps
are small enough and the popup menus work, and the rest of the time,
they don't.

Anyway, to cut the story short, below is a patch to fix this problem.
It uses last_event_timestamp from keyboard.c instead of the timestamp
From the button event.  AFAICT, last_event_timestamp is the timestamp
From the button event, most of the time anyway, because usually the
button event that will lead to the popup-menu being displayed is the
last one that was processed.

Here's the patch:

=== modified file 'src/menu.c'
--- src/menu.c	2010-01-13 08:35:10 +0000
+++ src/menu.c	2010-03-21 15:57:51 +0000
@@ -61,6 +61,11 @@
 #define HAVE_BOXES 1
 #endif
 
+/* The timestamp of the last input event Emacs received from the X server.  */
+/* Defined in keyboard.c.  */
+extern unsigned long last_event_timestamp;
+
+
 extern Lisp_Object QCtoggle, QCradio;
 
 Lisp_Object menu_items;
@@ -1320,7 +1325,7 @@
 #else /* MSDOS and X11 */
   selection = xmenu_show (f, xpos, ypos, for_click,
 			  keymaps, title, &error_name,
-			  INTEGERP (timestamp) ? XUINT (timestamp) : 0);
+			  last_event_timestamp);
 #endif
 
   UNBLOCK_INPUT;


Regards

   Bernhard
[Message part 2 (application/pgp-signature, inline)]

Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Tue, 30 Mar 2010 23:29:02 GMT) Full text and rfc822 format available.

Notification sent to Peter Dyballa <Peter_Dyballa <at> GMX.DE>:
bug acknowledged by developer. (Tue, 30 Mar 2010 23:29:02 GMT) Full text and rfc822 format available.

Message #33 received at 4930-done <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Bernhard Herzog <bh <at> intevation.de>
Cc: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>,
	Clathrate Boink <clathrate.boink <at> gmail.com>, 4930-done <at> debbugs.gnu.org
Subject: Re: Fix for timestamp related popup-menu problem with some X servers
Date: Tue, 30 Mar 2010 19:28:11 -0400
> Anyway, to cut the story short, below is a patch to fix this problem.
> It uses last_event_timestamp from keyboard.c instead of the timestamp
> From the button event.  AFAICT, last_event_timestamp is the timestamp
> From the button event, most of the time anyway, because usually the
> button event that will lead to the popup-menu being displayed is the
> last one that was processed.

Thanks.  I've checked your patch into the emacs-23 branch.




Message #34 received at 4930-done <at> debbugs.gnu.org (full text, mbox):

From: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Bernhard Herzog <bh <at> intevation.de>,
	Clathrate Boink <clathrate.boink <at> gmail.com>, 4930-done <at> debbugs.gnu.org
Subject: Re: Fix for timestamp related popup-menu problem with some X servers
Date: Thu, 1 Apr 2010 00:31:05 +0200
Am 31.03.2010 um 01:28 schrieb Chong Yidong:

>> Anyway, to cut the story short, below is a patch to fix this problem.
>> It uses last_event_timestamp from keyboard.c instead of the timestamp
>> From the button event.  AFAICT, last_event_timestamp is the timestamp
>> From the button event, most of the time anyway, because usually the
>> button event that will lead to the popup-menu being displayed is the
>> last one that was processed.
>
> Thanks.  I've checked your patch into the emacs-23 branch.


Hello!

I updated GNU Emacs 23.1.90 via CVS approximately ten hours after you  
sent the message. I compiled on my Mac the default GTK and the Xaw3d X  
clients, using the libraries either provided by by Fink or by  
MacPorts. The results are clear and unchanged:

 • the Xaw3d based Emacsen know C-mouse-1,
 • the GTK based Emacsen do *not* know C-mouse-1 and complain and  
dump a core when killed with xkill.


Grep finds last_event_timestamp here:

	./src/keyboard.c:369:unsigned long last_event_timestamp;
	./src/keyboard.c:3866:	  last_event_timestamp = event->timestamp;
	./src/keyboard.c:4152:      last_event_timestamp = event->timestamp;
	./src/keyboard.c:4440:      last_event_timestamp = event->timestamp;
	./src/xselect.c:139:extern unsigned long last_event_timestamp;
	./src/xselect.c:391:  Time time = last_event_timestamp;
	./src/xselect.c:1388:  Time requestor_time = last_event_timestamp;
	./src/xselect.c:2227:    timestamp = last_event_timestamp;

Are these the updated sources?

--
Greetings

  Pete

                  Sorry my terrible English, my native language Lisp





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Apr 2010 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 113 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.