return state;
}
+static struct focus_state *
+ensure_focus_state(struct desktop_shell *shell, struct weston_seat *seat)
+{
+ struct workspace *ws = get_current_workspace(shell);
+ struct focus_state *state;
+
+ wl_list_for_each(state, &ws->focus_list, link)
+ if (state->seat == seat)
+ break;
+
+ if (&state->link == &ws->focus_list)
+ state = focus_state_create(seat, ws);
+
+ return state;
+}
+
static void
restore_focus_state(struct desktop_shell *shell, struct workspace *ws)
{
struct shell_surface *shsurf;
struct workspace *from;
struct workspace *to;
+ struct focus_state *state;
if (surface == NULL ||
index == shell->workspaces.current)
}
broadcast_current_workspace_state(shell);
+
+ state = ensure_focus_state(shell, seat);
+ if (state != NULL)
+ state->keyboard_focus = surface;
}
static void
activate(struct desktop_shell *shell, struct weston_surface *es,
struct weston_seat *seat)
{
- struct workspace *ws = get_current_workspace(shell);
struct focus_state *state;
+ struct workspace *ws;
weston_surface_activate(es, seat);
- wl_list_for_each(state, &ws->focus_list, link)
- if (state->seat == seat)
- break;
-
- if (&state->link == &ws->focus_list) {
- state = focus_state_create(seat, ws);
- if (state == NULL)
- return;
- }
+ state = ensure_focus_state(shell, seat);
+ if (state == NULL)
+ return;
state->keyboard_focus = es;
wl_list_remove(&state->surface_destroy_listener.link);