Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug, fix more warnings (See commit description) #1576

Merged
merged 1 commit into from May 9, 2023

Conversation

jdpatdiscord
Copy link
Contributor

This ends my series of patches fixing warnings throughout the codebase. Now, there are NO warnings except for unused parameters, tested on GCC 13.1.1 and Clang 16.0.2 with -Wall -Wextra.

Fixed dark mode crashing on Windows 8.1, 8 and 7, and removed a need for an export by moving in the function.

Any people looking at the Windows code and asking why I didn't use official version querying API's, those typically have some sort of unwanted funny behavior (compatibility manifests, other ought-to-be nonsense), plus checking exports to determine versions is shorter.

Comment on lines 302 to 309
}
default: {
// FIXME: See if MultiSelection / ExtendedSelection need to be handled
if (selectionType != QAbstractItemView::NoSelection)
qWarning() << "Unhandled QAbstractItemView selection type!";
break;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about just breaking on ones that we know we should ignore instead of using an if statement to exclude them from the default case?

Suggested change
}
default: {
// FIXME: See if MultiSelection / ExtendedSelection need to be handled
if (selectionType != QAbstractItemView::NoSelection)
qWarning() << "Unhandled QAbstractItemView selection type!";
break;
}
}
case QAbstractItemView::NoSelection:
break;
default: {
// FIXME: See if MultiSelection / ExtendedSelection need to be handled
qWarning() << "Unhandled QAbstractItemView selection type:" << selectionType;
break;
}

Comment on lines 78 to 89
if (IsWindows8_0_Only())
WinSyscall<NtUserSetWindowCompositionAttribute_NT6_2>(hWnd, &data);
if (IsWindows8_1_Only())
WinSyscall<NtUserSetWindowCompositionAttribute_NT6_3>(hWnd, &data);
if (IsWindows10_Only() || IsWindows11())
{
((fnSetWindowCompositionAttribute)(PVOID)GetProcAddress(GetModuleHandleW(L"user32.dll"), "SetWindowCompositionAttribute"))
(hWnd, &data);
// Verified this ordinal is the same through Win11 22H2 (5/8/2023)
((fnSetPreferredAppMode)(PVOID)GetProcAddress(GetModuleHandleW(L"uxtheme.dll"), MAKEINTRESOURCEA(135)))
(AppMode_AllowDark);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are mutually exclusive wouldn't it make more sense to use else if instead of if for the subsequent checks

This ends my series of patches fixing warnings throughout the codebase. Now, there are NO warnings except for unused parameters, tested on GCC 13.1.1 and Clang 16.0.2 with -Wall -Wextra.

Fixed dark mode crashing on Windows 8.1, 8 and 7, and removed a need for an export by moving in the function.

Any people looking at the Windows code and asking why I didn't use official version querying API's, those typically have some sort of unwanted behavior, plus checking exports to determine versions is shorter.
@LennyMcLennington LennyMcLennington merged commit 9cf31f2 into PolyMC:develop May 9, 2023
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants