HumbleUI / JWM

Cross-platform window management and OS integration library for Java
Apache License 2.0
546 stars 44 forks source link

"getScreens" and "getScreen" don't fully make sense for all platforms #277

Closed TheDrawingCoder-Gamer closed 7 months ago

TheDrawingCoder-Gamer commented 7 months ago

I would like to know the reasoning behind getScreens and getScreen. I think that these aren't used and could be replaced where they are used (like adding getScale directly on a window). Also fairly sure that wayland doesn't even bother letting you list out all the screens, and X11 doesn't even really support it. In my opinion, it would make more sense to just get rid of screens altogether, and move the functions elsewhere. The only actually useful function in my opinion is getScale, and that can easily be moved to Window

This is a blocker for me on wayland, as there is no feasible way to implement it. It also is very jank on wayland, in a way that makes me think you weren't really meant to get the screen.

dzaima commented 7 months ago

Some more functions related to screens are Window::getWindowRect() and Window::setWindowPosition(int left, int top), which largely require knowing screen size(s) to be reasonably utilized; as far as I understand Wayland just refuses to have an interface for operations like this. It would suck to see them be removed everywhere because Wayland is weird/effectively incomplete though. (I don't have much in ongoing usages, I've mostly settled on doing everything in a single window because multi-window is janky & last I tried I needed some features not exposed in JWM; I had hoped that wayland would improve on that, but so far it's looking like it's doing the exact opposite...)

Don't know what's the best course of action here. Could make sense to have a getScale on windows (perhaps nice in general) and/or just make a dummy screen object on Wayland (reporting a screen sized exactly as big as the window means that getWindowRect and setWindowPosition would be able to stay "relatively correct" by returning (0; 0) and being a no-op respectively).

tonsky commented 7 months ago

Screen configuration is pretty important to position window correctly, e.g. in the center of the screen. Also to make sure we are not creating window bigger than screen.

I agree with @dzaima, it’s unfortunate that Wayland doesn’t support it, but all the other platforms do and it’s pretty useful there. Maybe make Wayland version always return 1024x768 screen or something?

TheDrawingCoder-Gamer commented 7 months ago

Returning just the size of the window makes sense then. I'm ok with that.