#include "grab.h"
#include "prompt.h"
#include "focus.h"
+#include "focus_cycle.h"
#include "stacking.h"
#include "openbox.h"
#include "hooks.h"
client_search_focus_tree_full(self)) &&
/* this checks for focus=false for the window */
(!settings || settings->focus != 0) &&
- focus_valid_target(self, FALSE, FALSE, TRUE, FALSE, FALSE))
+ focus_valid_target(self, FALSE, FALSE, TRUE, FALSE, FALSE) &&
+ (!focus_cycle_target || !config_focus_dontstop))
{
activate = TRUE;
}
gboolean config_focus_raise;
gboolean config_focus_last;
gboolean config_focus_under_mouse;
+gboolean config_focus_dontstop;
ObPlacePolicy config_place_policy;
gboolean config_place_center;
config_focus_last = obt_parse_node_bool(n);
if ((n = obt_parse_find_node(node, "underMouse")))
config_focus_under_mouse = obt_parse_node_bool(n);
+ if ((n = obt_parse_find_node(node, "dontStop")))
+ config_focus_dontstop = obt_parse_node_bool(n);
}
static void parse_placement(xmlNodePtr node, gpointer d)
config_focus_raise = FALSE;
config_focus_last = TRUE;
config_focus_under_mouse = FALSE;
+ config_focus_dontstop = FALSE;
obt_parse_register(i, "focus", parse_focus, NULL);
/*! Try keep focus on the window under the mouse when the mouse is not moving
*/
extern gboolean config_focus_under_mouse;
+/*! Rather than cancelling alt-tab when a client (dis)appears, don't focus anything */
+extern gboolean config_focus_dontstop;
/*! The algorithm to use for placing new windows */
extern ObPlacePolicy config_place_policy;
}
else if (client != focus_client) {
focus_left_screen = FALSE;
- frame_adjust_focus(client->frame, TRUE);
- focus_set_client(client);
- client_calc_layer(client);
- client_bring_helper_windows(client);
+ if (!focus_cycle_target || !config_focus_dontstop) {
+ frame_adjust_focus(client->frame, TRUE);
+ focus_set_client(client);
+ client_calc_layer(client);
+ client_bring_helper_windows(client);
+ }
}
} else if (e->type == FocusOut) {
XEvent ce;
ObClient *focus_client = NULL;
GList *focus_order = NULL;
+static gboolean stop_or_cancel_cycle(ObClient *c)
+{
+ /* in the middle of cycling..? kill it.
+ * or stop focusing */
+ if (config_focus_dontstop)
+ return focus_interruptable(c);
+ else {
+ focus_cycle_stop(c);
+ return FALSE;
+ }
+}
+
void focus_startup(gboolean reconfig)
{
if (reconfig) return;
if (focus_client == client)
return;
+ /* in the middle of cycling..? kill it. */
+ if (stop_or_cancel_cycle(focus_client) ||
+ stop_or_cancel_cycle(client))
+ {
+ return;
+ }
+
/* uninstall the old colormap, and install the new one */
screen_install_colormap(focus_client, FALSE);
screen_install_colormap(client, TRUE);
- /* in the middle of cycling..? kill it. */
- focus_cycle_stop(focus_client);
- focus_cycle_stop(client);
old = focus_client;
focus_client = client;
focus_order = g_list_insert(focus_order, c, 1);
}
- /* in the middle of cycling..? kill it. */
- focus_cycle_stop(c);
+ stop_or_cancel_cycle(c);
}
void focus_order_remove(ObClient *c)
{
focus_order = g_list_remove(focus_order, c);
- /* in the middle of cycling..? kill it. */
- focus_cycle_stop(c);
+ stop_or_cancel_cycle(c);
}
void focus_order_to_top(ObClient *c)
if (reconfig) return;
}
-void focus_cycle_stop(ObClient *ifclient)
+gboolean focus_interruptable(ObClient *ifclient)
{
/* stop focus cycling if the given client is a valid focus target,
and so the cycling is being disrupted */
- if (focus_cycle_target && ifclient &&
- focus_valid_target(ifclient, TRUE,
- focus_cycle_iconic_windows,
- focus_cycle_all_desktops,
- focus_cycle_dock_windows,
- focus_cycle_desktop_windows))
- {
+ return focus_cycle_target && ifclient &&
+ focus_valid_target(ifclient, TRUE,
+ focus_cycle_iconic_windows,
+ focus_cycle_all_desktops,
+ focus_cycle_dock_windows,
+ focus_cycle_desktop_windows);
+}
+
+void focus_cycle_stop(ObClient *ifclient)
+{
+ if (focus_interruptable(ifclient)) {
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,TRUE);
focus_directional_cycle(0, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
}
gboolean dialog,
gboolean done, gboolean cancel);
+gboolean focus_interruptable(struct _ObClient *ifclient);
void focus_cycle_stop(struct _ObClient *ifclient);
#endif