Skip to content

Commit b707e2c

Browse files
Copilotlijy91
andauthored
Fix Windows compilation errors in platform-specific code (#21)
* Initial plan * Fix PIMPL naming and const correctness in Windows platform code Co-authored-by: lijy91 <[email protected]> * Fix PIMPL class naming and add missing library pragmas for Windows Co-authored-by: lijy91 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: lijy91 <[email protected]>
1 parent 2b82084 commit b707e2c

File tree

7 files changed

+26
-16
lines changed

7 files changed

+26
-16
lines changed

src/platform/windows/accessibility_manager_windows.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <windows.h>
44
#include <oleacc.h>
55

6+
#pragma comment(lib, "oleacc.lib")
7+
68
namespace nativeapi {
79

810
void AccessibilityManager::Enable() {

src/platform/windows/tray_icon_windows.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include <string>
66
#include <vector>
77
#include <memory>
8+
9+
#pragma comment(lib, "shell32.lib")
10+
811
#include "../../tray_icon.h"
912
#include "../../menu.h"
1013
#include "../../tray_icon_event.h"

src/platform/windows/tray_manager_windows.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <memory>
44
#include <mutex>
55

6+
#pragma comment(lib, "shell32.lib")
7+
68
#include "../../tray_icon.h"
79
#include "../../tray_manager.h"
810

src/platform/windows/tray_windows.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include <string>
66
#include <vector>
77
#include <memory>
8+
9+
#pragma comment(lib, "shell32.lib")
10+
811
#include "../../tray.h"
912
#include "../../menu.h"
1013

src/platform/windows/window_manager_windows.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
namespace nativeapi {
1313

1414
// Private implementation for Windows (stub for now)
15-
class WindowManager::WindowManagerImpl {
15+
class WindowManager::Impl {
1616
public:
17-
WindowManagerImpl(WindowManager* manager) : manager_(manager) {}
18-
~WindowManagerImpl() {}
17+
Impl(WindowManager* manager) : manager_(manager) {}
18+
~Impl() {}
1919

2020
void SetupEventMonitoring() {
2121
// TODO: Implement Windows-specific event monitoring
@@ -29,7 +29,7 @@ class WindowManager::WindowManagerImpl {
2929
WindowManager* manager_;
3030
};
3131

32-
WindowManager::WindowManager() : impl_(std::make_unique<WindowManagerImpl>(this)) {
32+
WindowManager::WindowManager() : pimpl_(std::make_unique<Impl>(this)) {
3333
SetupEventMonitoring();
3434
}
3535

@@ -38,11 +38,11 @@ WindowManager::~WindowManager() {
3838
}
3939

4040
void WindowManager::SetupEventMonitoring() {
41-
impl_->SetupEventMonitoring();
41+
pimpl_->SetupEventMonitoring();
4242
}
4343

4444
void WindowManager::CleanupEventMonitoring() {
45-
impl_->CleanupEventMonitoring();
45+
pimpl_->CleanupEventMonitoring();
4646
}
4747

4848
void WindowManager::DispatchWindowEvent(const Event& event) {

src/platform/windows/window_windows.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ void Window::SetMinimumSize(Size size) {
272272
// This is a placeholder implementation
273273
}
274274

275-
Size Window::GetMinimumSize() {
275+
Size Window::GetMinimumSize() const {
276276
// Placeholder implementation
277277
return Size{0, 0};
278278
}
@@ -282,7 +282,7 @@ void Window::SetMaximumSize(Size size) {
282282
// This is a placeholder implementation
283283
}
284284

285-
Size Window::GetMaximumSize() {
285+
Size Window::GetMaximumSize() const {
286286
// Placeholder implementation
287287
return Size{0, 0};
288288
}
@@ -409,7 +409,7 @@ void Window::SetAlwaysOnTop(bool is_always_on_top) {
409409
}
410410
}
411411

412-
bool Window::IsAlwaysOnTop() {
412+
bool Window::IsAlwaysOnTop() const {
413413
if (pimpl_->hwnd_) {
414414
LONG_PTR exStyle = GetWindowLongPtr(pimpl_->hwnd_, GWL_EXSTYLE);
415415
return (exStyle & WS_EX_TOPMOST) != 0;
@@ -425,7 +425,7 @@ void Window::SetPosition(Point point) {
425425
}
426426
}
427427

428-
Point Window::GetPosition() {
428+
Point Window::GetPosition() const {
429429
Point point = {0, 0};
430430

431431
if (pimpl_->hwnd_) {
@@ -446,7 +446,7 @@ void Window::SetTitle(std::string title) {
446446
}
447447
}
448448

449-
std::string Window::GetTitle() {
449+
std::string Window::GetTitle() const {
450450
if (pimpl_->hwnd_) {
451451
int length = GetWindowTextLength(pimpl_->hwnd_);
452452
if (length > 0) {

src/window.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ class Window {
5252
void SetContentSize(Size size);
5353
Size GetContentSize() const;
5454
void SetMinimumSize(Size size);
55-
Size GetMinimumSize();
55+
Size GetMinimumSize() const;
5656
void SetMaximumSize(Size size);
57-
Size GetMaximumSize();
57+
Size GetMaximumSize() const;
5858
void SetResizable(bool is_resizable);
5959
bool IsResizable() const;
6060
void SetMovable(bool is_movable);
@@ -68,11 +68,11 @@ class Window {
6868
void SetClosable(bool is_closable);
6969
bool IsClosable() const;
7070
void SetAlwaysOnTop(bool is_always_on_top);
71-
bool IsAlwaysOnTop();
71+
bool IsAlwaysOnTop() const;
7272
void SetPosition(Point point);
73-
Point GetPosition();
73+
Point GetPosition() const;
7474
void SetTitle(std::string title);
75-
std::string GetTitle();
75+
std::string GetTitle() const;
7676
void SetHasShadow(bool has_shadow);
7777
bool HasShadow() const;
7878
void SetOpacity(float opacity);

0 commit comments

Comments
 (0)