f3d-app / f3d

Fast and minimalist 3D viewer.
https://f3d.app
BSD 3-Clause "New" or "Revised" License
2.9k stars 210 forks source link

Window on Windows 10 positioned at top left under taskbar #1590

Open pegasusearl opened 2 months ago

pegasusearl commented 2 months ago

Launching F3D in Windows 10, the window is not centered, but instead in the top left corner.

image

Putting them in top left corner making the title bar inaccessible due being covered by taskbar if the taskbar happened to be on the top. But even if the title bar is accessible I think it's better to put them at the center of the screen of the currently focused display.

Or another way is to remember the last window position, mimicking Nomacs image viewer.

mwestphal commented 2 months ago

The position of the window is not set by F3D but by the OS itself. If you open F3D multiple time you will see that the windows are positioned "nicely" so that all their title bar is visible, this is Windows doing its thing.

The taskbar stuff looks like Windows not taking taskbar position when computating new Window position.

You can force the position of the F3D window using the --position option, and you can set this option in your config file for a permanent change.

pegasusearl commented 2 months ago

The position of the window is not set by F3D but by the OS itself.

And yet this only happened with f3d. Other apps will not place themselves at top left corner (under taskbar) even if they are ran for the first time. Also even if I move f3d to the middle, the next time f3d is opened, it will still opened in top left corner under taskbar.

For other apps on Windows, the behavior is also different. For example:

It's as if they tried to position themselves to the best way to use the program.

If you open F3D multiple time you will see that the windows are positioned "nicely" so that all their title bar is visible,

No this didn't happen. Every single f3d window is opened in top left corner (under taskbar) no matter how many instances I opened.

You can force the position of the F3D window using the --position option, and you can set this option in your config file for a permanent change.

Hmm, as I carry around config files everywhere, I think this workaround is good enough for me. Recommending them to most users will be another story though.

Perhaps this is more like feature request than a bug, but I guess it's not very important considering there is already --position option, and that Windows 11 don't allow moving taskbar anyway. Still, even if not under a taskbar, I think putting them in top left (0,0) would look strange.

mwestphal commented 2 months ago

For other apps on Windows, the behavior is also different. For example:

I don't doubt it :)

F3D however tries to not touch anything but keep defaults from the system. That being said, on MacOS we do position the window because it we do not, it is really wrongly positioned, maybe an arguement can be made that the window should be positioned somewhere else by default on Windows.

Centering the window is not trivial as it requires access to the screen size.

No this didn't happen. Every single f3d window is opened in top left corner (under taskbar) no matter how many instances I opened.

Indeed, I just checked and it doesnt do that. I wonder why as I remembers this behavior clearly from some years ago, Ill check.

Perhaps this is more like feature request than a bug,

So your feature request would be that, F3D should position itself by default in the center of the screen, is that correct ?

mwestphal commented 2 months ago

related: https://github.com/f3d-app/f3d/issues/410 https://github.com/f3d-app/f3d/issues/856

mwestphal commented 2 months ago

Interestingly, some Windows app do have the cascading effect (eg, Win11 terminal app), but others dont (cmake-gui), and some even do not support to be opened multiple times (eg: clock)

I do thing we could improve this behavior to be more Windows-like. It is quite barebone now. I'll add it to the Windows related improvements: https://github.com/f3d-app/f3d/issues/21

pegasusearl commented 2 months ago

Primary Request

So your feature request would be that, F3D should position itself by default in the center of the screen, is that correct ?

Yes, but more specifically:

I believe this is the ideal/best behavior. It is important that it's only centered in the current focused display in case user is using multi monitor setup, and they are browsing 3D assets on their secondary monitor.

Something like this: (it's two monitors stacked vertically)

2024-08-26 21_57_56--fs8

Possible Issue:

I'm not sure how to get the screen size, but if the screen size obtained is span of multiple monitors, then if there are two monitors the window will be created in between two monitors. I remembered some apps do this in the past, I don't remember which one. This should NOT be what happened.

What I meant is something like this:

spanx


Alternative Request!

In case previous request is not possible, perhaps remember_last_window_position_and_size would be good too. Personally I think this is less ideal compared to previous solution because you have to drag the window to the desired position/size each time you open the app from different display but some people might find it better this way.

This behavior is similar to Nomacs image viewer.

Possible Issue:

If user have multiple monitor, and they drag f3d to secondary display, close it, and then f3d saves it's position and size, then unplug the second monitor, the next time they open f3d, the window will be gone. It will be opened outside of the screen and you can't see them.

mwestphal commented 2 months ago

f3d's window, by default, should be positioned in the center of the screen of currently focused display.

Indeed, that would be nice, but position should be controllable too if needed.

remember_last_window_position_and_size

https://github.com/f3d-app/f3d/issues/856