-
-
Notifications
You must be signed in to change notification settings - Fork 77
ShellClients: Better separation of concern #2575
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
1afaa18 to
00da2f0
Compare
| x = monitor_geom.x + (monitor_geom.width - window_rect.width) / 2; | ||
| y = monitor_geom.y; | ||
| break; | ||
| var monitor_rect = window.display.get_monitor_geometry (window.display.get_primary_monitor ()); |
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.
Shouldn't we use window monitor here?
| var monitor_rect = window.display.get_monitor_geometry (window.display.get_primary_monitor ()); | |
| var monitor_rect = window.display.get_monitor_geometry (window.get_monitor ()); |
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.
For panels we definitely want the primary monitor so that they actually are on it. For centered windows idk but ig it's better if they stay on the monitor they are started on. Therefore I changed it to not give the monitor geom as argument so that the implementations are responsible for choosing the correct one (currently primary for panels and the windows' for centered).
Move things that only apply to PanelWindows there. Also rely on subclasses to provide a GestureTarget for property updates instead of trying to handle all cases. This cleans up a lot of code that was necessary to handle the stuff needed by all subclass. This makes sure we only update things when actually needed. For example ExtendedBehaviorWindows never need to update their target. This will also provide more flexibility in the future if we want to introduce other specialized windows. This also allows to change more stuff in subclasses without affecting other subclasses.
Instead of an enum based on which the position is calculated, introduce an abstract method that should be overridden by subclasses for position calculation. This introduces more flexibility in the future while reducing code complexity.
00da2f0 to
9913b3c
Compare
|
Oops, I forgot to rebase. Sorry! |
Instead of trying to handle everything a subclass could want in PositionedWindow/ShellWindow only provide a framework that all subclasses need and let them handle their specificity.
This includes having subclasses provide a gesture target for how they want to handle hiding instead of setting it based on position.
This also includes removing the position enum and introducing an abstract method for position calculation.
All in all this reduces code complexity and makes it easier to change things for one subclass without risking to introduce regressions for others.
This also provides more flexibility in the future. Most notably I wanted to do this before finishing #1974 because there I wanted to introduce a ExtendedBehavior subclass anyways. Other things include monitor labels and maybe even notifications which will all be easier to handle this way.
See the individual commits for easier review