Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
fix #303 mingw compile error (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
czyt1988 authored Oct 31, 2023
1 parent 46ac2f6 commit bbfea2c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
11 changes: 11 additions & 0 deletions include/FramelessHelper/Core/framelesshelper_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,22 @@
# define NTDDI_VERSION NTDDI_WIN10_NI
#endif

#if _WIN32_WINNT < _WIN32_WINNT_WIN10
#undef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_WIN10
#endif

#if WINVER < _WIN32_WINNT_WIN10
#undef WINVER
#define WINVER _WIN32_WINNT_WIN10
#endif

#include <windows.h>
#include <uxtheme.h>
#include <shellapi.h>
#include <dwmapi.h>


#include <FramelessHelper/Core/framelesshelpercore_global.h>

#ifndef SC_SIZE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelperPrivate : public QObject

QColor savedWindowBackgroundColor = {};
bool blurBehindWindowEnabled = false;
QPointer<QWidget> window = nullptr;
QPointer<QWidget> window;//QPointer<QWidget> window = nullptr; can not compile under mingw
bool qpaReady = false;
QSizePolicy savedSizePolicy = {};
quint32 qpaWaitTime = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class FRAMELESSHELPER_WIDGETS_API StandardTitleBarPrivate : public QObject
StandardSystemButton *maximizeButton = nullptr;
StandardSystemButton *closeButton = nullptr;
#endif
QPointer<QWidget> window = nullptr;
QPointer<QWidget> window;////QPointer<QWidget> window = nullptr; can not compile under mingw
bool extended = false;
Qt::Alignment labelAlignment = {};
bool hideWhenClose = false;
Expand Down
30 changes: 30 additions & 0 deletions src/core/utils_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,10 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
DEFINE_WIN32_MESSAGE(WM_VSCROLL)
DEFINE_WIN32_MESSAGE(WM_INITMENU)
DEFINE_WIN32_MESSAGE(WM_INITMENUPOPUP)
#if _WIN32_WINNT >= 0x0601
DEFINE_WIN32_MESSAGE(WM_GESTURE)
DEFINE_WIN32_MESSAGE(WM_GESTURENOTIFY)
#endif /* _WIN32_WINNT >= 0x0601 */
DEFINE_WIN32_MESSAGE(WM_MENUSELECT)
DEFINE_WIN32_MESSAGE(WM_MENUCHAR)
DEFINE_WIN32_MESSAGE(WM_ENTERIDLE)
Expand Down Expand Up @@ -447,10 +449,15 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
DEFINE_WIN32_MESSAGE(WM_EXITSIZEMOVE)
DEFINE_WIN32_MESSAGE(WM_DROPFILES)
DEFINE_WIN32_MESSAGE(WM_MDIREFRESHMENU)
#if WINVER >= 0x0602
DEFINE_WIN32_MESSAGE(WM_POINTERDEVICECHANGE)
DEFINE_WIN32_MESSAGE(WM_POINTERDEVICEINRANGE)
DEFINE_WIN32_MESSAGE(WM_POINTERDEVICEOUTOFRANGE)
#endif
#if WINVER >= 0x0601
DEFINE_WIN32_MESSAGE(WM_TOUCH)
#endif
#if WINVER >= 0x0602
DEFINE_WIN32_MESSAGE(WM_NCPOINTERUPDATE)
DEFINE_WIN32_MESSAGE(WM_NCPOINTERDOWN)
DEFINE_WIN32_MESSAGE(WM_NCPOINTERUP)
Expand All @@ -464,9 +471,16 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
DEFINE_WIN32_MESSAGE(WM_TOUCHHITTESTING)
DEFINE_WIN32_MESSAGE(WM_POINTERWHEEL)
DEFINE_WIN32_MESSAGE(WM_POINTERHWHEEL)
#endif
#ifdef WM_POINTERROUTEDTO
DEFINE_WIN32_MESSAGE(WM_POINTERROUTEDTO)
#endif
#ifdef WM_POINTERROUTEDAWAY
DEFINE_WIN32_MESSAGE(WM_POINTERROUTEDAWAY)
#endif
#ifdef WM_POINTERROUTEDRELEASED
DEFINE_WIN32_MESSAGE(WM_POINTERROUTEDRELEASED)
#endif
DEFINE_WIN32_MESSAGE(WM_IME_SETCONTEXT)
DEFINE_WIN32_MESSAGE(WM_IME_NOTIFY)
DEFINE_WIN32_MESSAGE(WM_IME_CONTROL)
Expand All @@ -484,8 +498,12 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
DEFINE_WIN32_MESSAGE(WM_TABLET_FIRST)
DEFINE_WIN32_MESSAGE(WM_TABLET_LAST)
DEFINE_WIN32_MESSAGE(WM_DPICHANGED)
#ifdef WM_DPICHANGED_BEFOREPARENT
DEFINE_WIN32_MESSAGE(WM_DPICHANGED_BEFOREPARENT)
#endif
#ifdef WM_DPICHANGED_AFTERPARENT
DEFINE_WIN32_MESSAGE(WM_DPICHANGED_AFTERPARENT)
#endif
DEFINE_WIN32_MESSAGE(WM_GETDPISCALEDSIZE)
DEFINE_WIN32_MESSAGE(WM_CUT)
DEFINE_WIN32_MESSAGE(WM_COPY)
Expand All @@ -512,12 +530,22 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
DEFINE_WIN32_MESSAGE(WM_THEMECHANGED)
DEFINE_WIN32_MESSAGE(WM_CLIPBOARDUPDATE)
DEFINE_WIN32_MESSAGE(WM_DWMCOMPOSITIONCHANGED)
#ifdef WM_DWMNCRENDERINGCHANGED
DEFINE_WIN32_MESSAGE(WM_DWMNCRENDERINGCHANGED)
#endif
DEFINE_WIN32_MESSAGE(WM_DWMCOLORIZATIONCOLORCHANGED)
#ifdef WM_DWMWINDOWMAXIMIZEDCHANGE
DEFINE_WIN32_MESSAGE(WM_DWMWINDOWMAXIMIZEDCHANGE)
#endif
#ifdef WM_DWMSENDICONICTHUMBNAIL
DEFINE_WIN32_MESSAGE(WM_DWMSENDICONICTHUMBNAIL)
#endif
#ifdef WM_DWMSENDICONICLIVEPREVIEWBITMAP
DEFINE_WIN32_MESSAGE(WM_DWMSENDICONICLIVEPREVIEWBITMAP)
#endif
#ifdef WM_GETTITLEBARINFOEX
DEFINE_WIN32_MESSAGE(WM_GETTITLEBARINFOEX)
#endif
DEFINE_WIN32_MESSAGE(WM_HANDHELDFIRST)
DEFINE_WIN32_MESSAGE(WM_HANDHELDLAST)
DEFINE_WIN32_MESSAGE(WM_AFXFIRST)
Expand Down Expand Up @@ -860,7 +888,9 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
if (((message >= WM_NCCREATE) && (message <= WM_NCACTIVATE))
|| ((message >= WM_NCMOUSEMOVE) && (message <= WM_NCMBUTTONDBLCLK))
|| ((message >= WM_NCXBUTTONDOWN) && (message <= WM_NCXBUTTONDBLCLK))
#if WINVER >= 0x0602
|| ((message >= WM_NCPOINTERUPDATE) && (message <= WM_NCPOINTERUP))
#endif
|| ((message == WM_NCMOUSEHOVER) || (message == WM_NCMOUSELEAVE))) {
return true;
} else {
Expand Down

0 comments on commit bbfea2c

Please sign in to comment.