theme: refine the management of corner buttons

- The builtin hover effect is now unrounded when the window is tiled.
- All the corner button icons including ones provided by the user are
  now rounded when the window is not tiled.
- Fixed the bug that the window menu button as a fallback of the window
  icon is not correctly rounded.
This commit is contained in:
tokyo4j 2024-10-04 15:27:25 +09:00 committed by Johan Malm
parent c413e65a20
commit c2a3a354db
6 changed files with 417 additions and 637 deletions

View file

@ -18,12 +18,16 @@
struct ssd_button {
struct view *view;
enum ssd_part_type type;
struct wlr_scene_node *normal;
struct wlr_scene_node *hover;
struct wlr_scene_node *toggled;
struct wlr_scene_node *toggled_hover;
struct wlr_scene_tree *icon_tree;
struct wlr_scene_tree *hover_tree;
/*
* Bitmap of lab_button_state that represents a combination of
* hover/toggled/rounded states.
*/
uint8_t state_set;
/*
* Button nodes for each combination of hover/toggled/rounded states.
* nodes[state_set] should be displayed.
*/
struct wlr_scene_node *nodes[LAB_BS_ALL + 1];
struct wl_listener destroy;
};
@ -140,13 +144,10 @@ struct ssd_part *add_scene_rect(
struct ssd_part *add_scene_buffer(
struct wl_list *list, enum ssd_part_type type,
struct wlr_scene_tree *parent, struct wlr_buffer *buffer, int x, int y);
struct ssd_part *add_scene_button(
struct wl_list *part_list, enum ssd_part_type type,
struct wlr_scene_tree *parent, struct wlr_buffer *icon_buffer,
struct wlr_buffer *hover_buffer, int x, struct view *view);
void add_toggled_icon(struct ssd_button *button, struct wl_list *part_list,
enum ssd_part_type type, struct wlr_buffer *icon_buffer,
struct wlr_buffer *hover_buffer);
struct ssd_part *add_scene_button(struct wl_list *part_list,
enum ssd_part_type type, struct wlr_scene_tree *parent,
struct lab_data_buffer *buffers[LAB_BS_ALL + 1], int x,
struct view *view);
void update_window_icon_buffer(struct wlr_scene_node *button_node,
struct wlr_buffer *buffer);