Skip to content

Conversation

@leolost2605
Copy link
Member

@leolost2605 leolost2605 commented Oct 13, 2025

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

@leolost2605 leolost2605 changed the title ShellWindow: Only handle common code ShellClients: Better separation of concern Oct 13, 2025
@leolost2605 leolost2605 force-pushed the leolost/separate-shell-window branch 3 times, most recently from 1afaa18 to 00da2f0 Compare October 14, 2025 10:12
@leolost2605 leolost2605 marked this pull request as ready for review October 14, 2025 10:19
@leolost2605 leolost2605 requested a review from a team October 14, 2025 10:19
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 ());
Copy link
Member

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?

Suggested change
var monitor_rect = window.display.get_monitor_geometry (window.display.get_primary_monitor ());
var monitor_rect = window.display.get_monitor_geometry (window.get_monitor ());

Copy link
Member Author

@leolost2605 leolost2605 Oct 15, 2025

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.
@leolost2605 leolost2605 force-pushed the leolost/separate-shell-window branch from 00da2f0 to 9913b3c Compare October 15, 2025 14:34
@leolost2605 leolost2605 requested a review from lenemter October 15, 2025 14:37
@lenemter lenemter merged commit 7e97727 into main Oct 15, 2025
6 checks passed
@lenemter lenemter deleted the leolost/separate-shell-window branch October 15, 2025 14:44
@lenemter
Copy link
Member

Oops, I forgot to rebase. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants