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
1412 bspwm resize #4955
base: next
Are you sure you want to change the base?
1412 bspwm resize #4955
Conversation
* **Two-axis tiling resize**. You can drag a 24-pixel window corner (purple) to perform a two-axis resize. Also, you can press Mod and drag a large corner inside the window (one-third of the window size). ![illustration](https://user-images.githubusercontent.com/5121426/75146543-40a7c580-56f3-11ea-9b26-e14718699323.png) * **Live resize**: the tree is rendered during the resize process. * You can still press **ESC to cancel** resizing and revert to the old state. * Introduced the concept of the **minimum container size**. E.g. the minimum width of leaf con with 10px borders is 21px (left border + right border + at least 1px for the window itself). The minimum size is defined recursively, e.g. the minimum height of the vsplit is the sum of minimum sizes of its children. The reason for this change: the live resize made it very easy to shrink containers as small as possible, so some restraints are required. * ~Misc update: ignore the drag if i3 can't perform the resize. Suppose the user tries to resize the rightmost window to the right using Mod+RMB drag. Obliviously, i3 can't do this. Before this PR, the drag has been propagated to the application (some apps would show a context menu). After this PR, the drag would be ignored at all (and the cursor would be shown as ✕). The reasoning behind this change: the user explicitly indicated their desire to resize the window by pressing the Mod key, and probably just miss clicked to the wrong part of the window.~ Done in [93e96f4](i3@93e96f4). * Bugfix in `tiling_resize()`: you can now resize the window with pixel border by dragging the top border.
Same fix as in this commit from 2020 that was previously mentioned in the PR discussion. i3@93e96f4
/* Accumulate minimum size of the con based on child->min_size. | ||
* We may use child->min_size only after calling render_con(child). | ||
* | ||
* TODO: this isn't perfect as it fails to handle some corner cases, |
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.
Can you please investigate if the discussion in #3545 (comment) applies?
I'd rather not introduce less-than-optimal behaviour.
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.
Thanks for your review!
These corner cases are not unique and new to this pr. I tried them with a upstream i3 on v 4.19.2 and there you can resize the bottom window even through the stacked titles.
also upstream with titlebar for the bottom tile you will see it disappear:
So these are not issues created by this pull request.
xzfc comment pointed to this edge case as well:
but as I verified it not being caused by this implementation it's fine for now.
Maybe there's some better way in the future to calculate the minimum size in the future.
The way the minimum size is calculated in this version does stop the bottom tile from moving more than one decoration through the stacked top ones. So it's at least a little improvement.
I work with this forked version for some days now and did not find any problems with it yet.
@@ -131,6 +139,33 @@ void render_con(Con *con) { | |||
child->rect.x, child->rect.y, child->rect.width, child->rect.height); | |||
x_raise_con(child); | |||
render_con(child); | |||
|
|||
/* Accumulate minimum size of the con based on child->min_size. |
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.
If fixing #3544 is needed for this feature (ref: #3545 (comment)) I would also prefer to extract the necessary bug fixes in a separate PR.
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.
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.
I think the comment was before this PR by the same person.
Thanks for your comments! I'll have to look into them. I clearly am no developer but trying my best to understand how this could work out. 😅 Contributors are welcome. I guess that'll would mean inviting some people to this fork if there is anyone willing to try. :) |
I was waiting on feedback what has to be done to get this merged. I think I replied to everything. |
Btw, I'm using this forked branch on 4.14 since a year now in virtual machines without any issues. |
Apologies for closing. This branch does seem to have significant conflicts with |
Trying to rebase and fix @xzfc pull request #3545
original message:
bspwm-like tiling resize
Two-axis tiling resize. You can drag a 24-pixel window corner (purple) to perform a two-axis resize. Also, you can press Mod and drag a large corner inside the window (one-third of the window size).
Live resize: the tree is rendered during the resize process.
You can still press ESC to cancel resizing and revert to the old state.
Introduced the concept of the minimum container size. E.g. the minimum width of leaf con with 10px borders is 21px (left border + right border + at least 1px for the window itself). The minimum size is defined recursively, e.g. the minimum height of the vsplit is the sum of minimum sizes of its children. The reason for this change: the live resize made it very easy to shrink containers as small as possible, so some restraints are required.
Misc update: ignore the drag if i3 can't perform the resize. Suppose the user tries to resize the rightmost window to the right using Mod+RMB drag. Obliviously, i3 can't do this. Before this PR, the drag has been propagated to the application (some apps would show a context menu). After this PR, the drag would be ignored at all (and the cursor would be shown as ✕). The reasoning behind this change: the user explicitly indicated their desire to resize the window by pressing the Mod key, and probably just miss clicked to the wrong part of the window.Done in 93e96f4.Bugfix in
tiling_resize()
: you can now resize the window with pixel border by dragging the top border.