mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 01:41:30 +00:00
ipc: add focus information to root node
This commit is contained in:
parent
b47f4f5fd4
commit
1c292fd43a
|
@ -314,10 +314,22 @@ struct focus_inactive_data {
|
||||||
static void focus_inactive_children_iterator(struct sway_node *node,
|
static void focus_inactive_children_iterator(struct sway_node *node,
|
||||||
void *_data) {
|
void *_data) {
|
||||||
struct focus_inactive_data *data = _data;
|
struct focus_inactive_data *data = _data;
|
||||||
if (node_get_parent(node) == data->node) {
|
json_object *focus = data->object;
|
||||||
json_object_array_add(data->object, json_object_new_int(node->id));
|
if (data->node == &root->node) {
|
||||||
|
int len = json_object_array_length(focus);
|
||||||
|
struct sway_output *output = node_get_output(node);
|
||||||
|
size_t id = output->node.id;
|
||||||
|
for (int i = 0; i < len; ++i) {
|
||||||
|
if ((size_t) json_object_get_int(json_object_array_get_idx(focus, i)) == id) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
node = &output->node;
|
||||||
|
} else if (node_get_parent(node) != data->node) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
json_object_array_add(focus, json_object_new_int(node->id));
|
||||||
|
}
|
||||||
|
|
||||||
json_object *ipc_json_describe_node(struct sway_node *node) {
|
json_object *ipc_json_describe_node(struct sway_node *node) {
|
||||||
struct sway_seat *seat = input_manager_get_default_seat(input_manager);
|
struct sway_seat *seat = input_manager_get_default_seat(input_manager);
|
||||||
|
|
Loading…
Reference in a new issue