try to fix focus switching with mouse actions up a bit
This commit is contained in:
parent
8ba619d5f1
commit
0993012776
3 changed files with 40 additions and 22 deletions
|
@ -1411,7 +1411,7 @@ void action_cycle_windows(union ActionData *data)
|
||||||
on us */
|
on us */
|
||||||
event_halt_focus_delay();
|
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.dialog,
|
||||||
data->cycle.inter.final, data->cycle.inter.cancel);
|
data->cycle.inter.final, data->cycle.inter.cancel);
|
||||||
}
|
}
|
||||||
|
@ -1423,6 +1423,7 @@ void action_directional_focus(union ActionData *data)
|
||||||
event_halt_focus_delay();
|
event_halt_focus_delay();
|
||||||
|
|
||||||
focus_directional_cycle(data->interdiraction.direction,
|
focus_directional_cycle(data->interdiraction.direction,
|
||||||
|
data->any.interactive,
|
||||||
data->interdiraction.dialog,
|
data->interdiraction.dialog,
|
||||||
data->interdiraction.inter.final,
|
data->interdiraction.inter.final,
|
||||||
data->interdiraction.inter.cancel);
|
data->interdiraction.inter.cancel);
|
||||||
|
|
|
@ -538,7 +538,7 @@ static gboolean valid_focus_target(ObClient *ft)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void focus_cycle(gboolean forward, gboolean linear,
|
void focus_cycle(gboolean forward, gboolean linear, gboolean interactive,
|
||||||
gboolean dialog, gboolean done, gboolean cancel)
|
gboolean dialog, gboolean done, gboolean cancel)
|
||||||
{
|
{
|
||||||
static ObClient *first = NULL;
|
static ObClient *first = NULL;
|
||||||
|
@ -547,6 +547,7 @@ void focus_cycle(gboolean forward, gboolean linear,
|
||||||
GList *it, *start, *list;
|
GList *it, *start, *list;
|
||||||
ObClient *ft = NULL;
|
ObClient *ft = NULL;
|
||||||
|
|
||||||
|
if (interactive) {
|
||||||
if (cancel) {
|
if (cancel) {
|
||||||
focus_cycle_target = NULL;
|
focus_cycle_target = NULL;
|
||||||
goto done_cycle;
|
goto done_cycle;
|
||||||
|
@ -557,10 +558,15 @@ void focus_cycle(gboolean forward, gboolean linear,
|
||||||
goto done_cycle;
|
goto done_cycle;
|
||||||
|
|
||||||
if (!first) first = focus_client;
|
if (!first) first = focus_client;
|
||||||
if (!focus_cycle_target) focus_cycle_target = focus_client;
|
|
||||||
|
|
||||||
if (linear) list = client_list;
|
if (linear) list = client_list;
|
||||||
else list = focus_order[screen_desktop];
|
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;
|
||||||
|
|
||||||
start = it = g_list_find(list, focus_cycle_target);
|
start = it = g_list_find(list, focus_cycle_target);
|
||||||
if (!start) /* switched desktops or something? */
|
if (!start) /* switched desktops or something? */
|
||||||
|
@ -577,12 +583,18 @@ void focus_cycle(gboolean forward, gboolean linear,
|
||||||
}
|
}
|
||||||
ft = it->data;
|
ft = it->data;
|
||||||
if (valid_focus_target(ft)) {
|
if (valid_focus_target(ft)) {
|
||||||
|
if (interactive) {
|
||||||
if (ft != focus_cycle_target) { /* prevents flicker */
|
if (ft != focus_cycle_target) { /* prevents flicker */
|
||||||
focus_cycle_target = ft;
|
focus_cycle_target = ft;
|
||||||
focus_cycle_draw_indicator();
|
focus_cycle_draw_indicator();
|
||||||
}
|
}
|
||||||
popup_cycle(ft, dialog);
|
popup_cycle(ft, dialog);
|
||||||
return;
|
return;
|
||||||
|
} else if (ft != focus_cycle_target) {
|
||||||
|
focus_cycle_target = ft;
|
||||||
|
done = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (it != start);
|
} while (it != start);
|
||||||
|
|
||||||
|
@ -596,18 +608,23 @@ done_cycle:
|
||||||
g_list_free(order);
|
g_list_free(order);
|
||||||
order = NULL;
|
order = NULL;
|
||||||
|
|
||||||
|
if (interactive) {
|
||||||
focus_cycle_draw_indicator();
|
focus_cycle_draw_indicator();
|
||||||
popup_cycle(ft, FALSE);
|
popup_cycle(ft, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void focus_directional_cycle(ObDirection dir,
|
void focus_directional_cycle(ObDirection dir, gboolean interactive,
|
||||||
gboolean dialog, gboolean done, gboolean cancel)
|
gboolean dialog, gboolean done, gboolean cancel)
|
||||||
{
|
{
|
||||||
static ObClient *first = NULL;
|
static ObClient *first = NULL;
|
||||||
ObClient *ft = NULL;
|
ObClient *ft = NULL;
|
||||||
|
|
||||||
|
if (!interactive)
|
||||||
|
return;
|
||||||
|
|
||||||
if (cancel) {
|
if (cancel) {
|
||||||
focus_cycle_target = NULL;
|
focus_cycle_target = NULL;
|
||||||
goto done_cycle;
|
goto done_cycle;
|
||||||
|
|
|
@ -57,9 +57,9 @@ struct _ObClient* focus_fallback_target(ObFocusFallbackType type);
|
||||||
void focus_fallback(ObFocusFallbackType type);
|
void focus_fallback(ObFocusFallbackType type);
|
||||||
|
|
||||||
/*! Cycle focus amongst windows. */
|
/*! 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);
|
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);
|
gboolean dialog, gboolean done, gboolean cancel);
|
||||||
void focus_cycle_draw_indicator();
|
void focus_cycle_draw_indicator();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue