]> git.mdlowis.com Git - proto/labwc.git/commitdiff
refactor: add LAB_BS_DEFAULT in lab_button_state
authortokyo4j <hrak1529@gmail.com>
Mon, 13 Jan 2025 15:04:15 +0000 (00:04 +0900)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Fri, 24 Jan 2025 22:27:21 +0000 (07:27 +0900)
include/theme.h
src/ssd/ssd-part.c
src/ssd/ssd-titlebar.c
src/theme.c

index c6893ea23f8e35b8573ec74a9f74a3b8185e00e7..c2c7e8be0e07929bbda63f5a23158c2d8b4019cb 100644 (file)
@@ -29,6 +29,8 @@ struct theme_snapping_overlay {
 };
 
 enum lab_button_state {
+       LAB_BS_DEFAULT = 0,
+
        LAB_BS_HOVERD = 1 << 0,
        LAB_BS_TOGGLED = 1 << 1,
        LAB_BS_ROUNDED = 1 << 2,
index fba803e311dfd6968803cab47d15e8dde2a9e438..b9c09c3e2051af66d1441c996fd99a33304b9aa4 100644 (file)
@@ -100,7 +100,8 @@ add_scene_button(struct wl_list *part_list, enum ssd_part_type type,
 
        /* Icons */
        struct wlr_scene_node *nodes[LAB_BS_ALL + 1] = {0};
-       for (uint8_t state_set = 0; state_set <= LAB_BS_ALL; state_set++) {
+       for (uint8_t state_set = LAB_BS_DEFAULT;
+                       state_set <= LAB_BS_ALL; state_set++) {
                if (!imgs[state_set]) {
                        continue;
                }
index 60c22b455c3614749bc6a4dcd619a4d90074b237..9eccc3ae68256fec75aaa71acd88cd66f7e5d00f 100644 (file)
@@ -127,7 +127,8 @@ update_button_state(struct ssd_button *button, enum lab_button_state state,
                button->state_set &= ~state;
        }
        /* Switch the displayed icon buffer to the new one */
-       for (uint8_t state_set = 0; state_set <= LAB_BS_ALL; state_set++) {
+       for (uint8_t state_set = LAB_BS_DEFAULT;
+                       state_set <= LAB_BS_ALL; state_set++) {
                if (!button->nodes[state_set]) {
                        continue;
                }
@@ -626,7 +627,8 @@ ssd_update_window_icon(struct ssd *ssd)
 
                /* Replace all the buffers in the button with the window icon */
                struct ssd_button *button = node_ssd_button_from_node(part->node);
-               for (uint8_t state_set = 0; state_set <= LAB_BS_ALL; state_set++) {
+               for (uint8_t state_set = LAB_BS_DEFAULT;
+                               state_set <= LAB_BS_ALL; state_set++) {
                        struct wlr_scene_node *node = button->nodes[state_set];
                        if (node) {
                                struct scaled_img_buffer *img_buffer =
index b0ebdf5fd748433312cab6a6189a0008e896fa9b..cb7809a71e543dfa95c20bf5186fdc7d534c50e0 100644 (file)
@@ -1531,8 +1531,8 @@ theme_finish(struct theme *theme)
 {
        for (enum ssd_part_type type = LAB_SSD_BUTTON_FIRST;
                        type <= LAB_SSD_BUTTON_LAST; type++) {
-               for (uint8_t state_set = 0; state_set <= LAB_BS_ALL;
-                               state_set++) {
+               for (uint8_t state_set = LAB_BS_DEFAULT;
+                               state_set <= LAB_BS_ALL; state_set++) {
                        destroy_img(&theme->window[THEME_INACTIVE]
                                .button_imgs[type][state_set]);
                        destroy_img(&theme->window[THEME_ACTIVE]