PATCH - sloppy focus ( was Re: [openbox] sloppy focus? )

corey at streamreel.net corey at streamreel.net
Sat Nov 15 08:49:49 EST 2003


Ok, attached is a simple patch implementing what I think is a more
natural and standard focus follows mouse behavior.

Please try it out, if you like. 

I'm personaly hoping that it will be considered for incorporation into 
the mainline source tree rather than being resigned to float around as an 
external patch - see my comments further down below for my reasoning.

If you guys decide you'd like to see this merged, I'll be happy to also
supply a few additional changes I think would be warranted:

  #1 - All references in the code to '*focus_delay*' should be replaced
       with raise_delay, which better describes the new model.

  #2 - Correct the ObConf text within the "Focusing Windows" option to
       specify: "Delay before raising windows: ____", 
       rather than: "Delay before focusing and raising windows: ____" -
       in order to reflect the new behavior.

  #3 - (Debatable) If we think having separate raise_delay and focus_delay
       options would be a worthy feature, I can implement that as well.


Beers,

Corey


On Sat, Nov 15, 2003 at 08:12:44AM +0000, corey at streamreel.net wrote:
> 
> On Sun, Nov 16, 2003 at 02:50:20AM +0100, Mikael Magnusson wrote:
> <snip>
> > >   I'll go through the mailling list archives and see if I can find the 
> > >   thread - anyone happen to remember the subject?
> > 
> > I'm pretty sure we talked about it on irc, not here.
> > 
> 
>   Bummer - then hopefully anyone following this thread can forgive me
>   if I end up raising questions or topics already discussed.
> 
> 
> <snippage>
> > It should be fairly easy to change the delay to do raise instead of focus, 
> > 
> 
>   Looking at the code, it seems to me that focusing and raising sorta
>   got munged together - i.e., currently you can't focus without raising.
> 
>   In my experience, this goes against the standard norm for focus follows
>   mouse behavior -- in all instances of other "unixy" wm's I've ever used,
>   focus follows mouse _always_ immediatlely focuses the window on a mouse 
>   over event, and allows the user to configure whether there is a delay
>   before the window actualy raises.
> 
> 
> > as long as you dont want separate delays for raising and focusing.
> >
> 
>   I think providing the ability to raise without focusing may be config
>   overkill/feature-creep, so I don't (personaly) see any reason to enable
>   separate delays for raising and focusing -- although I can imagine where
>   to some people, in certain rare circumstances, that might be useful.
> 
>   Anyone else out there using focus follows mouse, with a focus/raise
>   delay, annoyed by the way ob3 handles things? I for one constantly end 
>   up momentarily typing into the previous window when I move my mouse to
>   a new one. 
> 
>   I could disable the delay, but I purposefully have a delay set before
>   raising so that I'm not constantly raising various nearby windows
>   inadvertently - this is what most people seem to hate about focus follows
>   mouse behavior; but that is what the raise delay helps alleviate.
> 
>   I could click into the window immediately when I intend to use it, but,
>   uh... that kinda defeats the purpose behind focus follows mouse, eh? 
> 
>   Finaly, I could simply wait for that ~450-some-odd miliseconds to elapse
>   before interacting with the desired window; but that just don't work in
>   practice... anyone who's ever typed into a remote shell/term with even
>   slight lag knows, pause, how, pause, ex-... pause, -cruciating, pause...
>   that can be.
> 
>   In ObConf:
> 
> "Delay before focusing and raising: ____"
> 
>   Should be:
> 
> "Delay before raising: ____"
> 
>   And the focus should happen immediately.
> 
> 
>   I'll definitely patch the source to match the above behavior, are you 
>   guys sure this shouldn't be the standard way ob3 works? Again, sorry
>   that I missed the previous discussion regarding this.
> 
> 
> Beers!
> 
> Corey
> 
-------------- next part --------------
*** event.c	Sat Oct 18 21:41:15 2003
--- event.c.patch	Sat Nov 15 13:16:05 2003
***************
*** 551,564 ****
      g_assert(config_focus_follow);
  
      if (client_normal(client) && client_can_focus(client)) {
!         if (config_focus_delay) {
!             ob_main_loop_timeout_remove(ob_main_loop, focus_delay_func);
!             ob_main_loop_timeout_add(ob_main_loop,
!                                      config_focus_delay,
!                                      focus_delay_func,
!                                      client, NULL);
!         } else
!             focus_delay_func(client);
      }
  }
  
--- 551,569 ----
      g_assert(config_focus_follow);
  
      if (client_normal(client) && client_can_focus(client)) {
! 
!         if (focus_client != client) {
!            client_focus(client);
! 
!            if (config_focus_delay) {
!                ob_main_loop_timeout_remove(ob_main_loop, focus_delay_func);
!                ob_main_loop_timeout_add(ob_main_loop,
!                                         config_focus_delay,
!                                         focus_delay_func,
!                                         client, NULL);
!            } else
! 	      focus_delay_func(client);
! 	}
      }
  }
  
***************
*** 1205,1215 ****
  {
      ObClient *c = data;
  
!     if (focus_client != c) {
!         client_focus(c);
!         if (config_focus_raise)
!             client_raise(c);
!     }
      return FALSE; /* no repeat */
  }
  
--- 1210,1218 ----
  {
      ObClient *c = data;
  
!     if (config_focus_raise)
!         client_raise(c);
!     
      return FALSE; /* no repeat */
  }
  


More information about the openbox mailing list