From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Sat, 29 Jan 2022 16:46:17 +0000 (+0100) Subject: Move is_button() into src/ssd.c and make it public X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=7ecae4afcec5515cf4690f60cd9002f1c2599ef3;p=proto%2Flabwc.git Move is_button() into src/ssd.c and make it public --- diff --git a/include/ssd.h b/include/ssd.h index e61ad676..bffa6564 100644 --- a/include/ssd.h +++ b/include/ssd.h @@ -69,5 +69,6 @@ void ssd_create(struct view *view); void ssd_destroy(struct view *view); void ssd_update_geometry(struct view *view, bool force); bool ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate); +bool ssd_is_button(enum ssd_part_type type); #endif /* __LABWC_SSD_H */ diff --git a/src/output.c b/src/output.c index 4c98c380..437cb5c2 100644 --- a/src/output.c +++ b/src/output.c @@ -544,15 +544,6 @@ render_osd(struct output *output, pixman_region32_t *damage, } } -static bool -isbutton(enum ssd_part_type type) -{ - return type == LAB_SSD_BUTTON_CLOSE || - type == LAB_SSD_BUTTON_MAXIMIZE || - type == LAB_SSD_BUTTON_ICONIFY || - type == LAB_SSD_BUTTON_WINDOW_MENU; -} - static void render_deco(struct view *view, struct output *output, pixman_region32_t *output_damage) @@ -585,7 +576,7 @@ render_deco(struct view *view, struct output *output, struct wlr_cursor *cur = view->server->seat.cursor; enum ssd_part_type type = ssd_at(view, cur->x, cur->y); struct wlr_box box = ssd_visible_box(view, type); - if (isbutton(type) && + if (ssd_is_button(type) && wlr_box_contains_point(&box, cur->x, cur->y)) { float *color = (float[4]) { 0.5, 0.5, 0.5, 0.5 }; render_rect(output, output_damage, &box, color); diff --git a/src/ssd.c b/src/ssd.c index f4f36083..0897fdaf 100644 --- a/src/ssd.c +++ b/src/ssd.c @@ -186,6 +186,15 @@ justify_right(struct view *view, struct wlr_box *box, box->x = view->x + (box->width - texture->width); } +bool +ssd_is_button(enum ssd_part_type type) +{ + return type == LAB_SSD_BUTTON_CLOSE || + type == LAB_SSD_BUTTON_MAXIMIZE || + type == LAB_SSD_BUTTON_ICONIFY || + type == LAB_SSD_BUTTON_WINDOW_MENU; +} + struct wlr_box ssd_visible_box(struct view *view, enum ssd_part_type type) {