Skip to content

Commit c627903

Browse files
committed
handle icon in minimum width calculation
1 parent 8145beb commit c627903

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

render.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ static int render_notification(cairo_t *cairo, struct mako_state *state, struct
104104
int notif_width =
105105
(style->width <= surface->width) ? style->width : surface->width;
106106

107-
108107
// text_x is the offset of the text inside our draw operation
109108
double text_x = style->padding.left;
110109
if (icon != NULL && style->icon_location == MAKO_ICON_LOCATION_LEFT) {
@@ -173,8 +172,15 @@ static int render_notification(cairo_t *cairo, struct mako_state *state, struct
173172
int text_height = buffer_text_height / scale;
174173
int text_width = buffer_text_width / scale;
175174

176-
notif_width = MAX(style->min_width, text_width + border_size + padding_width);
175+
int min_width = text_width + border_size + padding_width;
176+
if (icon && ! icon_vertical) {
177+
min_width += icon->width;
178+
min_width += style->icon_location == MAKO_ICON_LOCATION_LEFT ?
179+
style->padding.left : style->padding.right;
180+
}
177181

182+
notif_width = MAX(style->min_width, min_width);
183+
178184
// offset_x is for the entire draw operation inside the surface
179185
int offset_x;
180186
if (surface->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT) {

0 commit comments

Comments
 (0)