Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backport PR #28682 on branch v3.9.x (Fix warnings from mingw compilers) #28686

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/_c_internal_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
#define WIN32_LEAN_AND_MEAN
// Windows 10, for latest HiDPI API support.
#define WINVER 0x0A00
#define _WIN32_WINNT 0x0A00
#if defined(_WIN32_WINNT)
#if _WIN32_WINNT < WINVER
#undef _WIN32_WINNT
#define _WIN32_WINNT WINVER
#endif
#else
#define _WIN32_WINNT WINVER
#endif
#endif
#include <pybind11/pybind11.h>
#ifdef __linux__
Expand Down Expand Up @@ -125,7 +132,7 @@ static void
mpl_SetForegroundWindow(py::capsule UNUSED_ON_NON_WINDOWS(handle_p))
{
#ifdef _WIN32
if (handle_p.name() != "HWND") {
if (strcmp(handle_p.name(), "HWND") != 0) {
throw std::runtime_error("Handle must be a value returned from Win32_GetForegroundWindow");
}
HWND handle = static_cast<HWND>(handle_p.get_pointer());
Expand Down Expand Up @@ -158,7 +165,7 @@ mpl_SetProcessDpiAwareness_max(void)
DPI_AWARENESS_CONTEXT_SYSTEM_AWARE}; // Win10
if (IsValidDpiAwarenessContextPtr != NULL
&& SetProcessDpiAwarenessContextPtr != NULL) {
for (int i = 0; i < sizeof(ctxs) / sizeof(DPI_AWARENESS_CONTEXT); ++i) {
for (size_t i = 0; i < sizeof(ctxs) / sizeof(DPI_AWARENESS_CONTEXT); ++i) {
if (IsValidDpiAwarenessContextPtr(ctxs[i])) {
SetProcessDpiAwarenessContextPtr(ctxs[i]);
break;
Expand Down
9 changes: 8 additions & 1 deletion src/_tkagg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@
#define WIN32_LEAN_AND_MEAN
// Windows 8.1
#define WINVER 0x0603
#define _WIN32_WINNT 0x0603
#if defined(_WIN32_WINNT)
#if _WIN32_WINNT < WINVER
#undef _WIN32_WINNT
#define _WIN32_WINNT WINVER
#endif
#else
#define _WIN32_WINNT WINVER
#endif
#endif

#include <pybind11/pybind11.h>
Expand Down
Loading