Re: Broken enter-exit focus behavior in 1.5.3



Timo Korvola writes:
> On Tuesday 01 December 2009 07:11:47 sand blarg net wrote:

> I see.  select-window grabs the pointer, causing LeaveNotify and 
> EnterNotify events with mode NotifyGrab.  The LeaveNotify event is 
> ignored but when enter-exit mode is invoked with parameter enter-root, 
> it does not ignore grab-related events.  Thus focus is directed to the 
> root or desktop window.  When the grab ends, the induced LeaveNotify and 
> EnterNotify events are ignored, so focus remains in the root window.
> 
> Possible solutions include making the enter-root handling also ignore 
> grab-related events, in which case focus remains where it was when 
> select-window was invoked (although the pointer may have moved), or 
> making the enter-exit focus mode not ignore any grab-related EnterNotify 
> events, if that feels more natural.  To me it doesn't.  Then again I 
> don't use enter-exit mode (I used enter-only prior to enter-click).

Based on other emails, I'm not the only enter-exit user who finds the
new behavior confusing.

> >   (define (focus-enter-refocus-fun w mode)
> >     (focus-revert))
> >   (add-hook 'enter-notify-hook focus-enter-refocus-fun t)
>
> This is misguided.  focus-revert is intended for cases where the window 
> in focus disappears.  If you want to change the focusing logic, change 
> the focus mode.

You mean like this?

  (define fixed-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))))))

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

That was my original approach.  But with that approach, my local
environment doesn't reflect any upstream changes made to the original
enter-exit handler (for example, new action types).  I'm not sure
which solution is less annoying.

Derek

-- 
Derek Upham
sand blarg net


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