Skip to content

Commit dda7f22

Browse files
committed
Add CallOriginalShow/Hide stubs for platform window managers
Implements CallOriginalShow and CallOriginalHide methods for Android, iOS, and OpenHarmony window managers. These methods return false to indicate that swizzling for window show/hide is not supported on these platforms.
1 parent 0c8eb10 commit dda7f22

File tree

5 files changed

+42
-6
lines changed

5 files changed

+42
-6
lines changed

src/platform/android/window_manager_android.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ void WindowManager::HandleWillHide(WindowId id) {
130130
// Empty implementation
131131
}
132132

133+
bool WindowManager::CallOriginalShow(WindowId id) {
134+
// Android doesn't support swizzling for window show/hide
135+
// Return false to indicate unsupported
136+
return false;
137+
}
138+
139+
bool WindowManager::CallOriginalHide(WindowId id) {
140+
// Android doesn't support swizzling for window show/hide
141+
// Return false to indicate unsupported
142+
return false;
143+
}
144+
133145
void WindowManager::StartEventListening() {
134146
pimpl_->StartEventListening();
135147
}

src/platform/ios/window_manager_ios.mm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@
6161
// Empty implementation
6262
}
6363

64+
bool WindowManager::CallOriginalShow(WindowId id) {
65+
// iOS doesn't support swizzling for window show/hide
66+
// Return false to indicate unsupported
67+
return false;
68+
}
69+
70+
bool WindowManager::CallOriginalHide(WindowId id) {
71+
// iOS doesn't support swizzling for window show/hide
72+
// Return false to indicate unsupported
73+
return false;
74+
}
75+
6476
void WindowManager::StartEventListening() {
6577
// iOS manages window events through UIKit
6678
}

src/platform/ohos/window_manager_ohos.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ void WindowManager::HandleWillHide(WindowId id) {
126126
// Empty implementation
127127
}
128128

129+
bool WindowManager::CallOriginalShow(WindowId id) {
130+
// OpenHarmony doesn't support swizzling for window show/hide
131+
// Return false to indicate unsupported
132+
return false;
133+
}
134+
135+
bool WindowManager::CallOriginalHide(WindowId id) {
136+
// OpenHarmony doesn't support swizzling for window show/hide
137+
// Return false to indicate unsupported
138+
return false;
139+
}
140+
129141
void WindowManager::StartEventListening() {
130142
pimpl_->StartEventListening();
131143
}

src/platform/windows/window_manager_windows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static WindowId GetWindowIdFromHwnd(HWND hwnd) {
2424
}
2525

2626
// First, try to get window ID from HWND's custom property
27-
HANDLE prop_handle = GetProp(hwnd, kWindowIdProperty);
27+
HANDLE prop_handle = GetPropW(hwnd, kWindowIdProperty);
2828
if (prop_handle) {
2929
WindowId window_id = static_cast<WindowId>(reinterpret_cast<uintptr_t>(prop_handle));
3030
if (window_id != IdAllocator::kInvalidId && window_id != 0) {

src/platform/windows/window_windows.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
3131
WINDOWPOS* pos = reinterpret_cast<WINDOWPOS*>(lParam);
3232
if (pos) {
3333
// Get window ID from window's custom property (stored during window creation)
34-
HANDLE prop_handle = GetProp(hwnd, kWindowIdProperty);
34+
HANDLE prop_handle = GetPropW(hwnd, kWindowIdProperty);
3535
if (prop_handle) {
3636
WindowId window_id = static_cast<WindowId>(reinterpret_cast<uintptr_t>(prop_handle));
3737
if (window_id != IdAllocator::kInvalidId) {
@@ -129,7 +129,7 @@ Window::Window() {
129129
}
130130

131131
// Store window ID as a custom property in HWND for easy retrieval in WindowProc
132-
SetProp(hwnd, kWindowIdProperty, reinterpret_cast<HANDLE>(static_cast<uintptr_t>(id)));
132+
SetPropW(hwnd, kWindowIdProperty, reinterpret_cast<HANDLE>(static_cast<uintptr_t>(id)));
133133

134134
// Create the instance with allocated ID
135135
pimpl_ = std::make_unique<Impl>(hwnd, id);
@@ -149,7 +149,7 @@ Window::Window(void* native_window) {
149149
}
150150

151151
// Check if window already has an ID stored as a custom property
152-
HANDLE prop_handle = GetProp(hwnd, kWindowIdProperty);
152+
HANDLE prop_handle = GetPropW(hwnd, kWindowIdProperty);
153153
WindowId id = IdAllocator::kInvalidId;
154154

155155
if (prop_handle) {
@@ -165,7 +165,7 @@ Window::Window(void* native_window) {
165165
return;
166166
}
167167
// Store the ID as a custom property in HWND
168-
SetProp(hwnd, kWindowIdProperty, reinterpret_cast<HANDLE>(static_cast<uintptr_t>(id)));
168+
SetPropW(hwnd, kWindowIdProperty, reinterpret_cast<HANDLE>(static_cast<uintptr_t>(id)));
169169
}
170170

171171
pimpl_ = std::make_unique<Impl>(hwnd, id);
@@ -181,7 +181,7 @@ Window::~Window() {
181181

182182
// Remove the custom property from HWND if window is still valid
183183
if (pimpl_->hwnd_) {
184-
RemoveProp(pimpl_->hwnd_, kWindowIdProperty);
184+
RemovePropW(pimpl_->hwnd_, kWindowIdProperty);
185185
}
186186
}
187187
}

0 commit comments

Comments
 (0)