mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
refactor: add LAB_BS_DEFAULT in lab_button_state
This commit is contained in:
parent
36d6e9ef75
commit
bffdccf8dc
4 changed files with 10 additions and 5 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue