-
Notifications
You must be signed in to change notification settings - Fork 186
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
Pr 06 unidirectional maximization support #2597
Open
CarloWood
wants to merge
7
commits into
WayfireWM:master
Choose a base branch
from
CarloWood:PR_06_unidirectional_maximization_support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Pr 06 unidirectional maximization support #2597
CarloWood
wants to merge
7
commits into
WayfireWM:master
from
CarloWood:PR_06_unidirectional_maximization_support
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This member is not used anywhere.
wf::rectangle_t is another way to represent a geometry_t but much easier and cleaner to manipulate when it comes to moving edges. wf::rectangle_t and geometry_t seamless convert into eachother and are as such interchangable. wf::geometry_difference_t replaces decoration_margins_t, but now represented as simply the mathematical difference between two geometry_t/rectangle_t's without claiming to have anything to do with decorations (hence that it goes into geometry.hpp). Provided are functions to subtract two geometry_t's, as well as add or subtract a geometry_difference_t to/from a geometry_t. It is also possible to negate a geometry_difference_t. Finally, there are several functions to conditionally act upon a geometry_t/rectangle_t on a per-edge basis: expand_geometry_if, geometry_switch_if and geometry_difference_t::subtract_if.
TILED_EDGES_* are now stored in src/api/wayfire/maximization.hpp class maximization_t is a wrapper around a unsigned char, representing two booleans (as bits): maximized vertically and/or horizontally. toplevel_state_t, which stores tiled_edges that still had to fully represent the maximization state, has been given operators and accessors to seamlessly work with maximization_t types from the outside, while only storing a uint32_t tiled_edges internally. expand_geometry_by_margins and shrink_geometry_by_margins can now be used conditionally - they are basically the same as expand_geometry_if, but kept for legacy (API) reasons. Then the hard part: everywhere where before `tiled_edges` was used as a boolean, where zero meant not-maximized, and non-zero meant fully-maximized, this commit either fixes that code to deal properly with unidirectional maximization states, or adds a TODO comment that this still has to be added. I don't think I missed a place, despite the fact that the access to tiled_edges isn't encapsulated.
Uses the requested tiled_edges as well as the pending tiled_edges to know if we have to use, on a per edge basis, last_windowed (if going from maximized to unmaximized), current (if going from unmaximized to unmaximized) or workspace (if going from any to maximized).
dd2adce
to
2e91a85
Compare
…ce `wf::decor`. Because that's where they belong. Also moved wayfire_decoration itself there.
…NTALLY} Extend the enum for decoration actions to include maximizing vertically and/or horizontally.
…t al handle_pointer_button: Pass all mouse buttons to layout.handle_press_event, not just BTN_LEFT. If the returned action is DECORATION_ACTION_TOGGLE_MAXIMIZE, the user clicked on the maximize button. Then change the action to DECORATION_ACTION_TOGGLE_MAXIMIZE_VERTICALLY or DECORATION_ACTION_TOGGLE_MAXIMIZE_HORIZONTALLY if the button used was BTN_MIDDLE or BTN_RIGHT respectively, before passing it on to handle_action. In all other cases just return if the pressed button wasn't BTN_LEFT, just like before. handle_action: Now also handle DECORATION_ACTION_TOGGLE_MAXIMIZE_VERTICALLY and DECORATION_ACTION_TOGGLE_MAXIMIZE_HORIZONTALLY and set the bits of tiled_edges accordingly, before calling default_wm->tile_request.
At this point the mouse button clicks on the maximize button are passed correctly to tile_request. It is almost surprising that after this the decoration plugin already seems to work; as nothing was changed to make it deal with unidirectional maximization internally (I had expected it to be completely confused and -say- draw the window fully maximized even if it is only partially maximized!). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 works, together with changes already made to pixdecor. Aka, it is tested. But on its own it should do precisely nothing: have no effect at all (aka, still compile everything as before and still behave in the same way), short from UB as a result of plugins not following the correct meaning of TILED_EDGES_* - because now each bit is actually treated as how to treat that edge.