fallback to transients' parents when possible.
return the Client* which was focused from focus_cycle
This commit is contained in:
parent
fc32577766
commit
f278ec41e4
2 changed files with 24 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
#include "group.h"
|
||||||
#include "prop.h"
|
#include "prop.h"
|
||||||
#include "dispatch.h"
|
#include "dispatch.h"
|
||||||
#include "focus.h"
|
#include "focus.h"
|
||||||
|
@ -185,6 +186,21 @@ void focus_fallback(gboolean switching_desks)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (old && old->transient_for) {
|
||||||
|
if (old->transient_for == TRAN_GROUP) {
|
||||||
|
for (it = focus_order[screen_desktop]; it != NULL; it = it->next) {
|
||||||
|
GSList *sit;
|
||||||
|
|
||||||
|
for (sit = old->group->members; sit; sit = sit->next)
|
||||||
|
if (sit->data == it->data && client_focus(sit->data))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (client_focus(old->transient_for))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (it = focus_order[screen_desktop]; it != NULL; it = it->next)
|
for (it = focus_order[screen_desktop]; it != NULL; it = it->next)
|
||||||
if (it->data != old && client_normal(it->data))
|
if (it->data != old && client_normal(it->data))
|
||||||
if (client_focus(it->data))
|
if (client_focus(it->data))
|
||||||
|
@ -194,7 +210,7 @@ void focus_fallback(gboolean switching_desks)
|
||||||
focus_set_client(NULL);
|
focus_set_client(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void focus_cycle(gboolean forward, gboolean linear, gboolean done,
|
Client *focus_cycle(gboolean forward, gboolean linear, gboolean done,
|
||||||
gboolean cancel)
|
gboolean cancel)
|
||||||
{
|
{
|
||||||
static Client *first = NULL;
|
static Client *first = NULL;
|
||||||
|
@ -235,15 +251,16 @@ void focus_cycle(gboolean forward, gboolean linear, gboolean done,
|
||||||
if (ft == it->data && focus_client != ft && client_focusable(ft)) {
|
if (ft == it->data && focus_client != ft && client_focusable(ft)) {
|
||||||
if (client_focus(ft)) {
|
if (client_focus(ft)) {
|
||||||
noreorder++; /* avoid reordering the focus_order */
|
noreorder++; /* avoid reordering the focus_order */
|
||||||
break;
|
return ft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (it != start);
|
} while (it != start);
|
||||||
return;
|
return NULL;
|
||||||
|
|
||||||
done_cycle:
|
done_cycle:
|
||||||
t = NULL;
|
t = NULL;
|
||||||
first = NULL;
|
first = NULL;
|
||||||
g_list_free(order);
|
g_list_free(order);
|
||||||
order = NULL;
|
order = NULL;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,9 @@ void focus_set_client(struct Client *client);
|
||||||
/*! Call this when you need to focus something! */
|
/*! Call this when you need to focus something! */
|
||||||
void focus_fallback(gboolean switching_desks);
|
void focus_fallback(gboolean switching_desks);
|
||||||
|
|
||||||
/*! Cycle focus amongst windows */
|
/*! Cycle focus amongst windows
|
||||||
void focus_cycle(gboolean forward, gboolean linear, gboolean done,
|
Returns the Client to which focus has been cycled, or NULL if none. */
|
||||||
gboolean cancel);
|
struct Client *focus_cycle(gboolean forward, gboolean linear, gboolean done,
|
||||||
|
gboolean cancel);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue