forked from MaikoTan/GlosSI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
traypp_unicode.patch
81 lines (71 loc) · 3.42 KB
/
traypp_unicode.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
diff --git a/tray/include/core/windows/tray.hpp b/tray/include/core/windows/tray.hpp
index ab5949922b41c519a6632544286811f379f36392..6f658feda1aae2c1770648b3bffc3af201672fe6 100755
--- a/tray/include/core/windows/tray.hpp
+++ b/tray/include/core/windows/tray.hpp
@@ -11,7 +11,7 @@ namespace Tray
{
HWND hwnd = nullptr;
HMENU menu = nullptr;
- WNDCLASSEX windowClass;
+ WNDCLASSEXA windowClass;
NOTIFYICONDATA notifyData;
std::vector<std::shared_ptr<char[]>> allocations;
diff --git a/tray/src/core/windows/image.cpp b/tray/src/core/windows/image.cpp
index 75a7868350bd1069521345826163eb9275607277..1ecb1de7edaeaff871426238862531dcf4015a76 100755
--- a/tray/src/core/windows/image.cpp
+++ b/tray/src/core/windows/image.cpp
@@ -5,7 +5,7 @@
Tray::Image::Image(HBITMAP image) : image(image) {}
Tray::Image::Image(const char *path) : Image(std::string(path)) {}
Tray::Image::Image(const std::string &path)
- : image(reinterpret_cast<HBITMAP>(LoadImage(nullptr, path.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)))
+ : image(reinterpret_cast<HBITMAP>(LoadImageA(nullptr, path.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)))
{
if (image == nullptr)
{
diff --git a/tray/src/core/windows/tray.cpp b/tray/src/core/windows/tray.cpp
index 38111083207e3e9512f24749360172b995cf2bb0..8d9326b5d700b91c81ba0aef7d8dfcea1c9e19ca 100755
--- a/tray/src/core/windows/tray.cpp
+++ b/tray/src/core/windows/tray.cpp
@@ -23,14 +23,14 @@ Tray::Tray::Tray(std::string identifier, Icon icon) : BaseTray(std::move(identif
windowClass.lpszClassName = this->identifier.c_str();
windowClass.hInstance = GetModuleHandle(nullptr);
- if (RegisterClassEx(&windowClass) == 0)
+ if (RegisterClassExA(&windowClass) == 0)
{
throw std::runtime_error("Failed to register class");
}
// NOLINTNEXTLINE
- hwnd = CreateWindow(this->identifier.c_str(), nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, windowClass.hInstance,
- nullptr);
+ hwnd = CreateWindowA(this->identifier.c_str(), nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, windowClass.hInstance,
+ nullptr);
if (hwnd == nullptr)
{
throw std::runtime_error("Failed to create window");
@@ -64,7 +64,7 @@ void Tray::Tray::exit()
DestroyIcon(notifyData.hIcon);
DestroyMenu(menu);
- UnregisterClass(identifier.c_str(), GetModuleHandle(nullptr));
+ UnregisterClassA(identifier.c_str(), GetModuleHandle(nullptr));
PostMessage(hwnd, WM_QUIT, 0, 0);
allocations.clear();
@@ -97,11 +97,11 @@ HMENU Tray::Tray::construct(const std::vector<std::shared_ptr<TrayEntry>> &entri
{
auto *item = entry.get();
- auto name = std::shared_ptr<char[]>(new char[item->getText().size() + 1]);
- strcpy(name.get(), item->getText().c_str()); // NOLINT
+ auto name = std::make_shared<char[]>(item->getText().size() + 1);
+ strcpy_s(name.get(), item->getText().size() + 1, item->getText().c_str()); // NOLINT
parent->allocations.emplace_back(name);
- MENUITEMINFO winItem{0};
+ MENUITEMINFOA winItem{0};
winItem.wID = ++id;
winItem.dwTypeData = name.get();
@@ -158,7 +158,7 @@ HMENU Tray::Tray::construct(const std::vector<std::shared_ptr<TrayEntry>> &entri
}
}
- InsertMenuItem(menu, id, TRUE, &winItem);
+ InsertMenuItemA(menu, id, TRUE, &winItem);
}
return menu;