kettle11 / kapp

A pure Rust window and input library for Windows, Mac, and Web. (Work in progress)
Apache License 2.0
56 stars 4 forks source link

Decide if `minimum_size` and `maximum_size` window builder properties should include titlebar. #61

Open kettle11 opened 3 years ago

kettle11 commented 3 years ago

Right now the window_builder::maximum_size and window_size functions claim Sets the maximum size of the window's content area (excluding the titlebar and borders), but on Mac the titlebars are actually included in the size.

Are the titlebars definitely excluded on Windows?

Should specifying the size include any titlebars?

@lunabunn Do you have thoughts here?

lunabunn commented 3 years ago

I'm not sure if they're included on Windows, will test that later today. Re: the title of the issue, it should not include the titlebar. Titlebar sizes are inconsistent, so if we don't provide facilities to set min/max window size in terms of the client area (excluding the titlebar) we'll get inconsistent behavior. If any window-size-related methods or values include the titlebar without being explicitly marked as such, that should be considered a bug.

kettle11 commented 3 years ago

Yeah, that makes sense.

I can see it being tricky if you wanted to do something like set the window height (including titlebar) to the screen height (not that kapp supports querying screen sizes at the moment). You'd have to get the screen height and then somehow get the titlebar size and include that in your calculations.

Also winit splits out setting window size into "inner_size" and "outer_size", which does have nice clarity.

To keep things simpler perhaps kapp should adopt the same "inner_size" terminology and leave outer_size related stuff for later.

lunabunn commented 3 years ago

+1 for the inner_size vs. outer_size terminology.

lunabunn commented 3 years ago

Update, Windows does include borders in the min/max tracking size. Additionally note that on Windows 10, the actual size of the border != the "border size." There are 8-pixel-wide transparent borders around the window. 😓 Somehow got to account for this mess.

kettle11 commented 3 years ago

Oh no. Probably we'll need to investigate what other similar libraries (Winit, Glfw, SDL) do.