summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk3/gtkinst.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/gtk3/gtkinst.cxx')
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx20
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, &current_x, &current_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));