all repos — openbox @ 0993012776e159a5b94a34034289f2274ad6c7bf

openbox fork - make it a bit more like ryudo

try to fix focus switching with mouse actions up a bit
Mikael Magnusson mikachu@comhem.se
commit

0993012776e159a5b94a34034289f2274ad6c7bf

parent

8ba619d5f15742d08850fe403e99e472ac5cf790

3 files changed, 40 insertions(+), 22 deletions(-)

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

@@ -1411,7 +1411,7 @@ /* if using focus_delay, stop the timer now so that focus doesn't go moving

on us */ event_halt_focus_delay(); - focus_cycle(data->cycle.forward, data->cycle.linear, + focus_cycle(data->cycle.forward, data->cycle.linear, data->any.interactive, data->cycle.dialog, data->cycle.inter.final, data->cycle.inter.cancel); }

@@ -1423,6 +1423,7 @@ on us */

event_halt_focus_delay(); focus_directional_cycle(data->interdiraction.direction, + data->any.interactive, data->interdiraction.dialog, data->interdiraction.inter.final, data->interdiraction.inter.cancel);
M openbox/focus.copenbox/focus.c

@@ -538,7 +538,7 @@

return FALSE; } -void focus_cycle(gboolean forward, gboolean linear, +void focus_cycle(gboolean forward, gboolean linear, gboolean interactive, gboolean dialog, gboolean done, gboolean cancel) { static ObClient *first = NULL;

@@ -547,21 +547,27 @@ static GList *order = NULL;

GList *it, *start, *list; ObClient *ft = NULL; - if (cancel) { - focus_cycle_target = NULL; - goto done_cycle; - } else if (done) - goto done_cycle; + if (interactive) { + if (cancel) { + focus_cycle_target = NULL; + goto done_cycle; + } else if (done) + goto done_cycle; - if (!focus_order[screen_desktop]) - goto done_cycle; + if (!focus_order[screen_desktop]) + goto done_cycle; + + if (!first) first = focus_client; - if (!first) first = focus_client; + if (linear) list = client_list; + else list = focus_order[screen_desktop]; + } else { + if (!focus_order[screen_desktop]) + goto done_cycle; + list = client_list; + } if (!focus_cycle_target) focus_cycle_target = focus_client; - if (linear) list = client_list; - else list = focus_order[screen_desktop]; - start = it = g_list_find(list, focus_cycle_target); if (!start) /* switched desktops or something? */ start = it = forward ? g_list_last(list) : g_list_first(list);

@@ -577,12 +583,18 @@ if (it == NULL) it = g_list_last(list);

} ft = it->data; if (valid_focus_target(ft)) { - if (ft != focus_cycle_target) { /* prevents flicker */ + if (interactive) { + if (ft != focus_cycle_target) { /* prevents flicker */ + focus_cycle_target = ft; + focus_cycle_draw_indicator(); + } + popup_cycle(ft, dialog); + return; + } else if (ft != focus_cycle_target) { focus_cycle_target = ft; - focus_cycle_draw_indicator(); + done = TRUE; + break; } - popup_cycle(ft, dialog); - return; } } while (it != start);

@@ -596,17 +608,22 @@ focus_cycle_target = NULL;

g_list_free(order); order = NULL; - focus_cycle_draw_indicator(); - popup_cycle(ft, FALSE); + if (interactive) { + focus_cycle_draw_indicator(); + popup_cycle(ft, FALSE); + } return; } -void focus_directional_cycle(ObDirection dir, +void focus_directional_cycle(ObDirection dir, gboolean interactive, gboolean dialog, gboolean done, gboolean cancel) { static ObClient *first = NULL; ObClient *ft = NULL; + + if (!interactive) + return; if (cancel) { focus_cycle_target = NULL;
M openbox/focus.hopenbox/focus.h

@@ -57,9 +57,9 @@ /*! Call this when you need to focus something! */

void focus_fallback(ObFocusFallbackType type); /*! Cycle focus amongst windows. */ -void focus_cycle(gboolean forward, gboolean linear, +void focus_cycle(gboolean forward, gboolean linear, gboolean interactive, gboolean dialog, gboolean done, gboolean cancel); -void focus_directional_cycle(ObDirection dir, +void focus_directional_cycle(ObDirection dir, gboolean interactive, gboolean dialog, gboolean done, gboolean cancel); void focus_cycle_draw_indicator();