From rms@gnu.ai.mit.edu  Fri Apr 25 15:19:49 1997
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Fri" "25" "April" "1997" "18:19:30" "-0400" "Richard Stallman" "rms@gnu.ai.mit.edu" nil "43" "[md5i@schenley.com: Popup menu implementation & mouse events]" "^From:" nil nil "4" nil nil nil nil]
	nil)
Received: from psilocin.gnu.ai.mit.edu (psilocin.gnu.ai.mit.edu [128.52.46.62]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with SMTP id PAA21870 for <voelker@cs.washington.edu>; Fri, 25 Apr 1997 15:19:47 -0700
Received: by psilocin.gnu.ai.mit.edu (8.6.12/8.6.12GNU) id SAA07705; Fri, 25 Apr 1997 18:19:30 -0400
Message-Id: <199704252219.SAA07705@psilocin.gnu.ai.mit.edu>
From: Richard Stallman <rms@gnu.ai.mit.edu>
To: voelker@cs.washington.edu, andrewi@harlequin.co.uk
Subject: [md5i@schenley.com: Popup menu implementation & mouse events]
Date: Fri, 25 Apr 1997 18:19:30 -0400

Could you please do the right thing?

------- Start of forwarded message -------
Sender: "Michael Welsh Duggan" <md5i@schenley.com>
Newsgroups: gnu.emacs.help
Subject: Popup menu implementation & mouse events
Cc: Richard Stallman <rms@gnu.ai.mit.edu>
Mail-Copies-To: md5i@schenley.com
From: "Michael Welsh Duggan" <md5i@schenley.com>
Date: 25 Apr 1997 09:09:36 -0400
Organization: Schenley Park Research, Inc.
Lines: 23
X-Newsreader: Gnus v5.4.33/Emacs 19.34
Posted-To: gnu.emacs.help
To: rms@gnu.ai.mit.edu

The following message is a courtesy copy of an article
that has been posted as well.

I am working on the popup menu code for the NT version of Gnu Emacs,
and I need to know what should happen in certain cases.

1) A menu is set up to execute on a specific mouse-down event.  A
click for that button/modifier combination is generated.  As the menu
was created by the mouse-down, should the click event go through?

2) A menu is set up as in 1.  If a user clicks and holds, should the
menu pop up and allow them to select an entry by releasing the mouse
button on a menu entry, or should the menu wait for a seperate
mouse-down?  Does it make a difference if this can only be implemented
on the right and left buttons (not the middle)?

3) If the answer for 2 is the first option, what events should be seen
by emacs?

4) Keeping in mind that way I am implementing popup menus is
aplication modal, should emacs recieve any mouse-move events generated
during menu selection?

- -- 
Michael Duggan
(md5i@schenley.com)
------- End of forwarded message -------

From rms@gnu.ai.mit.edu  Fri Apr 25 15:40:39 1997
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Fri" "25" "April" "1997" "18:28:01" "-0400" "Richard Stallman" "rms@gnu.ai.mit.edu" nil "31" "Re: Popup menu implementation & mouse events" "^From:" nil nil "4" nil nil nil nil]
	nil)
Received: from psilocin.gnu.ai.mit.edu (psilocin.gnu.ai.mit.edu [128.52.46.62]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with SMTP id PAA22557 for <voelker@cs.washington.edu>; Fri, 25 Apr 1997 15:29:25 -0700
Received: by psilocin.gnu.ai.mit.edu (8.6.12/8.6.12GNU) id SAA07746; Fri, 25 Apr 1997 18:28:01 -0400
Message-Id: <199704252228.SAA07746@psilocin.gnu.ai.mit.edu>
In-reply-to: <urafzi6zz.fsf@maru.schenley.com> (md5i@schenley.com)
References:  <urafzi6zz.fsf@maru.schenley.com>
From: Richard Stallman <rms@gnu.ai.mit.edu>
To: md5i@schenley.com
cc: voelker@cs.washington.edu, andrewi@harlequin.co.uk
Subject: Re: Popup menu implementation & mouse events
Date: Fri, 25 Apr 1997 18:28:01 -0400

I don't know whether this behavior fits in with Windows NT.  In
general, I would say that Emacs should handle menus like a good
Windows NT application, to the extent that it can.

    1) A menu is set up to execute on a specific mouse-down event.  A
    click for that button/modifier combination is generated.  As the menu
    was created by the mouse-down, should the click event go through?

On X Windows, if the user pushes the button and releases it quickly,
before the menu appears, then the menu should come up and stay up.
When the user pushes the button again, that should select from the
menu.

    2) A menu is set up as in 1.  If a user clicks and holds, should the
    menu pop up and allow them to select an entry by releasing the mouse
    button on a menu entry,

On X Windows, it does.

			    or should the menu wait for a seperate
    mouse-down?  Does it make a difference if this can only be implemented
    on the right and left buttons (not the middle)?

    3) If the answer for 2 is the first option, what events should be seen
    by emacs?

    4) Keeping in mind that way I am implementing popup menus is
    aplication modal, should emacs recieve any mouse-move events generated
    during menu selection?

No.

From md5i@schenley.com  Sat May  3 05:37:49 1997
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "" " 3" "May" "1997" "08:36:43" "-0400" "Michael Welsh Duggan" "md5i@schenley.com" nil "56" "Re: Popup menu implementation & mouse events" "^From:" nil nil "5" nil nil nil nil]
	nil)
