Skip to content

Commit

Permalink
Use plain windows.h now it doesn't define small.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Nov 13, 2023
1 parent fe4f0a7 commit 5432626
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 19 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ PRIVATE
base/platform/win/base_url_scheme_win.cpp
base/platform/win/base_url_scheme_win.h
base/platform/win/base_windows_co_task_mem.h
base/platform/win/base_windows_h.h
base/platform/win/base_windows_gdiplus_h.h
base/platform/win/base_windows_rpcndr_h.h
base/platform/win/base_windows_safe_library.cpp
base/platform/win/base_windows_safe_library.h
base/platform/win/base_windows_shlobj_h.h
base/platform/win/base_windows_winrt.cpp
base/platform/win/base_windows_winrt.h
base/platform/win/base_windows_wrl.cpp
Expand Down
3 changes: 2 additions & 1 deletion base/file_lock_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
//
#include "base/file_lock.h"

#include "base/platform/win/base_windows_h.h"
#include "base/platform/win/base_file_utilities_win.h"

#include <QtCore/QDir>

#include <windows.h>
#include <io.h>
#include <fileapi.h>

Expand Down
3 changes: 2 additions & 1 deletion base/platform/win/base_battery_saving_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//
#include "base/platform/win/base_battery_saving_win.h"

#include "base/platform/win/base_windows_h.h"
#include "base/battery_saving.h"
#include "base/integration.h"

Expand All @@ -15,6 +14,8 @@
#include <QtGui/QWindow>
#include <QtWidgets/QWidget>

#include <windows.h>

namespace base::Platform {
namespace {

Expand Down
2 changes: 1 addition & 1 deletion base/platform/win/base_file_utilities_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "base/platform/win/base_file_utilities_win.h"

#include "base/platform/win/base_windows_safe_library.h"
#include "base/platform/win/base_windows_shlobj_h.h"
#include "base/algorithm.h"

#include <QtCore/QString>
Expand All @@ -16,7 +17,6 @@
#include <string>
#include <shellapi.h>
#include <Shlwapi.h>
#include <shlobj.h>
#include <RestartManager.h>
#include <io.h>

Expand Down
2 changes: 1 addition & 1 deletion base/platform/win/base_global_shortcuts_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
#include "base/platform/win/base_global_shortcuts_win.h"

#include "base/platform/win/base_windows_h.h"
#include <windows.h>

namespace base::Platform::GlobalShortcuts {
namespace {
Expand Down
2 changes: 1 addition & 1 deletion base/platform/win/base_info_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

#include "base/algorithm.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/win/base_windows_h.h"

#include <QtCore/QOperatingSystemVersion>
#include <QtCore/QJsonObject>
#include <QtCore/QDate>
#include <QtCore/QSettings>

#include <windows.h>
#include <VersionHelpers.h>

namespace Platform {
Expand Down
3 changes: 2 additions & 1 deletion base/platform/win/base_last_input_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
//
#include "base/platform/win/base_last_input_win.h"

#include "base/platform/win/base_windows_h.h"
#include "base/call_delayed.h"
#include "base/integration.h"

#include <windows.h>

namespace base::Platform {
namespace {

Expand Down
3 changes: 1 addition & 2 deletions base/platform/win/base_layout_switch_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
//
#include "base/platform/win/base_layout_switch_win.h"

#include "base/platform/win/base_windows_h.h"

#include <windows.h>
#include <WinUser.h>
#include <minwindef.h>

Expand Down
2 changes: 1 addition & 1 deletion base/platform/win/base_network_reachability_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
#include "base/platform/base_platform_network_reachability.h"

#include "base/platform/win/base_windows_h.h"
#include "base/debug_log.h"

#include <windows.h>
#include <wrl/client.h>
#include <netlistmgr.h>
#include <comdef.h>
Expand Down
3 changes: 2 additions & 1 deletion base/platform/win/base_power_save_blocker_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
//
#include "base/platform/win/base_power_save_blocker_win.h"

#include "base/platform/win/base_windows_h.h"
#include "base/platform/base_platform_info.h"

#include <windows.h>

// Thanks Chromium: services/device/wake_lock/power_save_blocker

namespace base::Platform {
Expand Down
2 changes: 1 addition & 1 deletion base/platform/win/base_process_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
#include "base/platform/win/base_process_win.h"

#include "base/platform/win/base_windows_h.h"
#include <windows.h>

namespace base::Platform {
namespace {
Expand Down
4 changes: 2 additions & 2 deletions base/platform/win/base_url_scheme_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
#include "base/platform/win/base_url_scheme_win.h"

#include "base/platform/win/base_windows_h.h"

#include <QtCore/QDir>

#include <windows.h>
#include <array>

namespace base::Platform {
Expand Down
25 changes: 25 additions & 0 deletions base/platform/win/base_windows_gdiplus_h.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// This file is part of Desktop App Toolkit,
// a set of libraries for developing nice desktop applications.
//
// For license and copyright information please follow this link:
// https://github.com/desktop-app/legal/blob/master/LEGAL
//
#pragma once

#include <Unknwn.h>

#ifdef min
#undef min
#endif // min

#ifdef max
#undef max
#endif // max

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) < (b) ? (b) : (a))

#include <gdiplus.h>

#undef min
#undef max
14 changes: 14 additions & 0 deletions base/platform/win/base_windows_rpcndr_h.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file is part of Desktop App Toolkit,
// a set of libraries for developing nice desktop applications.
//
// For license and copyright information please follow this link:
// https://github.com/desktop-app/legal/blob/master/LEGAL
//
#pragma once

#include <rpc.h>
#include <rpcndr.h>

#ifdef small
#undef small
#endif // small
2 changes: 1 addition & 1 deletion base/platform/win/base_windows_safe_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
#pragma once

#include "base/platform/win/base_windows_h.h"
#include <windows.h>

// We try to keep this module free of external dependencies.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
#pragma once

#include <windows.h>
#include <shlobj.h>

#ifdef small
#undef small
Expand Down
3 changes: 2 additions & 1 deletion base/platform/win/base_windows_winrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
//
#include "base/platform/win/base_windows_winrt.h"

#include "base/platform/win/base_windows_h.h"
#include "base/platform/win/base_windows_safe_library.h"

#include <windows.h>

namespace base::WinRT {
namespace {

Expand Down
3 changes: 1 addition & 2 deletions base/platform/win/base_windows_wrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
//
#pragma once

#include "base/platform/win/base_windows_h.h"

#define _ROAPI_ // we don't want them from .dll
#include <roapi.h>
#undef _ROAPI_

#include <windows.h>
#include <wrl/client.h>
#include <winstring.h>
#include <strsafe.h>
Expand Down

0 comments on commit 5432626

Please sign in to comment.