mirror of
https://github.com/swaywm/sway.git
synced 2024-11-17 21:49:16 +00:00
remove old focus member
This commit is contained in:
parent
ce3a1b3922
commit
93084c9cf8
|
@ -106,10 +106,6 @@ struct sway_container {
|
||||||
* The parent of this container. NULL for the root container.
|
* The parent of this container. NULL for the root container.
|
||||||
*/
|
*/
|
||||||
struct sway_container *parent;
|
struct sway_container *parent;
|
||||||
/**
|
|
||||||
* Which of this container's children has focus.
|
|
||||||
*/
|
|
||||||
struct sway_container *focused;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of master views in auto layouts.
|
* Number of master views in auto layouts.
|
||||||
|
|
|
@ -225,7 +225,12 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_output_make_current(wlr_output, &buffer_age);
|
wlr_output_make_current(wlr_output, &buffer_age);
|
||||||
wlr_renderer_begin(server->renderer, wlr_output);
|
wlr_renderer_begin(server->renderer, wlr_output);
|
||||||
|
|
||||||
swayc_t *workspace = soutput->swayc->focused;
|
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||||
|
swayc_t *focus = sway_seat_get_focus_inactive(seat, soutput->swayc);
|
||||||
|
swayc_t *workspace = (focus->type == C_WORKSPACE ?
|
||||||
|
focus :
|
||||||
|
swayc_parent_by_type(focus, C_WORKSPACE));
|
||||||
|
|
||||||
swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, soutput);
|
swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, soutput);
|
||||||
|
|
||||||
// render unmanaged views on top
|
// render unmanaged views on top
|
||||||
|
|
|
@ -74,8 +74,8 @@ static void ipc_json_describe_output(swayc_t *container, json_object *object) {
|
||||||
json_object_object_add(object, "refresh", json_object_new_int(wlr_output->refresh));
|
json_object_object_add(object, "refresh", json_object_new_int(wlr_output->refresh));
|
||||||
json_object_object_add(object, "transform",
|
json_object_object_add(object, "transform",
|
||||||
json_object_new_string(ipc_json_get_output_transform(wlr_output->transform)));
|
json_object_new_string(ipc_json_get_output_transform(wlr_output->transform)));
|
||||||
json_object_object_add(object, "current_workspace",
|
// TODO WLR need to set "current_workspace" to the currently focused
|
||||||
(container->focused) ? json_object_new_string(container->focused->name) : NULL);
|
// workspace in a way that makes sense with multiseat
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) {
|
static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) {
|
||||||
|
|
|
@ -151,7 +151,6 @@ swayc_t *new_output(struct sway_output *sway_output) {
|
||||||
char *ws_name = workspace_next_name(output->name);
|
char *ws_name = workspace_next_name(output->name);
|
||||||
wlr_log(L_DEBUG, "Creating default workspace %s", ws_name);
|
wlr_log(L_DEBUG, "Creating default workspace %s", ws_name);
|
||||||
swayc_t *ws = new_workspace(output, ws_name);
|
swayc_t *ws = new_workspace(output, ws_name);
|
||||||
output->focused = ws;
|
|
||||||
// Set each seat's focus if not already set
|
// Set each seat's focus if not already set
|
||||||
// TODO FOCUS: this is probably stupid, we shouldn't define focus in two
|
// TODO FOCUS: this is probably stupid, we shouldn't define focus in two
|
||||||
// places. We should probably put the active workspace on the sway_output
|
// places. We should probably put the active workspace on the sway_output
|
||||||
|
|
|
@ -84,8 +84,6 @@ swayc_t *add_sibling(swayc_t *fixed, swayc_t *active) {
|
||||||
int i = index_child(fixed);
|
int i = index_child(fixed);
|
||||||
list_insert(parent->children, i + 1, active);
|
list_insert(parent->children, i + 1, active);
|
||||||
active->parent = parent;
|
active->parent = parent;
|
||||||
// focus new child
|
|
||||||
parent->focused = active;
|
|
||||||
return active->parent;
|
return active->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,9 +94,6 @@ void add_child(swayc_t *parent, swayc_t *child) {
|
||||||
list_add(parent->children, child);
|
list_add(parent->children, child);
|
||||||
child->parent = parent;
|
child->parent = parent;
|
||||||
// set focus for this container
|
// set focus for this container
|
||||||
if (!parent->focused) {
|
|
||||||
parent->focused = child;
|
|
||||||
}
|
|
||||||
/* TODO WLR
|
/* TODO WLR
|
||||||
if (parent->type == C_WORKSPACE && child->type == C_VIEW && (parent->workspace_layout == L_TABBED || parent->workspace_layout == L_STACKED)) {
|
if (parent->type == C_WORKSPACE && child->type == C_VIEW && (parent->workspace_layout == L_TABBED || parent->workspace_layout == L_STACKED)) {
|
||||||
child = new_container(child, parent->workspace_layout);
|
child = new_container(child, parent->workspace_layout);
|
||||||
|
|
|
@ -120,9 +120,15 @@ swayc_t *workspace_output_prev_next_impl(swayc_t *output, bool next) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||||
|
swayc_t *focus = sway_seat_get_focus_inactive(seat, output);
|
||||||
|
swayc_t *workspace = (focus->type == C_WORKSPACE ?
|
||||||
|
focus :
|
||||||
|
swayc_parent_by_type(focus, C_WORKSPACE));
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < output->children->length; i++) {
|
for (i = 0; i < output->children->length; i++) {
|
||||||
if (output->children->items[i] == output->focused) {
|
if (output->children->items[i] == workspace) {
|
||||||
return output->children->items[
|
return output->children->items[
|
||||||
wrap(i + (next ? 1 : -1), output->children->length)];
|
wrap(i + (next ? 1 : -1), output->children->length)];
|
||||||
}
|
}
|
||||||
|
@ -225,16 +231,12 @@ bool workspace_switch(swayc_t *workspace) {
|
||||||
// TODO: Deal with sticky containers
|
// TODO: Deal with sticky containers
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name);
|
wlr_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name);
|
||||||
// TODO FOCUS: Focus the last view this seat had focused on this workspace
|
swayc_t *next = sway_seat_get_focus_inactive(seat, workspace);
|
||||||
if (workspace->children->length) {
|
if (next == NULL) {
|
||||||
// TODO FOCUS: This is really fucking stupid
|
next = workspace;
|
||||||
sway_seat_set_focus(seat, workspace->children->items[0]);
|
|
||||||
} else {
|
|
||||||
sway_seat_set_focus(seat, workspace);
|
|
||||||
}
|
}
|
||||||
|
sway_seat_set_focus(seat, next);
|
||||||
swayc_t *output = swayc_parent_by_type(workspace, C_OUTPUT);
|
swayc_t *output = swayc_parent_by_type(workspace, C_OUTPUT);
|
||||||
// TODO FOCUS: take a look at this
|
|
||||||
output->focused = workspace;
|
|
||||||
arrange_windows(output, -1, -1);
|
arrange_windows(output, -1, -1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue