PIME icon indicating copy to clipboard operation
PIME copied to clipboard

希望增加選字底色的設定

Open dreamfliper opened this issue 1 year ago • 3 comments

希望候選字可以增加暗色(Dark mode)模式更符合 windows 11 暗色主題 有在 CandidateWindow.cpp 看到 isImmersive_,但他好像在 windows 8 才會有效果

dreamfliper avatar Dec 13 '23 03:12 dreamfliper

找到修改的地方了,他在 libIME2 底下的 CandidateWindow.cpp 目前只能 hard code

void CandidateWindow::onPaint(WPARAM wp, LPARAM lp) {
    // TODO: check isImmersive_, and draw the window differently
    // in Windows 8 app immersive mode to follow windows 8 UX guidelines
    PAINTSTRUCT ps;
    BeginPaint(hwnd_, &ps);
    HDC hDC = ps.hdc;
    HFONT oldFont;
    RECT rc;

    oldFont = (HFONT)SelectObject(hDC, font_);
    // paint window background and border
    // draw a flat black border in Windows 8 app immersive mode
    // draw a 3d border in desktop mode
    GetClientRect(hwnd_,&rc);
    SetTextColor(hDC, RGB(200, 200, 200));
    SetBkColor(hDC, RGB(12, 45, 66));

    // paint window background and border
    // draw a flat black border in Windows 8 app immersive mode
    // draw a 3d border in desktop mode
    HPEN pen = ::CreatePen(PS_SOLID, 5, RGB(100, 100, 100));
    HGDIOBJ oldPen = ::SelectObject(hDC, pen);
    ::Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
    ::SelectObject(hDC, oldPen);
    ::DeleteObject(pen);
    // draw a 3d border in desktop mode
    ::FillSolidRect(ps.hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, RGB(12, 45, 66));
    ::Draw3DBorder(hDC, &rc, RGB(12, 45, 66), 0);

    // paint items
    int col = 0;
    int x = margin_, y = margin_;
    for(int i = 0, n = items_.size(); i < n; ++i) {
        paintItem(hDC, i, x, y);
        ++col; // go to next column
        if(col >= candPerRow_) {
            col = 0;
            x = margin_;
            y += itemHeight_ + rowSpacing_;
        }
        else {
            x += colSpacing_ + selKeyWidth_ + textWidth_;
        }
    }
    SelectObject(hDC, oldFont);
    EndPaint(hwnd_, &ps);
}

dreamfliper avatar Dec 13 '23 10:12 dreamfliper

https://drive.google.com/file/d/1uD4lnHELUpwmfCz8Mx7IO9_PALQ9kLtP/view?usp=drive_link

dreamfliper avatar Dec 13 '23 11:12 dreamfliper

我按照你的方法改了,重新編譯并且替換PIMETextService.dll,還是老樣子啊

算了windows api我不熟悉

nursery01 avatar Feb 01 '24 14:02 nursery01