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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 04 Dec 2020 22:46:07 +0200

> Date: Fri, 4 Dec 2020 09:43:47 -0800 (PST)
> From: Drew Adams <[email-masked]>
> Cc: [email-masked]
> 
> ;; runemacs.exe -Q --debug-init  -l "onetest.el" -f "1on1-emacs" "onetest.el"
> 
> (defun 1on1-emacs ()
>   ""
>   (interactive)
>   (setq default-frame-alist
>         (list
>          '(font . "-*-Lucida Console-normal-r-*-*-14-*-*-*-c-*-iso8859-1")
>          '(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))))
> 
> ------------8<------------------
> 
> And I should have said that after step 3 use C-g
> or whatever to end that step's M-x.  And select the
> *scratch* frame.  IOW, step 4 is a repeat of step 3,
> except that you do C-S-mouse-1 in the same frame,
> *scratch*, not in another frame.
> 
> I just checked, and the same bug exists from Emacs
> 24.5 through 27.1.  IOW, it's still there.

Why is that a bug?  Clicking a mouse doesn't necessarily select the
frame where you click; if you want to know which frame you clocked on,
you should look at the click event.