Skip to content
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

Fix wrong resize anchor point #23

Merged
merged 1 commit into from
May 1, 2020
Merged

Fix wrong resize anchor point #23

merged 1 commit into from
May 1, 2020

Conversation

1kjo
Copy link
Contributor

@1kjo 1kjo commented Apr 26, 2020

Previously, when dragging the left border of a window with the mouse,
it would "ignore the anchor point" and set the window's position
directly to the position of the mouse. This also affected the other
(right, top and bottom) borders.

I think that the previous resize code was hard to understand. Honestly I
have not spent a lot of time trying to understand why I didn't work and
I wrote another resize algorithm instead.

Now, during a resize, we store the anchor point (drag_x and drag_y)
inside the window and we use it to change the left, right, top and
bottom values that represent the window's rectangle. This is easier to
understand IMO.

Previously, when dragging the left border of a window with the mouse, there
was a bug where it would snap the top level surface's geometry X coordinate
directly to the position of the mouse, as if you started the resize right on the border. This also affected the other (right, bottom, and top) borders.

I think that the previous resize code was hard to understand. Honestly I
have not spent a lot of time trying to understand why t didn't work and
I wrote another resize algorithm instead. Now instead of working directly
with widths and heights which are complicated we work with the borders (left,
right, top and bottom). This is easier to understand IMO.
ddevault pushed a commit to swaywm/wlroots that referenced this pull request Apr 28, 2020
Previously, when dragging the left border of a window with the mouse in tinywl,
there was a bug where it snap the top level surface's geometry X coordinate
directly to the position of the mouse, as if you started the resize right on the
border. This also affected the other (right, top and bottom) borders.

I think that the previous resize code was hard to understand. Honestly I
have not spent a lot of time trying to understand why it didn't work and
I wrote another resize algorithm instead: now, instead of working directly
with widths and heights which are complicated, we work with the borders (left,
right, top, bottom). This is easier to understand IMO.

Note: I originally fixed this [in the waybox compositor](wizbright/waybox#23) but
then I realized that the code was taken from tinywl and that it had the same
issues so I copied my fix for tinywl.
@wizbright wizbright merged commit 9381189 into wizbright:master May 1, 2020
WillPower3309 pushed a commit to wlrfx/scenefx that referenced this pull request Jul 11, 2023
Previously, when dragging the left border of a window with the mouse in tinywl,
there was a bug where it snap the top level surface's geometry X coordinate
directly to the position of the mouse, as if you started the resize right on the
border. This also affected the other (right, top and bottom) borders.

I think that the previous resize code was hard to understand. Honestly I
have not spent a lot of time trying to understand why it didn't work and
I wrote another resize algorithm instead: now, instead of working directly
with widths and heights which are complicated, we work with the borders (left,
right, top, bottom). This is easier to understand IMO.

Note: I originally fixed this [in the waybox compositor](wizbright/waybox#23) but
then I realized that the code was taken from tinywl and that it had the same
issues so I copied my fix for tinywl.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants