void view_focus(struct view *view);
struct view *view_front_toplevel(struct server *server);
struct view *next_toplevel(struct view *current);
+bool view_hasfocus(struct view *view);
struct view *view_at(struct server *server, double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy,
int *view_area);
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_BOTTOM));
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_LEFT));
- ddata.rgba = theme.window_active_title_bg_color;
+
+ if (view_hasfocus(view))
+ ddata.rgba = theme.window_active_title_bg_color;
+ else
+ ddata.rgba = theme.window_inactive_title_bg_color;
draw_rect(&ddata, deco_box(view, LAB_DECO_PART_TITLE));
}
}
}
+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);
+}
+
void view_focus(struct view *view)
{
/* Note: this function only deals with keyboard focus. */