in summary ( was Re: [openbox] sloppy focus? )

corey at streamreel.net corey at streamreel.net
Sun Nov 16 18:52:55 EST 2003


Ok, this is it from me trying to get this in ( honestly! (c8= ) - unless
you guys want to continue discussing/brainstorming ( which I'm happy to
oblige ), I'll cease and desist on the whole matter after this, I'm really
not trying to rock the boat or be pain. I'll just summarize it all right here. 

The patch is attached, 
  'cd .../<obsourcedir>/openbox; patch -p0 <ob-3.0.ffm.patch'

and the explanation follows:


We introduce the concept of a "lazy focus" and a "sloppy focus". Lazy focus
operates in the current manner, and sloppy focus operates in the manner that
all the other wm's conform to.

ObConf might look something this:


===================================================================

Focusing Windows

  Delay before focusing windows ("Lazy Focus"): |___|

  |__| Focus strictly follows mouse ("Sloppy Focus")
         Delay before raising windows: |___|

  |__| Raise windows when the mouse pointer moves over them                       

  |__| Focus new windows when they appear                                         

===================================================================


  Setting Lazy Focus to a non-zero does the following:

    1 - greys out and unsets the Sloppy Focus option
    2 - sets "followMouse" ('config_focus_follow') to true
    3 - sets "lazyFocus" ('config_lazy_focus') to true

  Selecting Sloppy Focus checkbox does the following:

    1 - greys out and unsets the Lazy Focus option
    2 - sets "followMouse" ('config_focus_follow') to true
    3 - sets "sloppyFocus" ('config_sloppy_focus') to true

  Selecting "Raise windows..." checkbox does the following:

    1 - sets "followMouse" ('config_focus_follow') to true
    2 - sets "raiseOnFocus" ('config_focus_raise') to true


The 'focus' container element in the rc.xml will recieve two new properties:
"lazyFocus" and "sloppyFocus". Also, we'll add a "raiseDelay" - just to keep
things descriptive, so their labels actualy represent their functions.

Here's a snippet:

<focus>
  <focusNew>yes</focusNew>
  <followMouse>yes</followMouse>
  <raiseOnFocus>yes</raiseOnFocus>
  <sloppyFocus>yes</sloppyFocus>
  <focusDelay>450</focusDelay>
  <!-- <lazyFocus>yes</lazyFocus>   -->
  <!-- <raiseDelay>450</raiseDelay> -->
</focus>


Cheers,

Corey

-------------- next part --------------
*** config.h	Wed Oct 15 03:57:31 2003
--- config.h.new	Sun Nov 16 23:03:13 2003
***************
*** 31,38 ****
  extern gboolean config_focus_new;
  /*! Focus windows when the mouse enters them */
  extern gboolean config_focus_follow;
! /*! Timeout for focusing windows on focus follows mouse, in microseconds */
! extern guint    config_focus_delay;
  /*! If windows should automatically be raised when they are focused in
   focus follows mouse */
  extern guint    config_focus_raise;
--- 31,43 ----
  extern gboolean config_focus_new;
  /*! Focus windows when the mouse enters them */
  extern gboolean config_focus_follow;
! /*! Focus when raised */
! extern gboolean config_lazy_focus;
! /*! Window focus strictly follows mouse */
! extern gboolean config_sloppy_focus;
! /*! Timeout for focusing (lazy focus) or raising (sloppy focus) windows on 
!  focus follows mouse, in microseconds */
! extern guint    config_delay_timer;
  /*! If windows should automatically be raised when they are focused in
   focus follows mouse */
  extern guint    config_focus_raise;
*** config.c	Sat Oct 25 19:37:58 2003
--- config.c.new	Sun Nov 16 23:03:19 2003
***************
*** 26,32 ****
  
  gboolean config_focus_new;
  gboolean config_focus_follow;
! guint    config_focus_delay;
  guint    config_focus_raise;
  
  ObPlacePolicy config_place_policy;
--- 26,34 ----
  
  gboolean config_focus_new;
  gboolean config_focus_follow;
! gboolean config_lazy_focus;
! gboolean config_sloppy_focus;
! guint    config_delay_timer;
  guint    config_focus_raise;
  
  ObPlacePolicy config_place_policy;
***************
*** 200,207 ****
          config_focus_new = parse_bool(doc, n);
      if ((n = parse_find_node("followMouse", node)))
          config_focus_follow = parse_bool(doc, n);
      if ((n = parse_find_node("focusDelay", node)))
!         config_focus_delay = parse_int(doc, n) * 1000;
      if ((n = parse_find_node("raiseOnFocus", node)))
          config_focus_raise = parse_bool(doc, n);
  }
--- 202,215 ----
          config_focus_new = parse_bool(doc, n);
      if ((n = parse_find_node("followMouse", node)))
          config_focus_follow = parse_bool(doc, n);
+     if ((n = parse_find_node("lazyFocus", node)))
+         config_lazy_focus = parse_bool(doc, n);
      if ((n = parse_find_node("focusDelay", node)))
!         config_delay_timer = parse_int(doc, n) * 1000;
!     if ((n = parse_find_node("sloppyFocus", node)))
!         config_sloppy_focus = parse_bool(doc, n);
!     if ((n = parse_find_node("raiseDelay", node)))
!         config_delay_timer = parse_int(doc, n) * 1000;
      if ((n = parse_find_node("raiseOnFocus", node)))
          config_focus_raise = parse_bool(doc, n);
  }
***************
*** 486,492 ****
  {
      config_focus_new = TRUE;
      config_focus_follow = FALSE;
!     config_focus_delay = 0;
      config_focus_raise = FALSE;
  
      parse_register(i, "focus", parse_focus, NULL);
--- 494,502 ----
  {
      config_focus_new = TRUE;
      config_focus_follow = FALSE;
!     config_lazy_focus = FALSE;
!     config_sloppy_focus = FALSE;
!     config_delay_timer = 0;
      config_focus_raise = FALSE;
  
      parse_register(i, "focus", parse_focus, NULL);
*** event.c	Sat Oct 18 21:41:15 2003
--- event.c.new	Sun Nov 16 23:03:26 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,570 ----
      g_assert(config_focus_follow);
  
      if (client_normal(client) && client_can_focus(client)) {
! 
!         if (focus_client != client) {
! 	    if (config_sloppy_focus)
!                 client_focus(client);
! 
!            if (config_delay_timer) {
!                ob_main_loop_timeout_remove(ob_main_loop, focus_delay_func);
!                ob_main_loop_timeout_add(ob_main_loop,
!                                         config_delay_timer,
!                                         focus_delay_func,
!                                         client, NULL);
!            } else
! 	      focus_delay_func(client);
! 	}
      }
  }
  
***************
*** 652,658 ****
              frame_adjust_state(client->frame);
              break;
          case OB_FRAME_CONTEXT_FRAME:
!             if (config_focus_follow && config_focus_delay)
                  ob_main_loop_timeout_remove_data(ob_main_loop,
                                                   focus_delay_func,
                                                   client);
--- 658,664 ----
              frame_adjust_state(client->frame);
              break;
          case OB_FRAME_CONTEXT_FRAME:
!             if (config_focus_follow && config_delay_timer)
                  ob_main_loop_timeout_remove_data(ob_main_loop,
                                                   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 */
  }
  
--- 1211,1221 ----
  {
      ObClient *c = data;
  
!     if (config_focus_raise)
!         if (config_lazy_focus)
! 	    client_focus(c);
!         client_raise(c);
!     
      return FALSE; /* no repeat */
  }
  


More information about the openbox mailing list