@ -957,10 +957,11 @@ float get_ticker_limited_pos(float pos, float tw, float& left_limit, float& righ
}
# ifdef HAVE_DBUS
void render_mpris_metadata ( swapchain_stats & data , const ImVec4 & color , metadata & meta , uint64_t frame_timing , bool is_main )
static void render_mpris_metadata ( struct overlay_params & params , metadata & meta , uint64_t frame_timing , bool is_main )
{
scoped_lock lk ( meta . mutex ) ;
if ( meta . valid ) {
auto color = ImGui : : ColorConvertU32ToFloat4 ( params . media_player_color ) ;
ImGui : : PushStyleVar ( ImGuiStyleVar_ItemSpacing , ImVec2 ( 8 , 0 ) ) ;
ImGui : : Dummy ( ImVec2 ( 0.0f , 20.0f ) ) ;
//ImGui::PushFont(data.font1);
@ -989,18 +990,34 @@ void render_mpris_metadata(swapchain_stats& data, const ImVec4& color, metadata&
meta . ticker . pos - = .5f * ( frame_timing / 16666.7f ) * meta . ticker . dir ;
new_pos = get_ticker_limited_pos ( meta . ticker . pos , meta . ticker . tw0 , left_limit , right_limit ) ;
ImGui : : SetCursorPosX ( new_pos ) ;
ImGui : : TextColored ( color , " %s " , meta . title . c_str ( ) ) ;
new_pos = get_ticker_limited_pos ( meta . ticker . pos , meta . ticker . tw1 , left_limit , right_limit ) ;
ImGui : : SetCursorPosX ( new_pos ) ;
ImGui : : TextColored ( color , " %s " , meta . artists . c_str ( ) ) ;
//ImGui::NewLine();
if ( ! meta . album . empty ( ) ) {
new_pos = get_ticker_limited_pos ( meta . ticker . pos , meta . ticker . tw2 , left_limit , right_limit ) ;
ImGui : : SetCursorPosX ( new_pos ) ;
ImGui : : TextColored ( color , " %s " , meta . album . c_str ( ) ) ;
for ( auto order : params . media_player_order ) {
switch ( order ) {
case MP_ORDER_TITLE :
{
new_pos = get_ticker_limited_pos ( meta . ticker . pos , meta . ticker . tw0 , left_limit , right_limit ) ;
ImGui : : SetCursorPosX ( new_pos ) ;
ImGui : : TextColored ( color , " %s " , meta . title . c_str ( ) ) ;
}
break ;
case MP_ORDER_ARTIST :
{
new_pos = get_ticker_limited_pos ( meta . ticker . pos , meta . ticker . tw1 , left_limit , right_limit ) ;
ImGui : : SetCursorPosX ( new_pos ) ;
ImGui : : TextColored ( color , " %s " , meta . artists . c_str ( ) ) ;
}
break ;
case MP_ORDER_ALBUM :
{
//ImGui::NewLine();
if ( ! meta . album . empty ( ) ) {
new_pos = get_ticker_limited_pos ( meta . ticker . pos , meta . ticker . tw2 , left_limit , right_limit ) ;
ImGui : : SetCursorPosX ( new_pos ) ;
ImGui : : TextColored ( color , " %s " , meta . album . c_str ( ) ) ;
}
}
break ;
default : break ;
}
}
if ( is_main & & main_metadata . valid & & ! main_metadata . playing ) {
@ -1355,9 +1372,8 @@ void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2&
ImFont scaled_font ;
scale_default_font ( scaled_font , params . font_scale_media_player ) ;
ImGui : : PushFont ( & scaled_font ) ;
auto media_color = ImGui : : ColorConvertU32ToFloat4 ( params . media_player_color ) ;
render_mpris_metadata ( data , media_color , main_metadata , frame_timing , true ) ;
render_mpris_metadata ( data , media_color , generic_mpris , frame_timing , false ) ;
render_mpris_metadata ( params , main_metadata , frame_timing , true ) ;
render_mpris_metadata ( params , generic_mpris , frame_timing , false ) ;
ImGui : : PopFont ( ) ;
# endif