all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Eli Zaretskii'" <eliz@gnu.org>, "'Chong Yidong'" <cyd@gnu.org>
Cc: 6372@debbugs.gnu.org
Subject: bug#6372: 24.0.50; C-mouse-1 activates region
Date: Wed, 8 Aug 2012 11:39:17 -0700	[thread overview]
Message-ID: <DA1627F9EA3F488EBBB56344E874ECE7@us.oracle.com> (raw)
In-Reply-To: <83mx2t733l.fsf@gnu.org>

ping.

> From: Eli Zaretskii Sent: Saturday, July 21, 2012 4:42 AM
> I'm sorry, but it will take someone who knows more than I do about
> MS-Windows messages and their processing to fix this one.  I describe
> my findings below in the hope that someone will pick up where I left
> off.
> 
> We track mouse events during pop-up menu by sending the
> WM_EMACS_TRACKPOPUPMENU message to the Emacs message pump.  This
> message is handled by w32_wnd_proc around line 3770 of w32fns.c.
> There, we call TrackPopupMenu, a Windows API that displays the menu
> and returns the user selection of menu items.  After TrackPopupMenu
> returns, we remove any mouse events still in the message queue, by
> calling PeekMessage with appropriate arguments, and return the user
> selection to our caller, which is w32_menu_show.  The user selection
> returned is zero when the user closes the menu without selecting any
> item, by clicking outside the menu.  w32_menu_show then removes any
> mouse events in the Emacs event queue by calling discard_mouse_events.
> 
> What happens in this case, and is the reason for the bug, is that
> somehow the mouse click event that pops down the menu is not delivered
> to Emacs until _after_ w32_menu_show returns.  That click is not
> removed by PeekMessage mentioned above, and is not discarded by
> discard_mouse_events.  It is read by w32_wnd_proc only after all of
> the above processing is complete, and any memory of the menu that was
> popped down is gone.  So Emacs processes that mouse click as a normal
> event, oblivious to the fact that it actually happened as part of the
> menu.
> 
> What I don't understand here is why that mouse click is not delivered
> when we call PeekMessage, so that it could be discarded.  It's as if
> Windows withholds that message from being put into the Emacs message
> queue.  Why is that, and what can we do to be able to peek at that
> click message as part of menu processing and discard it, is beyond me.






  reply	other threads:[~2012-08-08 18:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-07 17:19 bug#6372: 24.0.50; C-mouse-1 activates region Drew Adams
2012-07-08 13:41 ` Chong Yidong
2012-07-08 17:18   ` Drew Adams
2012-07-08 18:09     ` Eli Zaretskii
2012-07-09  4:37       ` Chong Yidong
2012-07-21 11:42         ` Eli Zaretskii
2012-08-08 18:39           ` Drew Adams [this message]
2012-09-16 23:34             ` Drew Adams
2012-10-19 15:02               ` Drew Adams
2012-07-08 15:00 ` Dmitry Gutov
2020-08-18 11:10 ` Stefan Kangas
2020-08-18 12:11   ` Eli Zaretskii
     [not found] <<B10C013621504F2293AC68C8CA31CA37@us.oracle.com>
     [not found] ` <<CADwFkmkK6JtAXf6aOf_ZNMiw0gKDuGJrV1p7qehk+0qe4V7U=Q@mail.gmail.com>
     [not found]   ` <<83k0xwf92g.fsf@gnu.org>
2020-08-18 16:37     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DA1627F9EA3F488EBBB56344E874ECE7@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=6372@debbugs.gnu.org \
    --cc=cyd@gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.