@@ -321,12 +321,15 @@ static int render_notification(cairo_t *cairo, struct mako_state *state, struct
321
321
return notif_height ;
322
322
}
323
323
324
- int render (struct mako_surface * surface , struct pool_buffer * buffer , int scale ) {
324
+ void render (struct mako_surface * surface , struct pool_buffer * buffer , int scale ,
325
+ int * rendered_width , int * rendered_height ) {
325
326
struct mako_state * state = surface -> state ;
326
327
cairo_t * cairo = buffer -> cairo ;
327
328
329
+ * rendered_width = * rendered_height = 0 ;
330
+
328
331
if (wl_list_empty (& state -> notifications )) {
329
- return 0 ;
332
+ return ;
330
333
}
331
334
332
335
// Clear
@@ -339,6 +342,7 @@ int render(struct mako_surface *surface, struct pool_buffer *buffer, int scale)
339
342
size_t visible_count = 0 ;
340
343
size_t hidden_count = 0 ;
341
344
int total_height = 0 ;
345
+ int max_width = 0 ;
342
346
int pending_bottom_margin = 0 ;
343
347
struct mako_notification * notif ;
344
348
size_t total_notifications = 0 ;
@@ -401,7 +405,13 @@ int render(struct mako_surface *surface, struct pool_buffer *buffer, int scale)
401
405
& notif -> hotspot , notif -> progress );
402
406
free (text );
403
407
408
+ int notif_width =
409
+ style -> width + style -> margin .left + style -> margin .right ;
410
+
404
411
total_height += notif_height ;
412
+ if (max_width < notif_width ) {
413
+ max_width = notif_width ;
414
+ }
405
415
pending_bottom_margin = style -> margin .bottom ;
406
416
407
417
if (notif -> group_index < 1 ) {
@@ -411,7 +421,6 @@ int render(struct mako_surface *surface, struct pool_buffer *buffer, int scale)
411
421
// single entity for this purpose.
412
422
++ visible_count ;
413
423
}
414
-
415
424
}
416
425
417
426
if (hidden_count > 0 ) {
@@ -438,7 +447,7 @@ int render(struct mako_surface *surface, struct pool_buffer *buffer, int scale)
438
447
char * text = malloc (text_ln + 1 );
439
448
if (text == NULL ) {
440
449
fprintf (stderr , "allocation failed" );
441
- return 0 ;
450
+ return ;
442
451
}
443
452
444
453
format_text (style -> format , text , format_hidden_text , & data );
@@ -452,5 +461,6 @@ int render(struct mako_surface *surface, struct pool_buffer *buffer, int scale)
452
461
destroy_notification (hidden_notif );
453
462
}
454
463
455
- return total_height + pending_bottom_margin ;
464
+ * rendered_width = max_width ;
465
+ * rendered_height = total_height ;
456
466
}
0 commit comments