-
Notifications
You must be signed in to change notification settings - Fork 946
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
Allow changing resize increments after window creation #2411
Allow changing resize increments after window creation #2411
Conversation
Still marked as a draft because I did not test this on a mac yet, if you have a mac and are willing to test this you are welcome |
I could test macOs, but not soon. Maybe @madsmtm could check. |
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 the PR, looks good and seems to work fine barring a few things
Ok so I guess @madsmtm tested this on a mac so I'm undrafting this. |
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.
Works flawlessly on macOS now, thanks!
Hey @kchibisov have you had a chance to see my reply to your comments about logging on unsupported platforms? Do you insist on adding those logs or does my reasoning make sense to keep it as I did it initially |
@necauqua the thing is that |
@@ -386,7 +386,7 @@ impl UnownedWindow { | |||
normal_hints.set_min_size(min_inner_size.map(Into::into)); | |||
normal_hints.set_max_size(max_inner_size.map(Into::into)); | |||
normal_hints.set_resize_increments( | |||
pl_attribs | |||
window_attrs | |||
.resize_increments | |||
.map(|size| size.to_physical::<u32>(scale_factor).into()), |
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's no need for map given that function handles that or the scaling is wrong when calling the set_resize_increments
here? Could you add a comment about that at least? I do understand that the code was like that before, but it would be nice to ensure that and remove extra convertion, since it looks confusing.
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.
You might be confused by the two lines above which look like normal_hints.set_max_size(max_inner_size.map(Into::into));
- but in fact I modelled resize_incremets
exactly like min/max_inner_size.
In those lines above e.g. the min_inner_size
is is defined as let mut min_inner_size = window_attrs.min_inner_size.map(|size| size.to_physical::<u32>(scale_factor))
, it just needs to be a mut local to update it for the ability to make windows unresizable.
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'm not saying that the logic is wrong or anything. I'm trying to say that set_resize_increments
already does conversion to physical pixels with the scale_factor
so the logic seems redundant and you can pass resize_increments
directly?
There's a chance that I don't understand this code or scale factor isn't there.
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.
Here we call normal_hints.set_resize_increments
which just accepts a pair of i32s, physical, not window.set_resize_increments
which accepts the Size
enum and does the conversion - so that on window creation there is only one xconn.set_normal_hints
call to set all the initial hints at once.
Same with other normal_hints related things like position/size/min_size/max_size as I said
Ok then Maybe later some separate effort should be put in to update all these comments with log warnings (I'd personally also add a feature to disable that? or better a special log target(s) for those 'not implemented/unsupported' warnings) |
oh wow I dont think I've anything to do with those fails |
@@ -386,7 +386,7 @@ impl UnownedWindow { | |||
normal_hints.set_min_size(min_inner_size.map(Into::into)); | |||
normal_hints.set_max_size(max_inner_size.map(Into::into)); | |||
normal_hints.set_resize_increments( | |||
pl_attribs | |||
window_attrs | |||
.resize_increments | |||
.map(|size| size.to_physical::<u32>(scale_factor).into()), |
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'm not saying that the logic is wrong or anything. I'm trying to say that set_resize_increments
already does conversion to physical pixels with the scale_factor
so the logic seems redundant and you can pass resize_increments
directly?
There's a chance that I don't understand this code or scale factor isn't there.
Could you rebase. Should be good after that. |
Pretty basic "I hope it works" implementation, only tested on X11, can test on a mac in a few days.
Once this is reviewed->merged->released I hope to finally make Alacritty not suck, heh
The branch is based on the #2410 because I kept moving the test window to the other screen, I'll rebase once it's merged,doneCurrently this is a draft to run your CI and to get reviews.should be readyCloses #2020
CHANGELOG.md
if knowledge of this change could be valuable to users