all repos — openbox @ b0f43a115909a810bca9bbfa664851703bfd43e1

openbox fork - make it a bit more like ryudo

don't focus splash screens and toolbars and menus when you click on them. or enter them.
Dana Jansens danakj@orodu.net
commit

b0f43a115909a810bca9bbfa664851703bfd43e1

parent

97821223393cdebd3eb3fdfcc6d0dcf7502a62d7

4 files changed, 29 insertions(+), 9 deletions(-)

jump to
M openbox/action.copenbox/action.c

@@ -1199,10 +1199,7 @@

void action_activate(union ActionData *data) { if (data->client.any.c) { - /* similar to the openbox dock for dockapps, don't let user actions - give focus to 3rd-party docks (panels) either (unless they ask for - it themselves). */ - if (data->client.any.c->type != OB_CLIENT_TYPE_DOCK) { + if (!data->any.button || client_mouse_focusable(data->client.any.c)) { /* if using focus_delay, stop the timer now so that focus doesn't go moving on us */ event_halt_focus_delay();

@@ -1220,10 +1217,7 @@

void action_focus(union ActionData *data) { if (data->client.any.c) { - /* similar to the openbox dock for dockapps, don't let user actions - give focus to 3rd-party docks (panels) either (unless they ask for - it themselves). */ - if (data->client.any.c->type != OB_CLIENT_TYPE_DOCK) { + if (!data->any.button || client_mouse_focusable(data->client.any.c)) { /* if using focus_delay, stop the timer now so that focus doesn't go moving on us */ event_halt_focus_delay();
M openbox/client.copenbox/client.c

@@ -2394,6 +2394,22 @@ self->type == OB_CLIENT_TYPE_MENU ||

self->type == OB_CLIENT_TYPE_TOOLBAR); } +gboolean client_mouse_focusable(ObClient *self) +{ + return !(self->type == OB_CLIENT_TYPE_MENU || + self->type == OB_CLIENT_TYPE_TOOLBAR || + self->type == OB_CLIENT_TYPE_SPLASH || + self->type == OB_CLIENT_TYPE_DOCK); +} + +gboolean client_enter_focusable(ObClient *self) +{ + /* you can focus desktops but it shouldn't on enter */ + return (client_mouse_focusable(self) && + self->type != OB_CLIENT_TYPE_DESKTOP); +} + + static void client_apply_startup_state(ObClient *self, gint x, gint y) { gboolean pos = FALSE; /* has the window's position been configured? */
M openbox/client.hopenbox/client.h

@@ -338,6 +338,16 @@ /*! Returns if the window is one of an application's helper windows

(utilty, menu, etc) */ gboolean client_helper(ObClient *self); +/*! Return if the client is a type which should be given focus from mouse + actions like button presses. This doesn't count for focus cycling, different + rules apply to that. */ +gboolean client_mouse_focusable(ObClient *self); + +/*! Return if the client is a type which should be given focus from the + mouse entering the window. This doesn't count for focus cycling, different + rules apply to that. */ +gboolean client_enter_focusable(ObClient *self); + /* Returns if the window is focused */ gboolean client_focused(ObClient *self);
M openbox/event.copenbox/event.c

@@ -676,7 +676,7 @@ void event_enter_client(ObClient *client)

{ g_assert(config_focus_follow); - if (client_normal(client) && client_can_focus(client)) { + if (client_enter_focusable(client) && client_can_focus(client)) { if (config_focus_delay) { ObFocusDelayData *data;