view: remove view_hasfocus()

This commit is contained in:
Johan Malm 2020-09-14 17:42:39 +01:00
parent c90923a20c
commit 35015e57c6
2 changed files with 2 additions and 10 deletions

View file

@ -103,13 +103,13 @@ static void render_decorations(struct wlr_output *output, struct view *view)
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_BOTTOM)); draw_rect(&ddata, deco_box(view, LAB_DECO_PART_BOTTOM));
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_LEFT)); draw_rect(&ddata, deco_box(view, LAB_DECO_PART_LEFT));
if (view_hasfocus(view)) if (view->surface == seat_focused_surface())
ddata.rgba = theme.window_active_title_bg_color; ddata.rgba = theme.window_active_title_bg_color;
else else
ddata.rgba = theme.window_inactive_title_bg_color; ddata.rgba = theme.window_inactive_title_bg_color;
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_TITLE)); draw_rect(&ddata, deco_box(view, LAB_DECO_PART_TITLE));
if (view_hasfocus(view)) { if (view->surface == seat_focused_surface()) {
render_icon(&ddata, deco_box(view, LAB_DECO_BUTTON_CLOSE), render_icon(&ddata, deco_box(view, LAB_DECO_BUTTON_CLOSE),
theme.xbm_close_active_unpressed); theme.xbm_close_active_unpressed);
render_icon(&ddata, deco_box(view, LAB_DECO_BUTTON_MAXIMIZE), render_icon(&ddata, deco_box(view, LAB_DECO_BUTTON_MAXIMIZE),

View file

@ -84,11 +84,3 @@ void view_unminimize(struct view *view)
view->minimized = false; view->minimized = false;
view->impl->map(view); view->impl->map(view);
} }
bool view_hasfocus(struct view *view)
{
if (!view || !view->surface)
return false;
struct wlr_seat *seat = view->server->seat;
return (view->surface == seat->keyboard_state.focused_surface);
}