Support restoring a GtkWindow to its snapped state
Submitted by Reece H. Dunn
Link to original bug (#688586)
Description
USE CASE
The GDK+ API supports maximizing a window and detecting when a window is maximized. However it does not support detecting if a window gets snapped left/right, or restoring a window to such a state.
Providing this API would allow an application to restore to the snapped state. At the moment, the window will restore to the position and size taken by the snapped state, but not snapped. This means that the user has to resnap the window upon opening it.
DESIGN
The API would need to be flexible enough to support other tiling modes (e.g. KDE snap to corners). This could be done by having a string ID to represent the snapped state that the window manager/extension understands and sends to the application.
For gnome-shell, this would be something like "left" and "right", whereas a KDE corner snap could be "top-left", etc. A more flexible tiling window manager could have IDs like "tile1" and "tile2".
A null string would mean "do not tile", as would an unrecognised string (supporting the case where an application is restored on a different WM that does not recognise the stored ID).
This way, the application would receive the tile ID from the "tile mode changed" event and pass that ID to the "set tile mode" method to restore it to the tile state it was in before it was closed. The values of the tile ID are then entirely up to the window manager/extension and the application will work on any WM.