Received: from gate.usaor.net (gate.usaor.net [204.157.146.1]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with ESMTP id FAA21740 for <voelker@cs.washington.edu>; Sat, 3 May 1997 05:37:48 -0700
Received: from maru.schenley.com (maru.schenley.com [206.62.188.70]) 	by gate.usaor.net (8.8.5/8.8.5) with SMTP id IAA13240 	for <voelker@cs.washington.edu>; Sat, 3 May 1997 08:37:48 -0400 (EDT)
Received: by maru.schenley.com from localhost     (router,SLMAILNT V2.2); Sat, 03 May 1997 08:36:45 EDT
Received: by maru.schenley.com from maru.schenley.com     (127.0.0.1::mail daemon; unverified,SLMAILNT V2.2); Sat, 03 May 1997 08:36:45 EDT
References: <urafzi6zz.fsf@maru.schenley.com> <199704252228.SAA07746@psilocin.gnu.ai.mit.edu>
In-Reply-To: Richard Stallman's message of Fri, 25 Apr 1997 18:28:01 -0400
Message-ID: <uraforauc.fsf@maru.schenley.com>
Lines: 56
X-Mailer: Gnus v5.4.33/Emacs 19.34
From: "Michael Welsh Duggan" <md5i@schenley.com>
Sender: "Michael Welsh Duggan" <md5i@schenley.com>
To: Richard Stallman <rms@gnu.ai.mit.edu>
Cc: "Michael Welsh Duggan" <md5i@schenley.com>, voelker@cs.washington.edu,         andrewi@harlequin.co.uk
Subject: Re: Popup menu implementation & mouse events
Date: 03 May 1997 08:36:43 -0400

Richard Stallman <rms@gnu.ai.mit.edu> writes:

> I don't know whether this behavior fits in with Windows NT.  In
> general, I would say that Emacs should handle menus like a good
> Windows NT application, to the extent that it can.
> 
>     1) A menu is set up to execute on a specific mouse-down event.  A
>     click for that button/modifier combination is generated.  As the menu
>     was created by the mouse-down, should the click event go through?
> 
> On X Windows, if the user pushes the button and releases it quickly,
> before the menu appears, then the menu should come up and stay up.
> When the user pushes the button again, that should select from the
> menu.

Okay, one last question:

In X Windows, in the case you have described in the preceding
paragraph, should both the mouse down and the mouse up event be
returned by kbd_buffer_get_event?  If so, where does the mouse-up
event get caught?

Actually, rereading the previous paragraph makes me realize that an
explanation of what I am trying to do is in order.  

Example and explanation:

mouse.el, which is dumped into the standard Emacs distribution,
maps the keybinding C-down-mouse-1 to the function
mouse-buffer-menu.  Clicking the first mouse button while holding
down the shift key causes two events to be inserted into the
keyboard buffer, a button down event and a button up event.  The
button down event translates into the Emacs event C-down-mouse-1,
which executes the function mouse-buffer-menu.

Ah, but here comes the questionable part.  There is still a
mouse down event in the buffer, and when mouse-buffer-menu has
completed, it translates into the Emacs event C-mouse-1.  This has
no binding and therefore ends up calling bitch_at_user, causeing a
beep.

Now, I never remember this happening when I used the X Windows
version of Emacs, so this event must be getting eaten somewhere.  My
question is this: Where should it be eaten?  Should the button up
event never have made it into the keyboard buffer, or should it be
trapped and eaten later in the function chain?

I would also like to leave you with one last question:  Was I correct
in sending this question to you (and the above CC'd), or was there a
more appropriate forum in which to ask this question?

Thanks for your time.

-- 
Michael Duggan
(md5i@schenley.com)

From rms@gnu.ai.mit.edu  Sat May  3 12:05:02 1997
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Sat" " 3" "May" "1997" "15:04:39" "-0400" "Richard Stallman" "rms@gnu.ai.mit.edu" nil "7" "Re: Popup menu implementation & mouse events" "^From:" nil nil "5" nil nil nil nil]
	nil)
Received: from psilocin.gnu.ai.mit.edu (psilocin.gnu.ai.mit.edu [128.52.46.62]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with SMTP id MAA23683 for <voelker@cs.washington.edu>; Sat, 3 May 1997 12:04:57 -0700
Received: by psilocin.gnu.ai.mit.edu (8.6.12/8.6.12GNU) id PAA00506; Sat, 3 May 1997 15:04:39 -0400
Message-Id: <199705031904.PAA00506@psilocin.gnu.ai.mit.edu>
In-reply-to: <uraforauc.fsf@maru.schenley.com> (md5i@schenley.com)
References: <urafzi6zz.fsf@maru.schenley.com> <199704252228.SAA07746@psilocin.gnu.ai.mit.edu> <uraforauc.fsf@maru.schenley.com>
From: Richard Stallman <rms@gnu.ai.mit.edu>
To: md5i@schenley.com
CC: md5i@schenley.com, voelker@cs.washington.edu, andrewi@harlequin.co.uk
Subject: Re: Popup menu implementation & mouse events
Date: Sat, 3 May 1997 15:04:39 -0400

    In X Windows, in the case you have described in the preceding
    paragraph, should both the mouse down and the mouse up event be
    returned by kbd_buffer_get_event?

With X, the menus are handled by different code entirely, part of
lwlib or some other widget set.  So the button events in the menu
are never returned by kbd_buffer_get_event at all,

