summaryrefslogtreecommitdiff
path: root/src/modules/options/headerbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/options/headerbar.cpp')
-rw-r--r--src/modules/options/headerbar.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/modules/options/headerbar.cpp b/src/modules/options/headerbar.cpp
index 5db6a627fc..a94c196567 100644
--- a/src/modules/options/headerbar.cpp
+++ b/src/modules/options/headerbar.cpp
@@ -112,13 +112,11 @@ static void MHeaderbar_FillRect(HDC hdc, int x, int y, int width, int height, CO
static void MHeaderbar_DrawGradient(HDC hdc, int x, int y, int width, int height, RGBQUAD *rgb0, RGBQUAD *rgb1)
{
- int i;
-
int oldMode = SetBkMode(hdc, OPAQUE);
COLORREF oldColor = SetBkColor(hdc, 0);
RECT rc; SetRect(&rc, x, 0, x+width, 0);
- for (i = y+height; --i >= y;)
+ for (int i = y+height; --i >= y;)
{
COLORREF color = RGB(
((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height,
@@ -193,7 +191,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit, UINT msg,
LOGFONT lf;
GetObject(hFont, sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
- HFONT hFntBold = CreateFontIndirect(&lf);
+ HFONT hFntBold = CreateFontIndirect(&lf), hOldFont;
if (mit->hIcon)
DrawIcon(tempDC, 10, iTopSpace, mit->hIcon);
@@ -218,7 +216,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit, UINT msg,
HANDLE hTheme = openThemeData(hwndDlg, L"Window");
textRect.left = 50;
- SelectObject(tempDC, hFntBold);
+ hOldFont = (HFONT)SelectObject(tempDC, hFntBold);
wchar_t *szTitleW = mir_t2u(szTitle);
drawThemeTextEx(hTheme, tempDC, WP_CAPTION, CS_ACTIVE, szTitleW, -1, DT_TOP|DT_LEFT|DT_SINGLELINE|DT_NOPREFIX|DT_NOCLIP|DT_END_ELLIPSIS, &textRect, &dto);
@@ -236,7 +234,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit, UINT msg,
}
else {
textRect.left = 50;
- SelectObject(tempDC, hFntBold);
+ hOldFont = (HFONT)SelectObject(tempDC, hFntBold);
DrawText(tempDC, szTitle, -1, &textRect, DT_TOP|DT_LEFT|DT_SINGLELINE|DT_NOPREFIX|DT_NOCLIP|DT_END_ELLIPSIS);
if (szSubTitle) {
@@ -277,6 +275,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit, UINT msg,
SelectObject(tempDC, hOldBmp);
DeleteObject(hBmp);
+ SelectObject(tempDC,hOldFont);
DeleteDC(tempDC);
EndPaint(hwndDlg, &ps);