1- #include < android/native_window.h>
21#include < android/log.h>
2+ #include < android/native_window.h>
33#include < iostream>
44#include " ../../window.h"
55#include " ../../window_manager.h"
@@ -20,25 +20,26 @@ class Window::Impl {
2020
2121Window::Window () : pimpl_(std::make_unique<Impl>(nullptr )) {}
2222
23- Window::Window (void * window) : pimpl_(std::make_unique<Impl>(static_cast <ANativeWindow*>(window))) {}
23+ Window::Window (void * window)
24+ : pimpl_(std::make_unique<Impl>(static_cast <ANativeWindow*>(window))) {}
2425
2526Window::~Window () {}
2627
2728WindowId Window::GetId () const {
2829 if (!pimpl_->native_window_ ) {
2930 return IdAllocator::kInvalidId ;
3031 }
31-
32+
3233 // Store the allocated ID in a static map to ensure consistency
3334 static std::unordered_map<ANativeWindow*, WindowId> window_id_map;
3435 static std::mutex map_mutex;
35-
36+
3637 std::lock_guard<std::mutex> lock (map_mutex);
3738 auto it = window_id_map.find (pimpl_->native_window_ );
3839 if (it != window_id_map.end ()) {
3940 return it->second ;
4041 }
41-
42+
4243 // Allocate new ID using the IdAllocator
4344 WindowId new_id = IdAllocator::Allocate<Window>();
4445 if (new_id != IdAllocator::kInvalidId ) {
@@ -142,8 +143,8 @@ bool Window::IsFullScreen() const {
142143
143144void Window::SetBounds (Rectangle bounds) {
144145 if (pimpl_->native_window_ ) {
145- ALOGI (" SetBounds called: x=%f, y=%f, w=%f, h=%f" ,
146- bounds.x , bounds. y , bounds. width , bounds. height );
146+ ALOGI (" SetBounds called: x=%f, y=%f, w=%f, h=%f" , bounds. x , bounds. y , bounds. width ,
147+ bounds.height );
147148 // Android windows resize is handled by the system
148149 }
149150}
@@ -152,11 +153,11 @@ Rectangle Window::GetBounds() const {
152153 if (!pimpl_->native_window_ ) {
153154 return Rectangle{0.0 , 0.0 , 0.0 , 0.0 };
154155 }
155-
156+
156157 // Get window dimensions from ANativeWindow
157158 int32_t width = ANativeWindow_getWidth (pimpl_->native_window_ );
158159 int32_t height = ANativeWindow_getHeight (pimpl_->native_window_ );
159-
160+
160161 return Rectangle{0.0 , 0.0 , static_cast <double >(width), static_cast <double >(height)};
161162}
162163
@@ -171,10 +172,10 @@ Size Window::GetSize() const {
171172 if (!pimpl_->native_window_ ) {
172173 return Size{0.0 , 0.0 };
173174 }
174-
175+
175176 int32_t width = ANativeWindow_getWidth (pimpl_->native_window_ );
176177 int32_t height = ANativeWindow_getHeight (pimpl_->native_window_ );
177-
178+
178179 return Size{static_cast <double >(width), static_cast <double >(height)};
179180}
180181
@@ -328,4 +329,3 @@ void* Window::GetNativeObjectInternal() const {
328329}
329330
330331} // namespace nativeapi
331-
0 commit comments