by c-smile · 6y ago · 0 comments
1. Anything close to AdjustWindowRectEx() function. See: https://docs.microsoft.com/en-us/windows/win32/api/winuser/n...
2. MoveWindow(window,rect) where rect is window frame rectangle. Instead GTK has 6 other functions that do something close but no one of them do MoveWindow.
See: https://stackoverflow.com/questions/58103333/set-frame-posit...
Windows has these functions, MacOS has their direct equivalents, but GTK does not have such, IMO basic, functionality.
Will we have anything like that in GTK4?
For example, when the user has arranged the windows of an application in some way, and then wants to save and then restore the placement of windows, how should it be done by the application?
It shouldn't be done by the application. It's the window manager's job to manage windows.
As a user, I absolutely do not want applications to be able to put themselves wherever _they_ want. The windows go where _I_ want, and the window manager gives me a single place where I can manage all that.
X11 could have been evolved in this direction by sandboxing applications within little mini-universes within the existing protocol. Windows solved this problem without breaking compatibility: https://en.wikipedia.org/wiki/User_Interface_Privilege_Isola...
I have a fundamental philosophical disagreement with the Wayland and GNOME camp. They believe that they can enumerate all interesting use cases and that each app should fit in one of their pre-defined boxes. I'm old school and believe in making systems that provide mechanism, not policy, and that give applications the ability to do unanticipated things.
Wayland doesn't have an equivalent protocol yet, but this is also how it would be idiomatically done there.
Because it has little utility and a lot of risk; Baddies use this to trick people. It is also so hard to use it correctly/meaningfully in many display topologies (mostly multihead+multidpi, but also tiling, virtual desktops, etc) without querying that topology that there’s no big hurry to offer an API that users don’t want and nobody can use correctly.
> For example, when the user has arranged the windows of an application in some way, and then wants to save and then restore the placement of windows, how should it be done by the application?
It shouldn’t: Putting that logic into every application is bloat at best, and a lot harder than just writing down x/y coordinates and screen numbers to a file (ever had to unplug a monitor to find a window on a Mac or windows desktop? Never happens on Unix!) so it makes sense to centralise it:
This is the job of the window manager and really, its only job. There are lots of window managers on Unix because users have varying needs here (I like using a lot of accessibility tools- If you could move my windows I might never find them again!)
…no? I’m not sure why this would be an issue specific to those?
https://wayland-book.com/xdg-shell-in-depth/popups.html
You just don't get to set the absolute position of your window. The precise position and making sure it isn't going off of the edge of the screen is the responsibility of the compositor.
This is good because it ensures proper security sandboxing and makes sure clients still work even when the windowing paradigm changes, e.g. with multiple desktops or window tiling. Developers hardcoding such assumptions is what caused much of the pain of Xorg so it's understandable that they want to make sure it does not happen again.
[1] starts at 0:40 https://www.youtube.com/watch?v=5-kZ1xcxhx4)
Which I think is a terrible thing to have separate, for the functionality reasons you're illustrating.
But that's why.
Yes that's how it works. I think there may be some APIs that let you 'hint' to the WM from the application, but it's possibly entirely up to the WM how to interpret those hints.
> Every used a tiling WM?
Sorry not sure what you're asking here. A tiling WM yes could possibly ignore the hints or interpret them in its own way. But not everyone is using a tiling WM, if that's what you're asking?
If a WM might exist that chooses to ignore the positioning call, that doesn't mean everyone should be robbed of that functionality.
Clientside decorations, ridiculous headerbar, button+hamburger menus, etc, etc. They are trying their absolute hardest to copy Mac os, and making sure everyone's stuff breaks in the meantime.