From 1413f296ae1afb786a2a5b38edcf10f3123f59b4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 23 Apr 2017 16:45:03 +0200 Subject: [PATCH] CComponentsHeader: add fallback if title and logo are overlapping Logo is now general centered on screen, not as before between title and clock --- src/gui/components/cc_frm_header.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index f053e94ec..9fef1dfba 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -307,8 +307,15 @@ void CComponentsHeader::initLogo() x_logo = x_logo_right; if (cch_logo.Align == CC_LOGO_LEFT) x_logo = x_logo_left; - if (cch_logo.Align == CC_LOGO_CENTER) - x_logo = x_logo_left + logo_space/2 - cch_logo_obj->getWidth()/2; + if (cch_logo.Align == CC_LOGO_CENTER){ + x_logo = width/2 - cch_logo_obj->getWidth()/2; + //fallback if previous item and logo are overlapping + if (getCCItem(prev_id)){ + int x_tmp = x_logo_left + logo_space/2 - cch_logo_obj->getWidth()/2; + if (x_logo <= x_logo_left) + x_logo = x_tmp; + } + } cch_logo_obj->setXPos(x_logo); cch_logo_obj->setYPos(height/2 - cch_logo_obj->getHeight()/2);