Broken enter-exit focus behavior in 1.5.3



I just installed version 1.5.3 from Debian unstable, and the new
version is having problem with enter-exit focus.  The enter-exit
handler function explicitly ignores grab/ungrab events for pointer
motion:

  (define-focus-mode 'enter-exit
    (lambda (w action . args)
      (case action
        ((pointer-in)
         (when (and (window-really-wants-input-p w)
                    ;; ignore grab/ungrab enter events
                    (eq (car args) 'normal))
           (set-input-focus w)))
        ((pointer-out)
         ;; ignore grab/ungrab leave events
         (when (eq (car args) 'normal)
           (set-input-focus nil)))
        ((enter-root)
         ;; ensure that any desktop window gets focused
         (set-input-focus w))
        ((warp-if-necessary)
         (unless (eq (query-pointer-window) w)
           (warp-cursor-to-window w)))
        ((focus-revert)
         (setq w (query-pointer-window))
         (when (or (null w)
                   (window-really-wants-input-p w))
           (set-input-focus w))))))

The problem is, events related to mouse motion appear to use grabs
behind the scenes.  This means that we end up dropping focus events.
I first noticed this with the raise-lower-window-and-transients
command, which I have bound to Mouse2 in titlebars.  The lowered
window maintains the focus, when the new top window should get focus.
Dragged mouse motion (Button1-Move) has the same problem: if I drag a
window underneath another one and release, to top window does not get
focus.  I also found by accident that it screws up restoring focus
after a (select-window) call.

This version of the function fixes the problems:

  (define-focus-mode 'enter-exit
    (lambda (w action . args)
      (case action
        ((pointer-in)
         (when (and (window-really-wants-input-p w))
           (set-input-focus w)))
        ((pointer-out)
           (set-input-focus nil))
        ((enter-root)
         ;; ensure that any desktop window gets focused
         (set-input-focus w))
        ((warp-if-necessary)
         (unless (eq (query-pointer-window) w)
           (warp-cursor-to-window w)))
        ((focus-revert)
         (setq w (query-pointer-window))
         (when (or (null w)
                   (window-really-wants-input-p w))
           (set-input-focus w))))))

It just removes the grab/ungrab filter.  The enter-only function needs
a similar fix.

Can anyone explain why the filter was put in?

I'm also looking into a new bug in the maximize/unmaximize code.

Derek

-- 
Derek Upham
sand blarg net


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]