masm11 / emacs

Mirror of GNU Emacs
http://www.gnu.org/software/emacs/
GNU General Public License v3.0
198 stars 14 forks source link

child frame focus issue #110

Closed eeshugerman closed 1 year ago

eeshugerman commented 2 years ago

It looks like we've discovered an issue with child frames over at cfrs: under Wayland, in some cases, child frames refuse to accept focus. Here's a minimal example present with emacs -Q:

(let* ((window
        (display-buffer-in-child-frame
         (get-buffer-create "*TEST*")
         `((child-frame-parameters . ((left . 100)
                                      (top  . 200)
                                      (height . 1)
                                      (width . 50)
                                      (no-accept-focus . nil))))))
       (frame (window-frame window)))
  (x-focus-frame frame))

Here's a video demonstrating the issue.

It's probably worth noting that I use ivy-posframe without issue.

fejfighter commented 2 years ago

Try this patch:

0001-Handle-child-frame-focussing-better.patch.txt

couple of missed handlers/dead code

There are a heap of cases where xterm emacs needs to do a heap of house keeping that gtk does for us, and there are cases where it's still relevant for gtk and it has been missed, that was one of those cases,

ivy fakes some of it by keeping selection /focus elsewhere

what wm/display are you running? this patch was tested on gnome40 wayland, but there are sometimes variations between each.

edit: s/gtk/gnome - note to self: don't upload at 12:30 am

eeshugerman commented 2 years ago

Thanks for the quick response! I'm not setup to build Emacs atm but I'll give it a shot this weekend.

eeshugerman commented 2 years ago

It works! Thanks again.

what wm/display are you running?

Gnome 40 / Wayland for me too, so no surprises I suppose :)

fejfighter commented 2 years ago

Thanks, I'll look to get it merged