be able to specify the monitor which window will be created/displayed [multiple monitors support]
Describe the feature
it is quite usual for Desktop application to display different window/content among different monitors when present , especially applications developed for professional use , i.e. specify the monitor which will be shown when create a desktop window , if i remembered right , glfw support such a feature , and from code MonitorChange and GetScreens , i think it is quite close to such a feature ?
thanks
Relevant code
No response
Yep, there are several issues with our multiple monitor support that we will fix soon. Would it be sufficient to save the current monitor of a window so that the same window will open in the same monitor in the future for the same user? That way the user will have control over what monitor windows are created on, and the developer will not have to manually specify anything.
@kkoreilly i think it's better to make this optional parameter when creating a window as GLFW does.
i found an very good example of this from MS office(wps office too), by default when playing PowerPoint slides, if it detected an extended monitor, it beautifully presents fullscreened slides without any additional visual components (immerse mode i would call this ) in secondary monitor (window B), and shows an control and preview user interface (window A) in primary monitor, this is very good user experience. even better, it has an option to change/disable this default behavior to end user .
i think OBS has similar feature too , display program video in secondary monitor.
there are many similar scenarios : primary monitor : control and preview secondary monitor: final presentation/output
it would be the best if both developer(by API) and end user (by drag window) could both control this behavior. if not both, let developer decide and evolve.
Thanks for providing those possible use cases; I will work on adding support for both user and developer control of monitor placement soon.
@kkoreilly thank you for your wonderful work.
As part of this I will also add support for making windows default to fullscreen (#1140).
Not sure what you're currently doing, but on Linux make sure you test in Wayland, since it doesn't let the application know much, if anything, about which monitor it's on.
We implemented full support for customizing the monitor, fullscreen, and geometry properties of windows both when starting them and while they are running in #1341 and #1364. If you update to the latest version on the main branch (go get cogentcore.org/[email protected]), you can use this new functionality. I will add documentation to the website for these new features soon as part of #1321, but here are some quick examples on how to use the new functionality until then:
To run a window as fullscreen on the second monitor, do this:
b.NewWindow().SetScreen(1).SetFullscreen(true).RunMain()
Instead of the normal:
b.RunMainWindow()
(You can specify any screen and fullscreen does not have to be true, that is just an example).
To move an already running window to the second monitor with position (30, 100) and size (1000, 1000), do this:
myWidget.Scene.SetGeometry(false, image.Pt(30, 100), image.Pt(1000, 1000), 1)
Please let me know if you have any questions or issues. Thank you for your feedback and patience.
@Donatzsky We tested this on our Wayland devices and everything seemed to work correctly.