Browse Source

Add client_focus_click uicb, by default with button1 on client

Martin Duquesnoy 12 years ago
parent
commit
ade67b66ee
4 changed files with 14 additions and 20 deletions
  1. 11 20
      src/client.c
  2. 1 0
      src/client.h
  3. 1 0
      src/config.h
  4. 1 0
      wmfsrc

+ 11 - 20
src/client.c

@@ -553,6 +553,17 @@ client_focus(struct client *c)
      ewmh_update_wmfs_props();
 }
 
+void
+uicb_client_focus_click(Uicb cmd)
+{
+     (void)cmd;
+     struct client *c;
+
+     if((c = client_gb_titlebar(W->last_clicked_barwin->win))
+        || (c = client_gb_frame(W->last_clicked_barwin->win)))
+          client_focus(c);
+}
+
 /** Get a client name
  * \param c struct client pointer
 */
@@ -681,26 +692,6 @@ client_get_sizeh(struct client *c)
           c->flags |= CLIENT_HINT_FLAG;
 }
 
-/* Window id (unsigned int) is casted in Uicb type (char*) and restored */
-void
-uicb_client_focus_with_wid(Uicb cmd)
-{
-     struct client *c;
-     size_t i;
-     Window id = 0;
-
-     /* Re-build window id from cmd string */
-     for(i = 0; i < sizeof(Window); ++i)
-          ((char*)&id)[i] = cmd[i];
-
-     SLIST_FOREACH(c, &W->h.client, next)
-          if(c->win == id)
-          {
-               client_focus(c);
-               return;
-          }
-}
-
 static void
 client_frame_new(struct client *c)
 {

+ 1 - 0
src/client.h

@@ -27,6 +27,7 @@ void client_tab_pull(struct client *c);
 void _client_tab(struct client *c, struct client *cm);
 void client_tab_focus(struct client *c);
 void client_focus(struct client *c);
+void uicb_client_focus_click(Uicb);
 void client_get_name(struct client *c);
 void client_close(struct client *c);
 void uicb_client_close(Uicb cmd);

+ 1 - 0
src/config.h

@@ -70,6 +70,7 @@ static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
      { "client_untab",          uicb_client_untab },
      { "client_focus_next_tab", uicb_client_focus_next_tab },
      { "client_focus_prev_tab", uicb_client_focus_prev_tab },
+     { "client_focus_click",    uicb_client_focus_click },
 
      /* Status */
      { "status" , uicb_status },

+ 1 - 0
wmfsrc

@@ -89,6 +89,7 @@
 
 [client]
 
+  [mouse] button = "1" func = "client_focus_click" [/mouse]
   [mouse] button = "1" func = "mouse_swap"   [/mouse]
   [mouse] button = "2" func = "mouse_tab"    [/mouse]
   [mouse] button = "3" func = "mouse_resize" [/mouse]