mirror of
https://github.com/labwc/labwc.git
synced 2026-03-07 04:33:54 -05:00
Move is_button() into src/ssd.c and make it public
This commit is contained in:
parent
e2cca1f040
commit
7ecae4afce
3 changed files with 11 additions and 10 deletions
|
|
@ -69,5 +69,6 @@ void ssd_create(struct view *view);
|
||||||
void ssd_destroy(struct view *view);
|
void ssd_destroy(struct view *view);
|
||||||
void ssd_update_geometry(struct view *view, bool force);
|
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_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 */
|
#endif /* __LABWC_SSD_H */
|
||||||
|
|
|
||||||
11
src/output.c
11
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
|
static void
|
||||||
render_deco(struct view *view, struct output *output,
|
render_deco(struct view *view, struct output *output,
|
||||||
pixman_region32_t *output_damage)
|
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;
|
struct wlr_cursor *cur = view->server->seat.cursor;
|
||||||
enum ssd_part_type type = ssd_at(view, cur->x, cur->y);
|
enum ssd_part_type type = ssd_at(view, cur->x, cur->y);
|
||||||
struct wlr_box box = ssd_visible_box(view, type);
|
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)) {
|
wlr_box_contains_point(&box, cur->x, cur->y)) {
|
||||||
float *color = (float[4]) { 0.5, 0.5, 0.5, 0.5 };
|
float *color = (float[4]) { 0.5, 0.5, 0.5, 0.5 };
|
||||||
render_rect(output, output_damage, &box, color);
|
render_rect(output, output_damage, &box, color);
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,15 @@ justify_right(struct view *view, struct wlr_box *box,
|
||||||
box->x = view->x + (box->width - texture->width);
|
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
|
struct wlr_box
|
||||||
ssd_visible_box(struct view *view, enum ssd_part_type type)
|
ssd_visible_box(struct view *view, enum ssd_part_type type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue