From 35015e57c67b9584fcc64d9905b26396a33177e8 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Mon, 14 Sep 2020 17:42:39 +0100 Subject: [PATCH] view: remove view_hasfocus() --- src/output.c | 4 ++-- src/view.c | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/output.c b/src/output.c index d588a508..44cf15e1 100644 --- a/src/output.c +++ b/src/output.c @@ -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_LEFT)); - if (view_hasfocus(view)) + if (view->surface == seat_focused_surface()) 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)); - if (view_hasfocus(view)) { + if (view->surface == seat_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), diff --git a/src/view.c b/src/view.c index e28588c0..d47a07b3 100644 --- a/src/view.c +++ b/src/view.c @@ -84,11 +84,3 @@ void view_unminimize(struct view *view) view->minimized = false; 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); -}