@@ -114,9 +114,46 @@ int render(struct mako_state *state, struct pool_buffer *buffer) {
114
114
notif -> hotspot .width = notif_width ;
115
115
notif -> hotspot .height = notif_height ;
116
116
117
- g_object_unref (layout );
118
-
119
117
++ i ;
118
+ if (i == (size_t )config -> max_visible &&
119
+ i < (size_t )wl_list_length (& state -> notifications ) ) {
120
+
121
+ int hidden = wl_list_length (& state -> notifications ) - i ;
122
+ int hidden_ln = snprintf (NULL , 0 , "[%d]" , hidden );
123
+
124
+ char * hidden_text ;
125
+ hidden_text = malloc (hidden_ln + 1 );
126
+ snprintf (hidden_text , hidden_ln + 1 , "[%d]" , hidden );
127
+
128
+ pango_layout_set_text (layout , hidden_text , -1 );
129
+
130
+ int hidden_width = 0 , hidden_height = 0 ;
131
+ pango_layout_get_pixel_size (layout , & hidden_width , & hidden_height );
132
+
133
+ int hidden_y = height + border_size ;
134
+ height += hidden_height ;
135
+
136
+ //Set cairo path to our "hidden" draw area and clear
137
+ cairo_rectangle (cairo , 0 , hidden_y , notif_width , hidden_height + border_size );
138
+ cairo_set_operator (cairo , CAIRO_OPERATOR_CLEAR );
139
+ set_cairo_source_u32 (cairo , 0xFFFFFFFF );
140
+ cairo_fill (cairo );
141
+
142
+ cairo_set_operator (cairo , CAIRO_OPERATOR_OVER );
143
+ set_cairo_source_u32 (cairo , config -> colors .text );
144
+
145
+ //Right align the text. Maybe we can do count alignment as a config option?
146
+ cairo_move_to (cairo , notif_width - border_size - hidden_width ,
147
+ hidden_y );
148
+
149
+ //Draw current hidden count
150
+ pango_cairo_update_layout (cairo , layout );
151
+ pango_cairo_show_layout (cairo , layout );
152
+
153
+ free (hidden_text );
154
+ }
155
+
156
+ g_object_unref (layout );
120
157
if (config -> max_visible >= 0 &&
121
158
i >= (size_t )config -> max_visible ) {
122
159
break ;
0 commit comments