orbtk icon indicating copy to clipboard operation
orbtk copied to clipboard

It is possible to open a window with maximized size?

Open ChayimFriedman2 opened this issue 5 years ago • 7 comments
trafficstars

The title tells the story... I want to open a window as maximized.

ChayimFriedman2 avatar Jun 05 '20 05:06 ChayimFriedman2

@ChayimFriedman2 not yet but I could implement it as next. I let you know when it's done.

FloVanGH avatar Jun 05 '20 05:06 FloVanGH

I think a new method called fullscreen() should be added to the Window builder. It would call a piece of code that acquires the current display resolution and would set a window position to (0.0, 0.0), size to (resolution_x, resolution_y) and resizeable to false.

Application::new()
        .window(|ctx| {
            Window::new()
                .title("OrbTk - Fullscreen example")
                .fullscreen(yes)
                .resizeable(false)
                .build(ctx)
        })
        .run();

kivimango avatar Aug 02 '20 09:08 kivimango

@kivimango That what I've thought too. Too notes, though:

  1. .fullscreen(yes)????? You probably meant .fullscreen(true)...
  2. I think fullscreen() is an ambiguous, because it also means fullscreen window (i.e. without borders etc.). Better name is maximized(), or even better, something like state(requestedState: WindowState) where WindowState is an enum enum WindowState { Normal, Maximized, Minimized }.

ChayimFriedman2 avatar Aug 02 '20 13:08 ChayimFriedman2

@ChayimFriedman2 thank you for your input. It will be included in the 0.3.1-alpha4 relase.

FloVanGH avatar Aug 10 '20 06:08 FloVanGH

Hi, i think this feature could be implemented more easily when the new glutin backend arrives since it already have on WindowBuilder struct the function pub fn with_fullscreen(self, monitor: Option<Fullscreen>) -> WindowBuilder that can be used to set fullscreen exclusive window or borderless window. (https://docs.rs/glutin/0.24.1/glutin/window/struct.WindowBuilder.html#method.with_fullscreen)

uniformbuffer avatar Aug 12 '20 18:08 uniformbuffer

1. `.fullscreen(yes)`????? You probably meant `.fullscreen(true)`...

Exactly.

2. I think `fullscreen()` is an ambiguous, because it also means fullscreen window (i.e. without borders etc.). Better name is `maximized()`, or even better, something like `state(requestedState: WindowState)` where `WindowState` is an enum `enum WindowState { Normal, Maximized, Minimized }`.

You are right.

kivimango avatar Sep 02 '20 08:09 kivimango

Will take it on my agenda

FloVanGH avatar Sep 02 '20 14:09 FloVanGH