[macOS] Implement WindowListener on WindowManager class #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a comprehensive WindowListener API for the WindowManager class, enabling applications to listen for various window lifecycle events. The implementation follows the existing event dispatcher pattern used throughout the library and provides full functionality on macOS with stub implementations for Windows and Linux platforms.
New Features
Window Event Types
The implementation introduces 9 new event types covering the complete window lifecycle:
WindowManager API Extensions
The WindowManager class now includes event dispatcher capabilities:
Platform Implementation
macOS (Complete Implementation)
The macOS implementation uses NSNotificationCenter to monitor NSWindow events:
Windows & Linux (Stub Implementation)
Provides stub implementations that maintain API compatibility while allowing for future platform-specific development. The stub implementations include:
Implementation Details
The implementation carefully follows existing library patterns:
Missing Destroy Method
As part of this implementation, the missing
Destroy
method was added to all platform implementations of WindowManager, providing complete API coverage.Documentation & Examples
docs/WindowListener.md
examples/window_listener_test/
demonstrating both callback and object-based listenersThis implementation provides a solid foundation for window event handling across platforms while maintaining the library's existing architectural patterns and coding standards.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.