diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-01-26 11:27:18 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-01-26 14:49:30 +0100 |
commit | be34fe06751609382b5a650d481cf4be2484c6f8 (patch) | |
tree | 54d5b4ba44db91442401d1fd6eff2ee235ec72e3 /vcl/unx/gtk3/gtkinst.cxx | |
parent | 92f84e7864c0c6729c2d87a03c1176ce565c8b99 (diff) |
Related: tdf#146648 store last known position when visible to return later
if the window is hidden when its position is queried, which is what vcl
does and the assumption this is possible is baked in
Change-Id: I5ce96a638796a6691eeb1b09578e23752a70c243
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128980
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx/gtk3/gtkinst.cxx')
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index f4e89353e77f..548316c49860 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -6002,6 +6002,7 @@ class GtkInstanceWindow : public GtkInstanceContainer, public virtual weld::Wind private: GtkWindow* m_pWindow; rtl::Reference<SalGtkXWindow> m_xWindow; //uno api + std::optional<Point> m_aPosWhileInvis; //tdf#146648 store last known position when visible to return as pos if hidden gulong m_nToplevelFocusChangedSignalId; #if !GTK_CHECK_VERSION(4, 0, 0) @@ -6134,6 +6135,12 @@ public: virtual Point get_position() const override { + if (m_aPosWhileInvis) + { + assert(!get_visible()); + return *m_aPosWhileInvis; + } + int current_x(0), current_y(0); #if !GTK_CHECK_VERSION(4, 0, 0) gtk_window_get_position(m_pWindow, ¤t_x, ¤t_y); @@ -6141,6 +6148,19 @@ public: return Point(current_x, current_y); } + virtual void show() override + { + m_aPosWhileInvis.reset(); + GtkInstanceContainer::show(); + } + + virtual void hide() override + { + if (is_visible()) + m_aPosWhileInvis = get_position(); + GtkInstanceContainer::hide(); + } + virtual tools::Rectangle get_monitor_workarea() const override { return ::get_monitor_workarea(GTK_WIDGET(m_pWindow)); |