Perhaps it makes sense to dumb down the restoreGeometry() logic. This function is full of undocumented tweaks. It should simply take the saved geometry, screen, and/or window placement in a virtual desktop and call the corresponding APIs to set the stored values, without any sanity checking. That is all. If a user has changed a desktop settings (e.g. screen size, window decoration size) then an application should have an option to not restore from saved settings (or reset to defaults), the API should not try do undocumented magic. A smarter restoreGeometry() version could even store screen serial numbers and return 'false' if things has changed. There are a lot of arbitrary ways to do this, perhaps the best is to have a dumb version and document it as such and inform developers that they can write a smarter/custom version if desired.