Skip to content

Support resize increments #135

Closed
Closed

Description

@siiptuo

Basically this means restricting window size to multiples of some defined size. X11 and OS X provide this feature. Windows doesn't seem to have support for this but it could be emulated with additional code. Not sure about Wayland.

This feature is probably only useful for terminal emulators like Alacritty. So is it worth to be added to the library?

Activity

  1. tomaka commented on Feb 11, 2017

    @tomaka
    Contributor

    It should be possible already to set both the min and max dimensions to the same size.

  2. added
    S - api
    S - enhancement
    on Feb 11, 2017
  3. siiptuo commented on Feb 11, 2017

    @siiptuo
    ContributorAuthor

    At least for me, setting min and max dimensions to the same size simply creates an unresizable window. The desired behaviour would be the following: when increment size is for instance 20x10, allowed window sizes are 20x10, 40x10, 20x20, 40x20 etc.

  4. francesca64 commented on Apr 24, 2018

    @francesca64
    Member

    I'd be more inclined to add this to WinodwBuilderExt than to try to emulate the feature on Windows, since that sounds like it could get messy easily.

    Do you know if X11's resize increments actually work? It might sound like a silly question, but it wouldn't surprise me if WM support is poor.

  5. siiptuo commented on Apr 24, 2018

    @siiptuo
    ContributorAuthor

    I'm unable to find any list, but based on my experience, resize increments are set by many X11 terminal emulators and supported by many (stacking) window managers.

  6. francesca64 commented on Apr 25, 2018

    @francesca64
    Member

    Alright, thanks. This looks really easy to implement, so I can knock this out for both platforms after I finish the X11 refactor I'm working on.

  7. siiptuo commented on Apr 26, 2018

    @siiptuo
    ContributorAuthor

    Sound great!

    One related property that could also be supported is base size. It works something like this: window_width = base_width + x * width_inc. This is useful if the window has a toolbar or padding. Unfortunately only X11 seems to support it.

  8. francesca64 commented on Apr 30, 2018

    @francesca64
    Member

    X11 implementation on this branch: https://github.com/francesca64/winit/tree/x11-resize-inc

    I added with_resize_increments(width_inc: i32, height_inc: i32) and with_base_size(base_width: i32, base_height: i32) to WindowBuilderExt. If you don't specify base size, it defaults to the window dimensions.

  9. siiptuo commented on May 1, 2018

    @siiptuo
    ContributorAuthor

    Thanks! This works as it should.

    However base size should not default to the window dimensions because this basically sets the minimum size. Instead base size should not be set at all by default.

  10. francesca64 commented on May 2, 2018

    @francesca64
    Member

    Gotcha, I've corrected that. #494

    You can expect this to be in the next release, though I still need to implement this on macOS.

  11. added
    DS - appkit
    DS - x11
    C - in progress
    D - easy
    P - low
    on May 6, 2018
  12. self-assigned this
    on May 6, 2018
  13. removed
    DS - x11
    on May 12, 2018
  14. added 3 commits that reference this issue on May 15, 2018
    02f49cb
    8b45fcc
    16c949c
  15. francesca64 commented on May 15, 2018

    @francesca64
    Member

    macOS implementation: #519

    (Sorry this took so long, considering how simple it was!)

  16. added a commit that references this issue on May 15, 2018
    46e9b63
  17. added a commit that references this issue on May 16, 2018
    8440091
  18. added a commit that references this issue on Jun 11, 2022
    0dd7197
  19. Cthutu commented on Mar 20, 2024

    @Cthutu

    Is this coming to Windows any time soon?

  20. madsmtm commented on Mar 20, 2024

    @madsmtm
    Member

    Probably not, unless someone implements it.

    You might be able to emulate it yourself by running window.set_inner_size(...) inside of the Resized event.

    Please open a new issue if you encounter problems with doing so.

  21. Cthutu commented on Mar 21, 2024

    @Cthutu

    That's what I am trying out now and hoping (fingers crossed) that it will work. Just need to write the "calculate the actual size" routine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C - in progressD - easyDS - appkitP - lowS - apiS - enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions