plusui-native-core 0.1.105 → 0.1.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/Core/.cache/clangd/index/api.hpp.016B34C8046EF490.idx +0 -0
  2. package/Core/.cache/clangd/index/app.cpp.1E6FAF043D496421.idx +0 -0
  3. package/Core/.cache/clangd/index/app.hpp.FA0E5D412C4E6148.idx +0 -0
  4. package/Core/.cache/clangd/index/browser.cpp.9461A2CAF129F1D9.idx +0 -0
  5. package/Core/.cache/clangd/index/browser.hpp.BE40AE80881B3107.idx +0 -0
  6. package/Core/.cache/clangd/index/clipboard.cpp.2399913537B2A7AD.idx +0 -0
  7. package/Core/.cache/clangd/index/clipboard.hpp.C1095DDACD7149E9.idx +0 -0
  8. package/Core/.cache/clangd/index/connect.cpp.518C66C7C28B30A9.idx +0 -0
  9. package/Core/.cache/clangd/index/connect.hpp.08E2F7CD13B78601.idx +0 -0
  10. package/Core/.cache/clangd/index/connection.hpp.849FAEF1523BF2C3.idx +0 -0
  11. package/Core/.cache/clangd/index/display.cpp.F6F6D932BF9F8D8E.idx +0 -0
  12. package/Core/.cache/clangd/index/display.hpp.0C1A9CAD11EE4404.idx +0 -0
  13. package/Core/.cache/clangd/index/filedrop.cpp.669B524B3C501C52.idx +0 -0
  14. package/Core/.cache/clangd/index/filedrop.hpp.48460099C3F35F2D.idx +0 -0
  15. package/Core/.cache/clangd/index/keyboard.cpp.DC6D34E4A4F798DD.idx +0 -0
  16. package/Core/.cache/clangd/index/keyboard.hpp.F016CB68D7DE5A46.idx +0 -0
  17. package/Core/.cache/clangd/index/keyboard_linux.cpp.B403FDCEA7A6CA53.idx +0 -0
  18. package/Core/.cache/clangd/index/menu.cpp.3059F08D8D2DF265.idx +0 -0
  19. package/Core/.cache/clangd/index/menu.hpp.8716DCCC573910D4.idx +0 -0
  20. package/Core/.cache/clangd/index/plusui.hpp.8CFCDFDC2E3F41DD.idx +0 -0
  21. package/Core/.cache/clangd/index/router.cpp.EAC9EAD34C59E573.idx +0 -0
  22. package/Core/.cache/clangd/index/router.hpp.2B06E2EE9998468D.idx +0 -0
  23. package/Core/.cache/clangd/index/stb_image.h.E26CF48FE089A0D3.idx +0 -0
  24. package/Core/.cache/clangd/index/tray.cpp.92F244E7E1D7F0EC.idx +0 -0
  25. package/Core/.cache/clangd/index/tray.hpp.0D881B0601BBBD25.idx +0 -0
  26. package/Core/.cache/clangd/index/webgpu.cpp.FC656FA8BE10FE15.idx +0 -0
  27. package/Core/.cache/clangd/index/webgpu.hpp.5AF1A5E9DF9E5AE0.idx +0 -0
  28. package/Core/.cache/clangd/index/window.cpp.191D8C9ADF874B22.idx +0 -0
  29. package/Core/.cache/clangd/index/window.hpp.B9811B43AA295697.idx +0 -0
  30. package/Core/.claude/settings.local.json +7 -0
  31. package/Core/CMakeLists.txt +1 -1
  32. package/Core/Features/API/app-api.ts +28 -28
  33. package/Core/Features/API/browser-api.ts +38 -38
  34. package/Core/Features/API/clipboard-api.ts +21 -21
  35. package/Core/Features/API/display-api.ts +33 -33
  36. package/Core/Features/API/keyboard-api.ts +33 -33
  37. package/Core/Features/API/menu-api.ts +39 -39
  38. package/Core/Features/API/router-api.ts +23 -23
  39. package/Core/Features/API/tray-api.ts +22 -22
  40. package/Core/Features/API/webgpu-api.ts +55 -55
  41. package/Core/Features/App/app.cpp +135 -102
  42. package/Core/Features/Browser/browser.cpp +227 -227
  43. package/Core/Features/Browser/browser.ts +161 -161
  44. package/Core/Features/Clipboard/clipboard.cpp +235 -235
  45. package/Core/Features/Display/display.cpp +212 -212
  46. package/Core/Features/FileDrop/filedrop.cpp +448 -324
  47. package/Core/Features/FileDrop/filedrop.css +421 -421
  48. package/Core/Features/FileDrop/filedrop.ts +0 -7
  49. package/Core/Features/Keyboard/keyboard_linux.cpp +4 -0
  50. package/Core/Features/Router/router.cpp +62 -62
  51. package/Core/Features/Router/router.ts +113 -113
  52. package/Core/Features/Tray/tray.cpp +437 -324
  53. package/Core/Features/WebGPU/webgpu.cpp +948 -948
  54. package/Core/Features/Window/webview.cpp +1009 -1009
  55. package/Core/Features/Window/webview.ts +516 -516
  56. package/Core/Features/Window/window.cpp +2240 -1986
  57. package/Core/include/plusui/api.hpp +237 -237
  58. package/Core/include/plusui/app.hpp +36 -34
  59. package/Core/include/plusui/browser.hpp +67 -67
  60. package/Core/include/plusui/clipboard.hpp +41 -41
  61. package/Core/include/plusui/connect.hpp +340 -340
  62. package/Core/include/plusui/connection.hpp +3 -3
  63. package/Core/include/plusui/display.hpp +90 -90
  64. package/Core/include/plusui/filedrop.hpp +92 -77
  65. package/Core/include/plusui/keyboard.hpp +112 -112
  66. package/Core/include/plusui/menu.hpp +153 -153
  67. package/Core/include/plusui/plusui +18 -18
  68. package/Core/include/plusui/router.hpp +42 -42
  69. package/Core/include/plusui/tray.hpp +94 -94
  70. package/Core/include/plusui/webgpu.hpp +434 -434
  71. package/Core/include/plusui/window.hpp +180 -177
  72. package/Core/scripts/generate-umbrella-header.mjs +77 -77
  73. package/Core/vendor/WebView2EnvironmentOptions.h +406 -406
  74. package/Core/vendor/webview.h +487 -487
  75. package/Core/vendor/webview2.h +52079 -52079
  76. package/README.md +19 -19
  77. package/package.json +1 -1
@@ -1,212 +1,212 @@
1
- #ifdef _WIN32
2
- #ifndef _WIN32_WINNT
3
- #define _WIN32_WINNT 0x0601
4
- #endif
5
- #include <windows.h>
6
-
7
- #ifndef EXTERN_C
8
- #ifdef __cplusplus
9
- #define EXTERN_C extern "C"
10
- #else
11
- #define EXTERN_C extern
12
- #endif
13
- #endif
14
-
15
- #include <shellapi.h>
16
- #include <shlobj.h>
17
- #include <winuser.h>
18
-
19
- #ifndef DISPLAY_DEVICE_ATTACHED_TO_SESSION
20
- #define DISPLAY_DEVICE_ATTACHED_TO_SESSION 0x00000001
21
- #endif
22
- #ifndef SM_CXMM
23
- #define SM_CXMM 43
24
- #endif
25
- #ifndef SM_CYMM
26
- #define SM_CYMM 44
27
- #endif
28
-
29
- #pragma comment(lib, "user32.lib")
30
- #pragma comment(lib, "shell32.lib")
31
- #endif
32
-
33
- #include <algorithm>
34
- #include <plusui/display.hpp>
35
- #include <vector>
36
-
37
- #ifdef __APPLE__
38
- #include <Cocoa/Cocoa.h>
39
- #include <CoreGraphics/CoreGraphics.h>
40
- #elif !defined(_WIN32)
41
- #include <gdk/gdk.h>
42
- #include <gtk/gtk.h>
43
- #endif
44
-
45
- namespace plusui {
46
-
47
- struct DisplayManager::Impl {
48
- std::vector<Display> displays;
49
- std::function<void(const Display &)> onConnectCallback;
50
- std::function<void(int)> onDisconnectCallback;
51
- std::function<void(const Display &)> onChangeCallback;
52
- };
53
-
54
- DisplayManager::DisplayManager() : pImpl(std::make_unique<Impl>()) {
55
- refresh();
56
- }
57
-
58
- DisplayManager::~DisplayManager() = default;
59
-
60
- DisplayManager &DisplayManager::instance() {
61
- static DisplayManager inst;
62
- return inst;
63
- }
64
-
65
- std::vector<Display> DisplayManager::getAllDisplays() {
66
- #ifdef _WIN32
67
- pImpl->displays.clear();
68
-
69
- int i = 0;
70
- DISPLAY_DEVICEW dd = {};
71
- dd.cb = sizeof(dd);
72
-
73
- while (EnumDisplayDevicesW(nullptr, i, &dd, 0)) {
74
- if (dd.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) {
75
- i++;
76
- continue;
77
- }
78
-
79
- Display d;
80
- d.id = i;
81
- // Widestring to string conversion
82
- std::wstring wname(dd.DeviceName);
83
- #pragma warning(push)
84
- #pragma warning(disable: 4244) // Suppress wchar_t to char conversion warning
85
- d.name = std::string(wname.begin(), wname.end());
86
- #pragma warning(pop)
87
-
88
- DEVMODEW dm = {};
89
- dm.dmSize = sizeof(dm);
90
- if (EnumDisplaySettingsW(dd.DeviceName, ENUM_CURRENT_SETTINGS, &dm)) {
91
- d.bounds.x = dm.dmPosition.x;
92
- d.bounds.y = dm.dmPosition.y;
93
- d.bounds.width = dm.dmPelsWidth;
94
- d.bounds.height = dm.dmPelsHeight;
95
- d.resolution.width = dm.dmPelsWidth;
96
- d.resolution.height = dm.dmPelsHeight;
97
- d.currentMode.width = dm.dmPelsWidth;
98
- d.currentMode.height = dm.dmPelsHeight;
99
- d.currentMode.refreshRate = dm.dmDisplayFrequency;
100
- }
101
-
102
- d.isPrimary = (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE);
103
-
104
- HMONITOR hMon = MonitorFromWindow(nullptr, MONITOR_DEFAULTTOPRIMARY);
105
- MONITORINFO mi = {};
106
- mi.cbSize = sizeof(mi);
107
- if (GetMonitorInfoW(hMon, &mi)) {
108
- d.workArea.x = mi.rcWork.left;
109
- d.workArea.y = mi.rcWork.top;
110
- d.workArea.width = mi.rcWork.right - mi.rcWork.left;
111
- d.workArea.height = mi.rcWork.bottom - mi.rcWork.top;
112
- }
113
-
114
- d.scaleFactor = 1.0;
115
- d.isConnected = (dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_SESSION);
116
-
117
- pImpl->displays.push_back(d);
118
- i++;
119
- }
120
-
121
- #elif defined(__APPLE__)
122
- pImpl->displays.clear();
123
-
124
- CGDirectDisplayID mainDisplay = CGMainDisplayID();
125
- CGDisplayCount count;
126
- CGGetActiveDisplayList(0, nullptr, &count);
127
-
128
- std::vector<CGDirectDisplayID> displays(count);
129
- CGGetActiveDisplayList(count, displays.data(), &count);
130
-
131
- for (auto displayID : displays) {
132
- Display d;
133
- d.id = (int)displayID;
134
- d.isPrimary = (displayID == mainDisplay);
135
-
136
- CGRect rect = CGDisplayBounds(displayID);
137
- d.bounds.x = rect.origin.x;
138
- d.bounds.y = rect.origin.y;
139
- d.bounds.width = rect.size.width;
140
- d.bounds.height = rect.size.height;
141
- d.resolution.width = rect.size.width;
142
- d.resolution.height = rect.size.height;
143
-
144
- // Work area on macOS is tricky without AppKit, but we can use NSScreen in
145
- // window.cpp if needed. For now, we'll just use the full bounds.
146
- d.workArea = d.bounds;
147
-
148
- CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displayID);
149
- if (mode) {
150
- d.currentMode.width = CGDisplayModeGetWidth(mode);
151
- d.currentMode.height = CGDisplayModeGetHeight(mode);
152
- d.currentMode.refreshRate = CGDisplayModeGetRefreshRate(mode);
153
- CGDisplayModeRelease(mode);
154
- }
155
-
156
- d.scaleFactor = 1.0; // TODO: Get backing scale factor
157
- d.isConnected = true;
158
-
159
- pImpl->displays.push_back(d);
160
- }
161
- #else
162
- pImpl->displays.clear();
163
- GdkDisplay *display = gdk_display_get_default();
164
- if (display) {
165
- int n = gdk_display_get_n_monitors(display);
166
- for (int i = 0; i < n; i++) {
167
- GdkMonitor *monitor = gdk_display_get_monitor(display, i);
168
- GdkRectangle rect;
169
- gdk_monitor_get_geometry(monitor, &rect);
170
-
171
- Display d;
172
- d.id = i;
173
- d.isPrimary = gdk_monitor_is_primary(monitor);
174
- d.bounds.x = rect.x;
175
- d.bounds.y = rect.y;
176
- d.bounds.width = rect.width;
177
- d.bounds.height = rect.height;
178
- d.resolution.width = rect.width;
179
- d.resolution.height = rect.height;
180
-
181
- gdk_monitor_get_workarea(monitor, &rect);
182
- d.workArea.x = rect.x;
183
- d.workArea.y = rect.y;
184
- d.workArea.width = rect.width;
185
- d.workArea.height = rect.height;
186
-
187
- d.scaleFactor = gdk_monitor_get_scale_factor(monitor);
188
- d.isConnected = true;
189
- pImpl->displays.push_back(d);
190
- }
191
- }
192
- #endif
193
- return pImpl->displays;
194
- }
195
-
196
- void DisplayManager::refresh() { getAllDisplays(); }
197
-
198
- void DisplayManager::onDisplayConnected(
199
- std::function<void(const Display &)> callback) {
200
- pImpl->onConnectCallback = callback;
201
- }
202
-
203
- void DisplayManager::onDisplayDisconnected(std::function<void(int)> callback) {
204
- pImpl->onDisconnectCallback = callback;
205
- }
206
-
207
- void DisplayManager::onDisplayChanged(
208
- std::function<void(const Display &)> callback) {
209
- pImpl->onChangeCallback = callback;
210
- }
211
-
212
- } // namespace plusui
1
+ #ifdef _WIN32
2
+ #ifndef _WIN32_WINNT
3
+ #define _WIN32_WINNT 0x0601
4
+ #endif
5
+ #include <windows.h>
6
+
7
+ #ifndef EXTERN_C
8
+ #ifdef __cplusplus
9
+ #define EXTERN_C extern "C"
10
+ #else
11
+ #define EXTERN_C extern
12
+ #endif
13
+ #endif
14
+
15
+ #include <shellapi.h>
16
+ #include <shlobj.h>
17
+ #include <winuser.h>
18
+
19
+ #ifndef DISPLAY_DEVICE_ATTACHED_TO_SESSION
20
+ #define DISPLAY_DEVICE_ATTACHED_TO_SESSION 0x00000001
21
+ #endif
22
+ #ifndef SM_CXMM
23
+ #define SM_CXMM 43
24
+ #endif
25
+ #ifndef SM_CYMM
26
+ #define SM_CYMM 44
27
+ #endif
28
+
29
+ #pragma comment(lib, "user32.lib")
30
+ #pragma comment(lib, "shell32.lib")
31
+ #endif
32
+
33
+ #include <algorithm>
34
+ #include <plusui/display.hpp>
35
+ #include <vector>
36
+
37
+ #ifdef __APPLE__
38
+ #include <Cocoa/Cocoa.h>
39
+ #include <CoreGraphics/CoreGraphics.h>
40
+ #elif !defined(_WIN32)
41
+ #include <gdk/gdk.h>
42
+ #include <gtk/gtk.h>
43
+ #endif
44
+
45
+ namespace plusui {
46
+
47
+ struct DisplayManager::Impl {
48
+ std::vector<Display> displays;
49
+ std::function<void(const Display &)> onConnectCallback;
50
+ std::function<void(int)> onDisconnectCallback;
51
+ std::function<void(const Display &)> onChangeCallback;
52
+ };
53
+
54
+ DisplayManager::DisplayManager() : pImpl(std::make_unique<Impl>()) {
55
+ refresh();
56
+ }
57
+
58
+ DisplayManager::~DisplayManager() = default;
59
+
60
+ DisplayManager &DisplayManager::instance() {
61
+ static DisplayManager inst;
62
+ return inst;
63
+ }
64
+
65
+ std::vector<Display> DisplayManager::getAllDisplays() {
66
+ #ifdef _WIN32
67
+ pImpl->displays.clear();
68
+
69
+ int i = 0;
70
+ DISPLAY_DEVICEW dd = {};
71
+ dd.cb = sizeof(dd);
72
+
73
+ while (EnumDisplayDevicesW(nullptr, i, &dd, 0)) {
74
+ if (dd.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) {
75
+ i++;
76
+ continue;
77
+ }
78
+
79
+ Display d;
80
+ d.id = i;
81
+ // Widestring to string conversion
82
+ std::wstring wname(dd.DeviceName);
83
+ #pragma warning(push)
84
+ #pragma warning(disable: 4244) // Suppress wchar_t to char conversion warning
85
+ d.name = std::string(wname.begin(), wname.end());
86
+ #pragma warning(pop)
87
+
88
+ DEVMODEW dm = {};
89
+ dm.dmSize = sizeof(dm);
90
+ if (EnumDisplaySettingsW(dd.DeviceName, ENUM_CURRENT_SETTINGS, &dm)) {
91
+ d.bounds.x = dm.dmPosition.x;
92
+ d.bounds.y = dm.dmPosition.y;
93
+ d.bounds.width = dm.dmPelsWidth;
94
+ d.bounds.height = dm.dmPelsHeight;
95
+ d.resolution.width = dm.dmPelsWidth;
96
+ d.resolution.height = dm.dmPelsHeight;
97
+ d.currentMode.width = dm.dmPelsWidth;
98
+ d.currentMode.height = dm.dmPelsHeight;
99
+ d.currentMode.refreshRate = dm.dmDisplayFrequency;
100
+ }
101
+
102
+ d.isPrimary = (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE);
103
+
104
+ HMONITOR hMon = MonitorFromWindow(nullptr, MONITOR_DEFAULTTOPRIMARY);
105
+ MONITORINFO mi = {};
106
+ mi.cbSize = sizeof(mi);
107
+ if (GetMonitorInfoW(hMon, &mi)) {
108
+ d.workArea.x = mi.rcWork.left;
109
+ d.workArea.y = mi.rcWork.top;
110
+ d.workArea.width = mi.rcWork.right - mi.rcWork.left;
111
+ d.workArea.height = mi.rcWork.bottom - mi.rcWork.top;
112
+ }
113
+
114
+ d.scaleFactor = 1.0;
115
+ d.isConnected = (dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_SESSION);
116
+
117
+ pImpl->displays.push_back(d);
118
+ i++;
119
+ }
120
+
121
+ #elif defined(__APPLE__)
122
+ pImpl->displays.clear();
123
+
124
+ CGDirectDisplayID mainDisplay = CGMainDisplayID();
125
+ CGDisplayCount count;
126
+ CGGetActiveDisplayList(0, nullptr, &count);
127
+
128
+ std::vector<CGDirectDisplayID> displays(count);
129
+ CGGetActiveDisplayList(count, displays.data(), &count);
130
+
131
+ for (auto displayID : displays) {
132
+ Display d;
133
+ d.id = (int)displayID;
134
+ d.isPrimary = (displayID == mainDisplay);
135
+
136
+ CGRect rect = CGDisplayBounds(displayID);
137
+ d.bounds.x = rect.origin.x;
138
+ d.bounds.y = rect.origin.y;
139
+ d.bounds.width = rect.size.width;
140
+ d.bounds.height = rect.size.height;
141
+ d.resolution.width = rect.size.width;
142
+ d.resolution.height = rect.size.height;
143
+
144
+ // Work area on macOS is tricky without AppKit, but we can use NSScreen in
145
+ // window.cpp if needed. For now, we'll just use the full bounds.
146
+ d.workArea = d.bounds;
147
+
148
+ CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displayID);
149
+ if (mode) {
150
+ d.currentMode.width = CGDisplayModeGetWidth(mode);
151
+ d.currentMode.height = CGDisplayModeGetHeight(mode);
152
+ d.currentMode.refreshRate = CGDisplayModeGetRefreshRate(mode);
153
+ CGDisplayModeRelease(mode);
154
+ }
155
+
156
+ d.scaleFactor = 1.0; // TODO: Get backing scale factor
157
+ d.isConnected = true;
158
+
159
+ pImpl->displays.push_back(d);
160
+ }
161
+ #else
162
+ pImpl->displays.clear();
163
+ GdkDisplay *display = gdk_display_get_default();
164
+ if (display) {
165
+ int n = gdk_display_get_n_monitors(display);
166
+ for (int i = 0; i < n; i++) {
167
+ GdkMonitor *monitor = gdk_display_get_monitor(display, i);
168
+ GdkRectangle rect;
169
+ gdk_monitor_get_geometry(monitor, &rect);
170
+
171
+ Display d;
172
+ d.id = i;
173
+ d.isPrimary = gdk_monitor_is_primary(monitor);
174
+ d.bounds.x = rect.x;
175
+ d.bounds.y = rect.y;
176
+ d.bounds.width = rect.width;
177
+ d.bounds.height = rect.height;
178
+ d.resolution.width = rect.width;
179
+ d.resolution.height = rect.height;
180
+
181
+ gdk_monitor_get_workarea(monitor, &rect);
182
+ d.workArea.x = rect.x;
183
+ d.workArea.y = rect.y;
184
+ d.workArea.width = rect.width;
185
+ d.workArea.height = rect.height;
186
+
187
+ d.scaleFactor = gdk_monitor_get_scale_factor(monitor);
188
+ d.isConnected = true;
189
+ pImpl->displays.push_back(d);
190
+ }
191
+ }
192
+ #endif
193
+ return pImpl->displays;
194
+ }
195
+
196
+ void DisplayManager::refresh() { getAllDisplays(); }
197
+
198
+ void DisplayManager::onDisplayConnected(
199
+ std::function<void(const Display &)> callback) {
200
+ pImpl->onConnectCallback = callback;
201
+ }
202
+
203
+ void DisplayManager::onDisplayDisconnected(std::function<void(int)> callback) {
204
+ pImpl->onDisconnectCallback = callback;
205
+ }
206
+
207
+ void DisplayManager::onDisplayChanged(
208
+ std::function<void(const Display &)> callback) {
209
+ pImpl->onChangeCallback = callback;
210
+ }
211
+
212
+ } // namespace plusui