Subject: bug#17736: 24.4.50; *-mouse-1 acts on wrong frame

From: Drew Adams <[email-masked]>
Date: Sun, 6 Dec 2020 09:20:49 -0800 (PST)

> I removed the font setting, though, 

Yes.

> and tried to follow your recipe.

> And I was unable to, either because I don't understand
> the recipe, or because the bugs isn't present in Emacs 28.
> 
> Could you provide a simpler step by step recipe to
> demonstrate the bug?

Could you say what you don't understand about the recipe?
Or could you explain what "I was unable to" amounts to?

Can you try with either the release for which the bug was
filed or other releases mentioned, which include Emacs 27?
There is no release Emacs 28, so I can't help you with that.

With Emacs 27.1, simply doing what I said shows the
reported behavior immediately, 100% of the time.

Here's the complete recipe again, in one place:

Command to start Emacs:

  z:\...\runemacs.exe -Q -l "onetest.el" -f "1on1-emacs"

File onetest.el contains this code:

(defun 1on1-emacs ()
  (interactive)
  (setq default-frame-alist
        (list '(bottom-divider-width . 2)
              '(minibuffer)))
  (setq pop-up-frames  t)
  (setq minibuffer-frame-alist (list '(height . 2)
                                     '(minibuffer . only))))
(global-set-key [C-S-mouse-1]
		(lambda () (interactive)
                  (message "FR: %S" (selected-frame))))

1. `C-x 5 o' to select frame *scratch*.
2. `C-x 5 2' to duplicate that frame.
3. `C-x b' to have that frame show *Messages*.
4. Resize the two non-minibuffer frames, so you
   can easily see all 3 frames completely.
5. Select the *scratch* frame (e.g. click mouse-1 there).
6. `C-S-mouse-1' in *scratch*.  See message in *Messages*
   saying that the selected frame is *scratch*.
7. Select *scratch* frame.  `C-S-mouse-1' in *Messages*.
   See message saying that selected frame is *Messages*.
8. Select *scratch* frame.  `M-x', then `C-S-mouse-1' in
   *Messages*.  See message: selected frame is *Messages*.
   `C-g' to cancel `M-x'.
9. Select *scratch* frame.  `M-x', then `C-S-mouse-1' in
   *scratch*.  See message in both *Messages* and echo
   area (minibuffer frame): selected frame is
   " *Minibuf-1*".

#9 is unexpected.

Can you repro this?  If so, we can talk about whether
#9 should be expected or is a bug.

It's possible that the behavior depends on the platform.
I'm using MS Windows (10).  It may well handle frame
focusing differently from some other platforms.