Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement 'set_windows_position' #778

Closed
rhzk opened this issue Mar 30, 2020 · 5 comments
Closed

Implement 'set_windows_position' #778

rhzk opened this issue Mar 30, 2020 · 5 comments
Labels
enhancement adds or requests a new feature

Comments

@rhzk
Copy link
Collaborator

rhzk commented Mar 30, 2020

Function to set/move the window position on the screen.

Theres also the question about multiple displays, and if the window should be restrained within bounds.

Other GUIs I have used in the past usually did not have a restrain option, so it was up to the programmers using the GUI to implement their own if they wanted it.
We could potentionally have a set_windows_position_restrained(), that would keep the window within the display/displays if values would exceed them. In other word prevent the window from being drawn outside any visible space.

Multiple displays are a bigger problem tho as it might differ between operating system and display modes.

If lets say I have 2 fhd monitors(1920*1080)*2 and I call the function with 1921, Should the window then be drawn on the second monitor? This might be problematic if the resolution is different tho.

Maybe the best option here would be functions 'get_displays' 'set_window_display' and display.get_resolution'

@cmyr cmyr added the enhancement adds or requests a new feature label Apr 4, 2020
@cmyr
Copy link
Member

cmyr commented Apr 4, 2020

as you mention, this is tied to having some way of querying the connected displays.

We could preliminarily do a simple version that only uses the main display. Even for that to be useful, though, we do want some way of querying the platform for the size of the current display.

this would require new API in druid-shell.

This doesn't need to be crazy; I would add a new screen module in druid-shell, and I would initially just have a single top-level function, fn main_screen_size() -> Size.

Then we would add methods to WindowHandle in druid-shell for controling the window frame. I would expect, at the very least, a 'set_frame' method; we could definitely also have 'set_frame_constrained'.

On your last point; in general windows have to be on one monitor or another, for the reasons you describe. If you drag a window halfway onto another monitor, I don't know of a platform where it will be displayed half and half.

In any case: bottom line is yes, we should have this, and that if you're interested in working on it you should feel free!

@xStrom
Copy link
Member

xStrom commented Apr 4, 2020

If you drag a window halfway onto another monitor, I don't know of a platform where it will be displayed half and half.

What do you mean by this? I'm confused because on Windows you can definitely have half of a window on one monitor and the other half on the other monitor.

@ForLoveOfCats
Copy link
Collaborator

I will concur that X11 (I'm 90% sure Wayland is the same) will also display half the window on one monitor and half on the other

@cmyr
Copy link
Member

cmyr commented Apr 7, 2020

hmm, noted.

@JAicewizard
Copy link
Contributor

I just saw a PR related to this, and I would like to add that Wayland does not allow you to set window position. This may changer in the future since this completely blocks wine from working under wayland, but from what I have read wayland maintainers are stubborn about it.

See the gtk docs as some kind of proof.
I didnt see anyone mention this but you should keep this in mind.

@rhzk rhzk closed this as completed Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement adds or requests a new feature
Projects
None yet
Development

No branches or pull requests

5 participants