seat: remove seat_focused_surface()

This commit is contained in:
Johan Malm 2020-10-07 21:49:58 +01:00
parent 7eb33334d2
commit 8e2b3ea89a
5 changed files with 6 additions and 12 deletions

View file

@ -241,7 +241,6 @@ void keyboard_init(struct seat *seat);
void seat_init(struct server *server);
void seat_finish(struct server *server);
void seat_focus_surface(struct wlr_seat *seat, struct wlr_surface *surface);
struct wlr_surface *seat_focused_surface(void);
void interactive_begin(struct view *view, enum cursor_mode mode,
uint32_t edges);

View file

@ -76,7 +76,7 @@ focus_view(struct view *view)
return;
}
if (prev_surface) {
set_activated(wlr_seat->keyboard_state.focused_surface, false);
set_activated(prev_surface, false);
}
move_to_front(view);

View file

@ -134,7 +134,8 @@ render_decorations(struct wlr_output *output, struct view *view)
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_LEFT));
/* title */
if (view->surface == seat_focused_surface())
struct wlr_seat *seat = view->server->seat.seat;
if (view->surface == seat->keyboard_state.focused_surface)
ddata.rgba = theme.window_active_title_bg_color;
else
ddata.rgba = theme.window_inactive_title_bg_color;
@ -152,7 +153,7 @@ render_decorations(struct wlr_output *output, struct view *view)
}
/* buttons */
if (view->surface == seat_focused_surface()) {
if (view->surface == seat->keyboard_state.focused_surface) {
render_icon(&ddata, deco_box(view, LAB_DECO_BUTTON_CLOSE),
theme.xbm_close_active_unpressed);
render_icon(&ddata, deco_box(view, LAB_DECO_BUTTON_MAXIMIZE),

View file

@ -128,9 +128,3 @@ seat_focus_surface(struct wlr_seat *seat, struct wlr_surface *surface)
wlr_seat_keyboard_notify_enter(seat, surface, kb->keycodes,
kb->num_keycodes, &kb->modifiers);
}
struct wlr_surface *
seat_focused_surface(void)
{
return current_seat->seat->keyboard_state.focused_surface;
}

View file

@ -52,7 +52,8 @@ unmanaged_handle_unmap(struct wl_listener *listener, void *data)
wl_list_remove(&unmanaged->link);
wl_list_remove(&unmanaged->commit.link);
if (seat_focused_surface() == xsurface->surface) {
struct wlr_seat *seat = unmanaged->server->seat.seat;
if (seat->keyboard_state.focused_surface == xsurface->surface) {
struct xwayland_unmanaged *u;
struct wl_list *list = &unmanaged->server->unmanaged_surfaces;
wl_list_for_each (u, list, link) {
@ -60,7 +61,6 @@ unmanaged_handle_unmap(struct wl_listener *listener, void *data)
if (!wlr_xwayland_or_surface_wants_focus(prev)) {
continue;
}
struct wlr_seat *seat = unmanaged->server->seat.seat;
seat_focus_surface(seat, prev->surface);
return;
}