]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Move is_button() into src/ssd.c and make it public
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sat, 29 Jan 2022 16:46:17 +0000 (17:46 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 30 Jan 2022 21:23:15 +0000 (21:23 +0000)
include/ssd.h
src/output.c
src/ssd.c

index e61ad67612130b7cf6ff4c5c325d91461227d7d7..bffa65647be6bc40b2e0e9c7662b81a8bc6df26c 100644 (file)
@@ -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 */
index 4c98c380484cec1fb8b23d148367c6463530846f..437cb5c287f2f7a2331b58849f981cc486ae9087 100644 (file)
@@ -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);
index f4f36083e1bec47c418f6058b9532a05017b1f0a..0897fdaf7cc743967a4fba21e4bf253bbd259c0a 100644 (file)
--- 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)
 {