Skip to content

Commit

Permalink
[win32] The Win10 method for ListViews seems to actually be for "Dark…
Browse files Browse the repository at this point in the history
… Mode" only, at least on 1809.

FIXME: May be different on 21H2. Check again, then determine exactly
which version changed it.
  • Loading branch information
GerbilSoft committed Nov 12, 2023
1 parent 4cf4003 commit 03ab4d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
13 changes: 5 additions & 8 deletions src/win32/config/AchievementsTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ class AchievementsTabPrivate
// Dark Mode background brush
HBRUSH hbrBkgnd;
bool lastDarkModeEnabled;

// Is this Windows 10 or later?
bool isWin10;
};

/** AchievementsTabPrivate **/
Expand All @@ -119,8 +116,6 @@ AchievementsTabPrivate::AchievementsTabPrivate()
, hbrBkgnd(nullptr)
, lastDarkModeEnabled(false)
{
// Is this Windows 10 or later?
isWin10 = IsWindows10OrGreater();
}

AchievementsTabPrivate::~AchievementsTabPrivate()
Expand Down Expand Up @@ -447,8 +442,8 @@ inline int AchievementsTabPrivate::ListView_CustomDraw(NMLVCUSTOMDRAW *plvcd)
break;

const bool isOdd = !!(plvcd->nmcd.dwItemSpec % 2);
if (isWin10) { if (isOdd) {
// Windows 10 method. (Tested on 1809 and 21H2.)
if (g_darkModeEnabled) { if (isOdd) {
// Windows 10 Dark Mode method. (Tested on 1809 and 21H2.)
// TODO: Check Windows 8?

// NOTE: We need to draw the background color if not highlighted or selected.
Expand Down Expand Up @@ -476,7 +471,9 @@ inline int AchievementsTabPrivate::ListView_CustomDraw(NMLVCUSTOMDRAW *plvcd)
}
}
} } else {
// Windows XP/7 method.
// Windows XP/7 method. (Also Windows 10 Light Mode.)
// FIXME: May have been changed to the Dark Mode method
// in 21H2, or sometime after 1809.

// Set the row background color.
// TODO: "Disabled" state?
Expand Down
12 changes: 5 additions & 7 deletions src/win32/config/KeyManagerTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ class KeyManagerTabPrivate
bool bAllowKanji; // Allow kanji in the editor.

bool isComCtl32_v610; // Is this COMCTL32.dll v6.10 or later?
bool isWin10; // Is this Windows 10 or later?

// Icons for the "Valid?" column.
// NOTE: "?" and "X" are copies from User32.
Expand Down Expand Up @@ -280,9 +279,6 @@ KeyManagerTabPrivate::KeyManagerTabPrivate()
{
// Check the COMCTL32.DLL version.
isComCtl32_v610 = LibWin32UI::isComCtl32_v610();

// Is this Windows 10 or later?
isWin10 = IsWindows10OrGreater();
}

KeyManagerTabPrivate::~KeyManagerTabPrivate()
Expand Down Expand Up @@ -1430,8 +1426,8 @@ inline int KeyManagerTabPrivate::ListView_CustomDraw(NMLVCUSTOMDRAW *plvcd)
// Custom drawing this subitem.
result = CDRF_SKIPDEFAULT;

if (isWin10) {
// Windows 10 method. (Tested on 1809 and 21H2.)
if (g_darkModeEnabled) {
// Windows 10 Dark Mode method. (Tested on 1809 and 21H2.)
// TODO: Check Windows 8?

// Alternate row color, if necessary.
Expand All @@ -1444,7 +1440,9 @@ inline int KeyManagerTabPrivate::ListView_CustomDraw(NMLVCUSTOMDRAW *plvcd)
FillRect(plvcd->nmcd.hdc, pRcSubItem, hbrAltRow);
}
} else {
// Windows XP/7 method.
// Windows XP/7 method. (Also Windows 10 Light Mode.)
// FIXME: May have been changed to the Dark Mode method
// in 21H2, or sometime after 1809.

// Set the row background color.
// TODO: "Disabled" state?
Expand Down

0 comments on commit 03ab4d4

Please sign in to comment.