Skip to content

Commit 087c066

Browse files
committed
Update main window tab control font, Allow changing main window tab font
1 parent 07b71cd commit 087c066

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

ProcessHacker/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,7 @@ VOID PhInitializeFont(
551551
)
552552
{
553553
NONCLIENTMETRICS metrics = { sizeof(metrics) };
554-
555-
if (PhApplicationFont)
556-
DeleteObject(PhApplicationFont);
554+
HFONT oldFont = PhApplicationFont;
557555

558556
if (
559557
!(PhApplicationFont = PhCreateFont(L"Microsoft Sans Serif", 8, FW_NORMAL)) &&
@@ -565,6 +563,8 @@ VOID PhInitializeFont(
565563
else
566564
PhApplicationFont = NULL;
567565
}
566+
567+
if (oldFont) DeleteFont(oldFont);
568568
}
569569

570570
BOOLEAN PhInitializeDirectoryPolicy(

ProcessHacker/mainwnd.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,10 @@ VOID PhMwpOnSettingChange(
577577
{
578578
PhInitializeFont();
579579

580-
if (TabControlHandle)
581-
{
582-
SetWindowFont(TabControlHandle, PhApplicationFont, TRUE);
583-
}
580+
//if (TabControlHandle)
581+
//{
582+
// SetWindowFont(TabControlHandle, PhApplicationFont, TRUE);
583+
//}
584584
}
585585

586586
static NTSTATUS PhpOpenServiceControlManager(
@@ -3564,6 +3564,7 @@ VOID PhMwpInvokeUpdateWindowFont(
35643564
_In_ PVOID Parameter
35653565
)
35663566
{
3567+
HFONT oldFont = PhTreeWindowFont;
35673568
PPH_STRING fontHexString;
35683569
LOGFONT font;
35693570

@@ -3576,19 +3577,17 @@ VOID PhMwpInvokeUpdateWindowFont(
35763577
{
35773578
HFONT newFont;
35783579

3579-
newFont = CreateFontIndirect(&font);
3580-
3581-
if (newFont)
3582-
{
3583-
if (PhTreeWindowFont)
3584-
DeleteFont(PhTreeWindowFont);
3580+
if (newFont = CreateFontIndirect(&font))
3581+
{
35853582
PhTreeWindowFont = newFont;
3586-
3587-
PhMwpNotifyAllPages(MainTabPageFontChanged, newFont, NULL);
3583+
PhMwpNotifyAllPages(MainTabPageFontChanged, newFont, NULL);
35883584
}
35893585
}
35903586

3587+
SetWindowFont(TabControlHandle, PhTreeWindowFont, TRUE);
35913588
SendMessage(PhMainWndHandle, WM_PH_UPDATE_FONT, 0, 0);
3589+
3590+
if (oldFont) DeleteFont(oldFont);
35923591
}
35933592

35943593
VOID PhMwpInvokePrepareEarlyExit(

0 commit comments

Comments
 (0)