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(awful: layouts: tile: mouse_resize_handler): count the size of useless_gaps around the client (fixes #424) #3846

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions lib/awful/layout/suit/tile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
local function mouse_resize_handler(c, _, _, _, orientation)
orientation = orientation or "tile"
local wa = c.screen.workarea
local mwfact = c.screen.selected_tag.master_width_factor
local t = c.screen.selected_tag
local useless_gap = t.gap
local mwfact = t.master_width_factor
Comment on lines +52 to +54
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether this is correct. What happens when the user selects multiple tags?

As a possible fix, we could add a params parameter like the one for arrange().

Copy link
Member Author

@actionless actionless Aug 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's existing code, see the prev lines of the diff - i've just assigned it to the variable to avoid writing c.screen..... twice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

answering your question - having two tags (with different params) selected in awesome i think not documented behavior, but i think everywhere it defaults to params of the first (by idx) of selected tags - although this PR is not the best place to discuss that behavior

local cursor
local g = c:geometry()
local offset = 0
Expand All @@ -58,37 +60,37 @@

if orientation == "tile" then
cursor = "cross"
if g.height+15 > wa.height then
if g.height+useless_gap+15 > wa.height then
offset = g.height * .5
cursor = "sb_h_double_arrow"
elseif g.y+g.height+15 <= wa.y+wa.height then
elseif g.y+g.height+useless_gap+15 <= wa.y+wa.height then

Check warning on line 66 in lib/awful/layout/suit/tile.lua

View check run for this annotation

Codecov / codecov/patch

lib/awful/layout/suit/tile.lua#L66

Added line #L66 was not covered by tests
offset = g.height
end
corner_coords = { x = wa.x + wa.width * mwfact, y = g.y + offset }
elseif orientation == "left" then
cursor = "cross"
if g.height+15 >= wa.height then
if g.height+useless_gap+15 >= wa.height then

Check warning on line 72 in lib/awful/layout/suit/tile.lua

View check run for this annotation

Codecov / codecov/patch

lib/awful/layout/suit/tile.lua#L72

Added line #L72 was not covered by tests
offset = g.height * .5
cursor = "sb_h_double_arrow"
elseif g.y+g.height+15 <= wa.y+wa.height then
elseif g.y+useless_gap+g.height+15 <= wa.y+wa.height then

Check warning on line 75 in lib/awful/layout/suit/tile.lua

View check run for this annotation

Codecov / codecov/patch

lib/awful/layout/suit/tile.lua#L75

Added line #L75 was not covered by tests
offset = g.height
end
corner_coords = { x = wa.x + wa.width * (1 - mwfact), y = g.y + offset }
elseif orientation == "bottom" then
cursor = "cross"
if g.width+15 >= wa.width then
if g.width+useless_gap+15 >= wa.width then

Check warning on line 81 in lib/awful/layout/suit/tile.lua

View check run for this annotation

Codecov / codecov/patch

lib/awful/layout/suit/tile.lua#L81

Added line #L81 was not covered by tests
offset = g.width * .5
cursor = "sb_v_double_arrow"
elseif g.x+g.width+15 <= wa.x+wa.width then
elseif g.x+g.width+useless_gap+15 <= wa.x+wa.width then

Check warning on line 84 in lib/awful/layout/suit/tile.lua

View check run for this annotation

Codecov / codecov/patch

lib/awful/layout/suit/tile.lua#L84

Added line #L84 was not covered by tests
offset = g.width
end
corner_coords = { y = wa.y + wa.height * mwfact, x = g.x + offset}
else
cursor = "cross"
if g.width+15 >= wa.width then
if g.width+useless_gap+15 >= wa.width then

Check warning on line 90 in lib/awful/layout/suit/tile.lua

View check run for this annotation

Codecov / codecov/patch

lib/awful/layout/suit/tile.lua#L90

Added line #L90 was not covered by tests
offset = g.width * .5
cursor = "sb_v_double_arrow"
elseif g.x+g.width+15 <= wa.x+wa.width then
elseif g.x+g.width+useless_gap+15 <= wa.x+wa.width then

Check warning on line 93 in lib/awful/layout/suit/tile.lua

View check run for this annotation

Codecov / codecov/patch

lib/awful/layout/suit/tile.lua#L93

Added line #L93 was not covered by tests
offset = g.width
end
corner_coords = { y = wa.y + wa.height * (1 - mwfact), x= g.x + offset }
Expand Down Expand Up @@ -122,13 +124,13 @@
-- client where we have to use different settings.
local wfact
local wfact_x, wfact_y
if (geom.y+geom.height+15) > (wa.y+wa.height) then
if (geom.y+geom.height+useless_gap+15) > (wa.y+wa.height) then

Check warning on line 127 in lib/awful/layout/suit/tile.lua

View check run for this annotation

Codecov / codecov/patch

lib/awful/layout/suit/tile.lua#L127

Added line #L127 was not covered by tests
wfact_y = (geom.y + geom.height - coords.y) / wa.height
else
wfact_y = (coords.y - geom.y) / wa.height
end

if (geom.x+geom.width+15) > (wa.x+wa.width) then
if (geom.x+geom.width+useless_gap+15) > (wa.x+wa.width) then

Check warning on line 133 in lib/awful/layout/suit/tile.lua

View check run for this annotation

Codecov / codecov/patch

lib/awful/layout/suit/tile.lua#L133

Added line #L133 was not covered by tests
wfact_x = (geom.x + geom.width - coords.x) / wa.width
else
wfact_x = (coords.x - geom.x) / wa.width
Expand All @@ -155,7 +157,7 @@
return true
end
end
return prev_coords.x == coords.x and prev_coords.y == coords.y
return (prev_coords.x == coords.x) and (prev_coords.y == coords.y)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

end, cursor)
end

Expand Down
Loading