summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk3/gtk3gtkinst.cxx
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2020-11-04 14:43:11 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2020-11-05 17:03:25 +0100
commit9890240055c774c55f125b6db6146536980295ab (patch)
tree2c959c12b6ea6f2cd75952f7a6f98498f0eefe20 /vcl/unx/gtk3/gtk3gtkinst.cxx
parenta0dedcb23cd5051c09b8353aebea44f876d79a7b (diff)
gtk3: Allow restoring saved window position (if not on Wayland)
Previously, while 'GtkInstanceWindow::get_window_state' returned the window position for the non-Wayland case, 'GtkInstanceWindow::set_window_state' didn't take it into account when restoring the state. In order to actually restore the previously saved state, have 'GtkInstanceWindow::set_window_state' take the window position into account as well if the corresponding flags are passed (and not on Wayland). This e.g. makes the print dialog show up at the same position on the screen as last time. (I came across this while looking at tdf#137471 "CMIS dialog advances beyond lower right corner of the screen" which affects qt5, and checking what gtk3 does in comparison. Actually, the "Remote files" dialog itself - other than the print dialog - still doesn't open at the same location with this commit in place, since 'GtkInstanceWindow::get_window_state' for some reason doesn't return the actual location for that dialog, i.e. it cannot be restored by the handling introduced here, but that's a different issue.) Change-Id: Icb5e7e8c7ea3fad7800c4334ad56e47f88144a75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105298 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/unx/gtk3/gtk3gtkinst.cxx')
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx23
1 files changed, 17 insertions, 6 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 92298a2d0bd7..6f14c46d5e58 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3924,6 +3924,17 @@ private:
pThis->signal_toplevel_focus_changed();
}
+ bool isPositioningAllowed() const
+ {
+ bool bPositioningAllowed = true;
+#if defined(GDK_WINDOWING_WAYLAND)
+ // no X/Y positioning under Wayland
+ GdkDisplay *pDisplay = gtk_widget_get_display(m_pWidget);
+ bPositioningAllowed = !DLSYM_GDK_IS_WAYLAND_DISPLAY(pDisplay);
+#endif
+ return bPositioningAllowed;
+ }
+
protected:
void help();
public:
@@ -4052,16 +4063,16 @@ public:
else
gtk_window_unmaximize(m_pWindow);
}
+
+ if (isPositioningAllowed() && (nMask & WindowStateMask::X && nMask & WindowStateMask::Y))
+ {
+ gtk_window_move(m_pWindow, aData.GetX(), aData.GetY());
+ }
}
virtual OString get_window_state(WindowStateMask nMask) const override
{
- bool bPositioningAllowed = true;
-#if defined(GDK_WINDOWING_WAYLAND)
- // drop x/y when under wayland
- GdkDisplay *pDisplay = gtk_widget_get_display(m_pWidget);
- bPositioningAllowed = !DLSYM_GDK_IS_WAYLAND_DISPLAY(pDisplay);
-#endif
+ bool bPositioningAllowed = isPositioningAllowed();
WindowStateData aData;
WindowStateMask nAvailable = WindowStateMask::State |