Re: Broken enter-exit focus behavior in 1.5.3



Timo Korvola writes:
> Apart from that, the name and the focus-revert action, your version is 
> now identical to enter-exit mode prior to commit c10c8c0326 (focus-
> revert was implemented after that commit).  So your focus mode has the 
> problem that I fixed but not those caused by the fix.  It should be 
> usable as long as you have all the pointer warping options turned on so 
> that focus is never far from the pointer.  If you don't use pointer 
> warping, you may be annoyed when a transient window is closed and focus 
> goes to the pointer window instead of the transient parent.  Then again 
> enter-click mode generally works better than enter-exit if warping is 
> not used. 

So just to be clear:

  1. Let's say I start GNU Emacs 23 under X, with the GTK menus.

  2. I select "Options > Set Default Font ...", which brings up a
  dialog box.  Its window property list (via window-plist) confirms
  that it's transient.

  3. The transient window gets focus automatically when it appears.

  4. With my current focus-mode function, when cancelling from the
  dialog box, I should expect focus to go to whatever window is
  underneath the pointer when cancelling, possibly the root window.

Correct?

I have no problems with that behavior.  My place-transient-mode option
is set to 'centered-on-parent, so it's highly unlikely that the
pointer needs to go anywhere other than above the parent.  If I can
use the dialog box entirely with my keyboard, then focus goes back to
the main app anyway, because the pointer never moved.  And if I use
the dialog box with the mouse, then it's trivial for me to move the
pointer back to where I want focus.

Here's the updated version of the function, which recognizes and
ignores a few more actions:

  (define fixed-enter-exit
    (lambda (w action . args)
      (case action
        ((pointer-in)
         (when (window-really-wants-input-p w)
           (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)))
        ((focus-in focus-out leave-root add-window)
         ;; ignore all of these
         nil)
        (t
         (display-message
          (format nil "Dropped focus action %s %s" action args))))))

  (put 'enter-exit 'focus-mode fixed-enter-exit)

I think the Wiki needs an "I Love Sawfish: Reasons Why" page.

Derek

-- 
Derek Upham
sand blarg net


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