deepin20.9启动器修改大圆角为小圆角

获取源代码:

apt source dde-launcher

修改代码:

vim src/windowedframe.cpp,623行

case TopRight:
    path.moveTo(topLeft.x(), topLeft.y());
    path.lineTo(topRight.x() - m_radius, topRight.y());
    //path.arcTo(topRight.x() - m_radius * 2, topRight.y(), m_radius * 2, m_radius * 2, 90, -90);
    path.arcTo(topRight.x() - m_radius * 2, topRight.y(), m_radius * 2, m_radius * 2, 45, -45); //liwl,变成30度
    path.lineTo(bottomRight.x(), bottomRight.y());
    path.lineTo(bottomLeft.x(), bottomLeft.y());
    break;
void WindowedFrame::onWMCompositeChanged()
{
    if (m_wmHelper->hasComposite())
        m_radius = 8; //liwl,2024/04/06, 18 -> 8
    else 
        m_radius = 0; 

    initAnchoredCornor();
    m_cornerPath = getCornerPath(m_anchoredCornor);
    m_windowHandle.setClipPath(m_cornerPath);
}

vim src/delegate/appitemdelegate.cpp

    // 绘制选中样式
   if (is_current && !(option.features & QStyleOptionViewItem::HasDisplay)) {
        //const int radius = 18;
        const int radius = 8; //liwl,2024/04/06, 18 -> 8
        const QColor brushColor(255, 255, 255, 51);

        painter->setPen(Qt::transparent);
        painter->setBrush(brushColor);
        int drawBlueDotWidth = 0;
        if (drawBlueDot)
            drawBlueDotWidth = m_blueDotPixmap.width();

        if (iconSize.width() > (fm.width(appNameResolved) + drawBlueDotWidth)) {
            br.setX(iconRect.x() - ICONTOLETF);
            br.setWidth(iconSize.width() + ICONTOLETF * 2); 
        } else {
            int width = fm.width(appNameResolved) + drawBlueDotWidth + TEXTTOLEFT * 2;
            if (width < br.width()) {
                br.setX(br.x() + (br.width() - width) / 2); 
                br.setWidth(width);
            }   
        }   

        painter->drawRoundedRect(br, radius, radius);
    }

编译安装

mkdir build
cd build
cmake ..
make ..
sudo make install
pkill -f dde-launcher
pkill -f /usr/bin/dde-launcher
sudo cp /usr/local/bin/dde-launcher /usr/bin/dde-launcher
posted @ 2024-05-14 09:54  liwldev  阅读(16)  评论(0编辑  收藏  举报