]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/output.c: support theme.window_inactive_title_bg_color
authorJohan Malm <jgm323@gmail.com>
Mon, 15 Jun 2020 20:44:57 +0000 (21:44 +0100)
committerJohan Malm <jgm323@gmail.com>
Mon, 15 Jun 2020 20:44:57 +0000 (21:44 +0100)
include/labwc.h
src/output.c
src/view.c

index 8e1e10d48fc4aacb8ca0fdfe1c50ea6c98200440..fcd9936c54b814a738a5367b157f4db7b97bdfc4 100644 (file)
@@ -148,6 +148,7 @@ bool view_want_deco(struct view *view);
 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);
index 35197dcd44b16f172c9fdbeb748a88a741873175..521497b4e9c93e7a158902bfd3035e31a883f4ca 100644 (file)
@@ -52,7 +52,11 @@ 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_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));
 }
 
index 271e03633794307fd2d57112920e68b7b811864a..44a80cc778de34d0396fb8099885063598e1f118 100644 (file)
@@ -123,6 +123,14 @@ static void set_activated(struct wlr_surface *surface, bool activated)
        }
 }
 
+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. */