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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章