Skip to content

Commit

Permalink
MinGW build fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
zzc-1024 committed Feb 24, 2023
1 parent 185a451 commit 7fb6958
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 10 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ if (WIN32)
${WindowsAppSupportSourcesFolder}
)
target_link_libraries (WindowsReferenceApp NodeEngine NodeUIEngine BuiltInNodes WindowsAppSupport)
target_link_libraries(
WindowsReferenceApp
gdiplus
comctl32
windowscodecs
d2d1
dwrite
)
SetCompilerOptions (WindowsReferenceApp)

# WindowsEmbeddingDemo
Expand Down
1 change: 1 addition & 0 deletions Sources/NodeEngine/NE_NodeEngineUtilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <functional>
#include <vector>
#include <cstddef>

namespace NE
{
Expand Down
1 change: 1 addition & 0 deletions Sources/NodeEngine/NE_ValueCombination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "NE_Debug.hpp"

#include <algorithm>
#include <limits>

namespace NE
{
Expand Down
1 change: 1 addition & 0 deletions Sources/NodeUIEngine/NUIE_NodeAlignment.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "NUIE_NodeAlignment.hpp"

#include <algorithm>
#include <limits>

namespace NUIE
{
Expand Down
1 change: 1 addition & 0 deletions Sources/WindowsAppSupport/WAS_CustomControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "NE_Debug.hpp"

#include <vector>
#include <algorithm>

namespace WAS
{
Expand Down
5 changes: 3 additions & 2 deletions Sources/WindowsAppSupport/WAS_Direct2DContextBase.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "WAS_Direct2DContextBase.hpp"
#include "NE_Debug.hpp"
#include <float.h>

namespace WAS
{
Expand Down Expand Up @@ -130,9 +131,9 @@ Direct2DContextBase::Direct2DContextBase () :

Direct2DContextBase::Direct2DContextBase (const Direct2DImageLoaderPtr& imageLoader) :
NUIE::NativeDrawingContext (),
direct2DHandler (),
width (0),
height (0),
direct2DHandler (),
imageLoader (imageLoader),
renderTarget (nullptr)
{
Expand Down Expand Up @@ -165,7 +166,7 @@ void Direct2DContextBase::BeginDraw ()
void Direct2DContextBase::EndDraw ()
{
HRESULT result = renderTarget->EndDraw ();
if (result == D2DERR_RECREATE_TARGET) {
if ((unsigned int)result == D2DERR_RECREATE_TARGET) {
InitRenderTarget ();
}
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/WindowsAppSupport/WAS_GdiOffscreenContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
namespace WAS
{

#ifdef _MSC_VER
template <typename KeyType>
HANDLE CreateHandle (const KeyType& key);
#else
HANDLE CreateHandle (const NUIE::PenCacheKey& key);
HANDLE CreateHandle (const NUIE::ColorCacheKey& key);
HANDLE CreateHandle (const NUIE::FontCacheKey& key);
#endif

template <typename KeyType>
class HandleCache
Expand Down
3 changes: 2 additions & 1 deletion Sources/WindowsAppSupport/WAS_InMemoryDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ INT_PTR InMemoryDialog::Show (HWND parentHwnd, DLGPROC dialogProc, LPARAM initPa
return -1;
}

NONCLIENTMETRICS metrics = { sizeof (NONCLIENTMETRICS) };
NONCLIENTMETRICS metrics;
metrics.cbSize = sizeof (NONCLIENTMETRICS);
if (DBGERROR (!SystemParametersInfo (SPI_GETNONCLIENTMETRICS, 0, &metrics, 0))) {
return -1;
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/WindowsAppSupport/WAS_IncludeWindowsHeaders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
#include <windowsx.h>
#include <CommCtrl.h>

#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4244)
#pragma warning (disable : 4458)
#endif

#include <minmax.h> // for gdiplus
#include <gdiplus.h>

#ifdef _MSC_VER
#pragma warning (pop)
#endif

#endif
2 changes: 1 addition & 1 deletion Sources/WindowsAppSupport/WAS_NodeEditorHwndControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static LRESULT CALLBACK NodeEditorStaticWindowProc (HWND hwnd, UINT msg, WPARAM
LPCREATESTRUCT createStruct = LPCREATESTRUCT (lParam);
SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR) createStruct->lpCreateParams);
} else if (msg == WM_DESTROY) {
SetWindowLongPtr (hwnd, GWLP_USERDATA, NULL);
SetWindowLongPtr (hwnd, GWLP_USERDATA, 0);
}

NodeEditorHwndControl* control = (NodeEditorHwndControl*) GetWindowLongPtr (hwnd, GWLP_USERDATA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static LRESULT CALLBACK NodeEditorNodeListStaticWindowProc (HWND hwnd, UINT msg,
LPCREATESTRUCT createStruct = LPCREATESTRUCT (lParam);
SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR) createStruct->lpCreateParams);
} else if (msg == WM_DESTROY) {
SetWindowLongPtr (hwnd, GWLP_USERDATA, NULL);
SetWindowLongPtr (hwnd, GWLP_USERDATA, 0);
}

NodeEditorNodeTreeHwndControl* control = (NodeEditorNodeTreeHwndControl*) GetWindowLongPtr (hwnd, GWLP_USERDATA);
Expand Down
4 changes: 4 additions & 0 deletions Sources/WindowsEmbeddingDemo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,11 @@ LRESULT CALLBACK ApplicationWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPAR
return DefWindowProc (hwnd, msg, wParam, lParam);
}

#ifdef _MSC_VER
int wWinMain (HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, int /*nCmdShow*/)
#else
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE, LPSTR, int)
#endif
{
WNDCLASSEX windowClass;
ZeroMemory (&windowClass, sizeof (WNDCLASSEX));
Expand Down
4 changes: 2 additions & 2 deletions Sources/WindowsReferenceApp/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void Application::InitFileMenu (HWND hwnd)
{
HMENU file = fileMenu.AddPopupMenu (L"File");
fileMenu.AddPopupMenuItem (file, FILE_NEW, L"New");
fileMenu.AddPopupMenuItem (file, FILE_OPEN, L"Open");
fileMenu.AddPopupMenuItem (file, OPEN_FILE, L"Open");
fileMenu.AddPopupMenuItem (file, FILE_SAVE, L"Save");
fileMenu.AddPopupMenuSeparator (file);
fileMenu.AddPopupMenuItem (file, FILE_QUIT, L"Quit");
Expand All @@ -142,7 +142,7 @@ void Application::InitToolbar (HWND hwnd)
toolbar.Init (hwnd);

AddToolbarItem (TOOLBAR_ENABLED_NEW_ICON, FILE_NEW);
AddToolbarItem (TOOLBAR_ENABLED_OPEN_ICON, FILE_OPEN);
AddToolbarItem (TOOLBAR_ENABLED_OPEN_ICON, OPEN_FILE);
AddToolbarItem (TOOLBAR_ENABLED_SAVE_ICON, FILE_SAVE);
toolbar.AddSeparator ();

Expand Down
2 changes: 1 addition & 1 deletion Sources/WindowsReferenceApp/CommandIds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define COMMANDIDS_HPP

#define FILE_NEW 1101
#define FILE_OPEN 1102
#define OPEN_FILE 1102
#define FILE_SAVE 1103
#define FILE_QUIT 1104
#define EDIT_UNDO 1201
Expand Down
10 changes: 8 additions & 2 deletions Sources/WindowsReferenceApp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
#include "ResourceIds.hpp"
#include "CommandIds.hpp"

#ifdef _MSC_VER
#pragma comment (lib, "gdiplus.lib")
#pragma comment (lib, "comctl32.lib")
#pragma comment (lib, "windowscodecs.lib")
#pragma comment (lib, "d2d1.lib")
#pragma comment (lib, "dwrite.lib")
#pragma comment (linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif

LRESULT CALLBACK ApplicationWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_CREATE) {
LPCREATESTRUCT createStruct = LPCREATESTRUCT (lParam);
SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR) createStruct->lpCreateParams);
} else if (msg == WM_DESTROY) {
SetWindowLongPtr (hwnd, GWLP_USERDATA, NULL);
SetWindowLongPtr (hwnd, GWLP_USERDATA, 0);
PostQuitMessage (0);
}

Expand Down Expand Up @@ -70,7 +72,7 @@ LRESULT CALLBACK ApplicationWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPAR
case FILE_NEW:
application->New (hwnd);
break;
case FILE_OPEN:
case OPEN_FILE:
application->Open (hwnd);
break;
case FILE_SAVE:
Expand Down Expand Up @@ -111,7 +113,11 @@ LRESULT CALLBACK ApplicationWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPAR
return DefWindowProc (hwnd, msg, wParam, lParam);
}

#ifdef _MSC_VER
int wWinMain (HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, int /*nCmdShow*/)
#else
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE, LPSTR, int)
#endif
{
EnableLeakDetection ();
InitCommonControls ();
Expand Down

0 comments on commit 7fb6958

Please sign in to comment.