@@ -220,8 +220,8 @@ void gfx_widgets_msg_queue_push(
220220 else if (category == MESSAGE_QUEUE_CATEGORY_SUCCESS )
221221 msg_widget -> flags |= DISPWIDG_FLAG_CATEGORY_SUCCESS ;
222222
223- if ( prio > 1 && category != MESSAGE_QUEUE_CATEGORY_ERROR )
224- msg_widget -> flags |= DISPWIDG_FLAG_SMALL ;
223+ /* Default to small single line size and grow when necessary */
224+ msg_widget -> flags |= DISPWIDG_FLAG_SMALL ;
225225
226226 if (task )
227227 {
@@ -262,11 +262,9 @@ void gfx_widgets_msg_queue_push(
262262 /* Compute rect width, wrap if necessary */
263263 /* Single line text > two lines text > two lines
264264 * text with expanded width */
265- char * msg = NULL ;
265+ char * msg_new = NULL ;
266266 size_t msg_len = 0 ;
267- unsigned width = menu_is_alive
268- ? p_dispwidget -> msg_queue_default_rect_width_menu_alive
269- : p_dispwidget -> msg_queue_default_rect_width ;
267+ unsigned width = p_dispwidget -> msg_queue_default_rect_width ;
270268 unsigned text_width = font_driver_get_message_width (
271269 p_dispwidget -> gfx_widget_fonts .msg_queue .font ,
272270 title ,
@@ -275,9 +273,9 @@ void gfx_widgets_msg_queue_push(
275273 msg_widget -> text_height = p_dispwidget -> gfx_widget_fonts .msg_queue .line_height ;
276274 /* 1 byte uses for inserting '\n' */
277275 msg_len = len + 1 + 1 ;
278- if (!(msg = (char * )malloc (msg_len )))
276+ if (!(msg_new = (char * )malloc (msg_len )))
279277 return ;
280- msg [0 ] = '\0' ;
278+ msg_new [0 ] = '\0' ;
281279
282280 /* Text is too wide, split it into two lines */
283281 if (text_width > width )
@@ -290,7 +288,7 @@ void gfx_widgets_msg_queue_push(
290288 if ((text_width - (text_width >> 2 )) < width )
291289 width = text_width - (text_width >> 2 );
292290
293- word_wrap (msg , msg_len , title , len ,
291+ word_wrap (msg_new , msg_len , title , len ,
294292 (int )((len * width ) / text_width ),
295293 100 , 2 );
296294
@@ -311,16 +309,27 @@ void gfx_widgets_msg_queue_push(
311309 }
312310
313311 msg_widget -> text_height *= 2 ;
314- msg_widget -> msg_len = strlen (msg );
312+ msg_widget -> msg_len = strlen (msg_new );
315313 }
316314 else
317315 {
318316 width = text_width ;
319- msg_widget -> msg_len = strlcpy (msg , title , msg_len );
317+ msg_widget -> msg_len = strlcpy (msg_new , title , msg_len );
320318 }
321319
322- msg_widget -> msg = msg ;
320+ msg_widget -> msg = strdup ( msg_new ) ;
323321 msg_widget -> width = width + (p_dispwidget -> simple_widget_padding / 2 );
322+
323+ free (msg_new );
324+ msg_new = NULL ;
325+ }
326+
327+ /* Use big size only when needed */
328+ if (strstr (msg_widget -> msg , "\n" ))
329+ {
330+ msg_widget -> flags &= ~DISPWIDG_FLAG_SMALL ;
331+ if (msg_widget -> text_height == p_dispwidget -> gfx_widget_fonts .msg_queue .line_height )
332+ msg_widget -> text_height *= 2 ;
324333 }
325334
326335 fifo_write (& p_dispwidget -> msg_queue ,
@@ -365,7 +374,7 @@ void gfx_widgets_msg_queue_push(
365374
366375 entry .easing_enum = EASING_OUT_QUAD ;
367376 entry .tag = (uintptr_t )msg_widget ;
368- entry .duration = MSG_QUEUE_ANIMATION_DURATION * 2 ;
377+ entry .duration = MSG_QUEUE_ANIMATION_DURATION * 2 ;
369378 entry .target_value = p_dispwidget -> msg_queue_height / 2.0f ;
370379 entry .subject = & msg_widget -> msg_transition_animation ;
371380 entry .cb = msg_widget_msg_transition_animation_done ;
@@ -851,10 +860,10 @@ static void gfx_widgets_layout(
851860 p_dispwidget -> simple_widget_padding = p_dispwidget -> gfx_widget_fonts .regular .line_height * (2.0f / 3.0f ) + 0.5f ;
852861 p_dispwidget -> simple_widget_height = p_dispwidget -> gfx_widget_fonts .regular .line_height + p_dispwidget -> simple_widget_padding ;
853862
854- p_dispwidget -> msg_queue_height = p_dispwidget -> gfx_widget_fonts .msg_queue .line_height * 2.5f * (BASE_FONT_SIZE / MSG_QUEUE_FONT_SIZE );
863+ p_dispwidget -> msg_queue_height = p_dispwidget -> gfx_widget_fonts .msg_queue .line_height * 2.4f * (BASE_FONT_SIZE / MSG_QUEUE_FONT_SIZE );
855864 p_dispwidget -> msg_queue_padding = (unsigned )(((float )p_dispwidget -> gfx_widget_fonts .msg_queue .line_height * (2.0f / 3.0f )) + 0.5f );
856865 p_dispwidget -> msg_queue_spacing = p_dispwidget -> msg_queue_height / 4.0f ;
857- p_dispwidget -> msg_queue_rect_start_x = ceil (( p_dispwidget -> msg_queue_padding * 2.0f ) - (p_dispwidget -> simple_widget_padding * 0.15f ));
866+ p_dispwidget -> msg_queue_rect_start_x = ceil (p_dispwidget -> msg_queue_padding - (p_dispwidget -> simple_widget_padding * 0.10f ));
858867
859868 if (p_dispwidget -> flags & DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS )
860869 p_dispwidget -> msg_queue_regular_padding_x = p_dispwidget -> simple_widget_padding / 2 ;
@@ -883,8 +892,6 @@ static void gfx_widgets_layout(
883892 if (!p_dispwidget -> gfx_widgets_icons_textures [MENU_WIDGETS_ICON_HOURGLASS ])
884893 p_dispwidget -> msg_queue_task_text_start_x -= p_dispwidget -> gfx_widget_fonts .msg_queue .glyph_width * 2.0f ;
885894
886- p_dispwidget -> msg_queue_default_rect_width_menu_alive
887- = p_dispwidget -> gfx_widget_fonts .msg_queue .glyph_width * 40.0f ;
888895 p_dispwidget -> msg_queue_default_rect_width = p_dispwidget -> last_video_width
889896 - p_dispwidget -> msg_queue_regular_text_start - (2 * p_dispwidget -> simple_widget_padding );
890897
@@ -1137,7 +1144,7 @@ static int gfx_widgets_draw_indicator(
11371144
11381145static void gfx_widgets_draw_task_msg (
11391146 dispgfx_widget_t * p_dispwidget ,
1140- gfx_display_t * p_disp ,
1147+ gfx_display_t * p_disp ,
11411148 gfx_display_ctx_driver_t * dispctx ,
11421149 disp_widget_msg_t * msg ,
11431150 void * userdata ,
@@ -1303,7 +1310,7 @@ static void gfx_widgets_draw_task_msg(
13031310 msg_queue_height / 2.5f ,
13041311 msg_queue_height / 2.5f ,
13051312 p_dispwidget -> gfx_widgets_icons_textures [texture ],
1306- rect_x + (msg_queue_height / 9 .0f ) + (msg_queue_height / MSG_QUEUE_FONT_SIZE ),
1313+ rect_x + (msg_queue_height / 12 .0f ) + (msg_queue_height / MSG_QUEUE_FONT_SIZE ),
13071314 rect_y + (msg_queue_height / MSG_QUEUE_FONT_SIZE ),
13081315 radians ,
13091316 cosine ,
@@ -1315,7 +1322,7 @@ static void gfx_widgets_draw_task_msg(
13151322
13161323 /* Text */
13171324 text_y_base = rect_y
1318- + (msg_queue_height / 4.0f )
1325+ + (msg_queue_height / 4.25f )
13191326 + p_dispwidget -> gfx_widget_fonts .msg_queue .line_centre_offset ;
13201327
13211328 if (draw_msg_new )
@@ -1360,7 +1367,7 @@ static void gfx_widgets_draw_task_msg(
13601367 text_color = COLOR_TEXT_ALPHA (TEXT_COLOR_INFO , (unsigned )(msg -> alpha /2 * 255.0f ));
13611368 gfx_widgets_draw_text (& p_dispwidget -> gfx_widget_fonts .msg_queue ,
13621369 task_percentage ,
1363- rect_x + rect_width - p_dispwidget -> gfx_widget_fonts .msg_queue .glyph_width * 2 ,
1370+ rect_x + rect_width - p_dispwidget -> gfx_widget_fonts .msg_queue .glyph_width * 3 ,
13641371 text_y_base ,
13651372 video_width , video_height ,
13661373 text_color ,
@@ -1474,7 +1481,7 @@ static void gfx_widgets_draw_regular_msg(
14741481 if (msg -> flags & DISPWIDG_FLAG_SMALL )
14751482 text_y_base = video_height
14761483 - msg -> offset_y
1477- + p_dispwidget -> msg_queue_height / 4.0f
1484+ + p_dispwidget -> msg_queue_height / 4.25f
14781485 + p_dispwidget -> gfx_widget_fonts .msg_queue .line_centre_offset ;
14791486 else
14801487 text_y_base = video_height
0 commit comments