-
Notifications
You must be signed in to change notification settings - Fork 121
Refactor MinimalWindowManager for better specialization #4666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
…version to 5.7 Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
|
These new symbols also need adding to symbols.map and libmiral.symbols |
|
Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
|
@copilot please add some tests for this change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors MinimalWindowManager to enable better specialization by subclasses. The changes add three new protected helper methods that expose the internal application_selector state management, allowing subclasses to customize window management behaviors (like implementing "sloppy focus") while maintaining proper application selector state.
Changes:
- Added three new protected helper methods for application selector state management
- Refactored existing
advise_*methods to delegate to the new helpers - Bumped MIRAL version from 5.6.0 to 5.7.0
- Updated symbol export files with new public symbols
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| include/miral/miral/minimal_window_manager.h | Declares three new protected helper methods with Doxygen documentation |
| src/miral/minimal_window_manager.cpp | Implements the new helper methods and refactors existing methods to use them |
| src/CMakeLists.txt | Increments MIRAL_VERSION_MINOR from 6 to 7 |
| debian/libmiral7.symbols | Adds new symbols under MIRAL_5.7 version |
Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
Added tests in commit b93dd14. The tests verify:
|
| custom_wm = new CustomMinimalWindowManager(tools, focus_stealing()); | ||
| return std::unique_ptr<miral::WindowManagementPolicy>(custom_wm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please don't use raw new - we have had make_unique since C++14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 973b218. Changed to use std::make_unique and capture the raw pointer with .get().
Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
Related: Issue describing difficulty in specializing MinimalWindowManager
What's new?
Added three new protected helper methods to
MinimalWindowManagerthat allow subclasses to interact with the internalapplication_selectorstate. This enables subclasses to customize window management behavior (such as implementing "sloppy focus") while maintaining proper application selector state.application_selector_advise_focus_gained(),application_selector_advise_focus_lost(), andapplication_selector_advise_delete_window()as protected non-virtual methodsadvise_focus_gained(),advise_focus_lost(), andadvise_delete_window()to call the new helper methodssrc/miral/symbols.mapunder MIRAL_5.7 section and todebian/libmiral7.symbolswith version 5.7.0std::make_unique)Example Usage
Subclasses can now override
advise_focus_gained()without callingtools.raise_tree()(for sloppy focus behavior) while still maintaining the application selector state:How to test
CustomMinimalWindowManagerTest.application_selector_helpers_are_accessible_to_subclassesandCustomMinimalWindowManagerTest.sloppy_focus_does_not_raise_treeMinimalWindowManagerthat overridesadvise_focus_gained()and uses the newapplication_selector_advise_focus_gained()helper methodsrc/miral/symbols.mapanddebian/libmiral7.symbolsChecklist
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.