diff --git a/src/client.c b/src/client.c index 7c4ebc8..7fcfd99 100644 --- a/src/client.c +++ b/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) { diff --git a/src/client.h b/src/client.h index 443d1ab..33b551a 100644 --- a/src/client.h +++ b/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); diff --git a/src/config.h b/src/config.h index 99acaa7..92a4a81 100644 --- a/src/config.h +++ b/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 }, diff --git a/wmfsrc b/wmfsrc index fb2e2df..0949f0f 100644 --- a/wmfsrc +++ b/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]