cui/source/dialogs/hlmarkwn.cxx  |    4 +---
 cui/source/dialogs/hltpbase.cxx  |   30 +-----------------------------
 cui/source/inc/hlmarkwn.hxx      |    2 +-
 cui/source/inc/hltpbase.hxx      |    1 -
 include/vcl/weld/weld.hxx        |    1 -
 vcl/inc/qt5/QtInstanceWindow.hxx |    1 -
 vcl/inc/salvtables.hxx           |    2 --
 vcl/qt5/QtInstanceWindow.cxx     |    6 ------
 vcl/source/app/salvtables.cxx    |    5 -----
 vcl/unx/gtk3/gtkinst.cxx         |   14 ++------------
 10 files changed, 5 insertions(+), 61 deletions(-)

New commits:
commit 4f50861eeae52c743d6de569d491706013859a9c
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Jan 8 23:03:21 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat Jan 10 23:19:12 2026 +0100

    tdf#130857 weld: Drop now unused weld::Window::get_monitor_workarea
    
    The method is now unused after
    
        Change-Id: If30022d71a124bc981cbc6abf0623fd70945be83
        Author: Michael Weghorn <[email protected]>
        Date:   Thu Jan 8 22:50:31 2026 +0100
    
            tdf#130857 Drop initial pos logic for hyperlink child dialog
    
    , so drop it altogether.
    
    Change-Id: I0ce776dda683527ca681e259d68ded2491676666
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196891
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/include/vcl/weld/weld.hxx b/include/vcl/weld/weld.hxx
index d885ced2ffd3..1e5499819664 100644
--- a/include/vcl/weld/weld.hxx
+++ b/include/vcl/weld/weld.hxx
@@ -518,7 +518,6 @@ public:
     virtual bool get_resizable() const = 0;
     virtual Size get_size() const = 0;
     virtual Point get_position() const = 0;
-    virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const = 0;
 
     // returns whether the widget that has focus is within this Window
     // (its very possible to move this to weld::Container if that becomes
diff --git a/vcl/inc/qt5/QtInstanceWindow.hxx b/vcl/inc/qt5/QtInstanceWindow.hxx
index f1f44739eff6..895fb92925d0 100644
--- a/vcl/inc/qt5/QtInstanceWindow.hxx
+++ b/vcl/inc/qt5/QtInstanceWindow.hxx
@@ -28,7 +28,6 @@ public:
     virtual bool get_resizable() const override;
     virtual Size get_size() const override;
     virtual Point get_position() const override;
-    virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const override;
 
     virtual bool has_toplevel_focus() const override;
     virtual void present() override;
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 4660c2a13b11..932c118efec9 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -472,8 +472,6 @@ public:
 
     virtual Point get_position() const override;
 
-    virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const override;
-
     virtual bool get_resizable() const override;
 
     virtual bool has_toplevel_focus() const override;
diff --git a/vcl/qt5/QtInstanceWindow.cxx b/vcl/qt5/QtInstanceWindow.cxx
index f4f1b57e16d1..43cdb02b761f 100644
--- a/vcl/qt5/QtInstanceWindow.cxx
+++ b/vcl/qt5/QtInstanceWindow.cxx
@@ -87,12 +87,6 @@ Point QtInstanceWindow::get_position() const
     return aPosition;
 }
 
-AbsoluteScreenPixelRectangle QtInstanceWindow::get_monitor_workarea() const
-{
-    assert(false && "Not implemented yet");
-    return AbsoluteScreenPixelRectangle();
-}
-
 bool QtInstanceWindow::has_toplevel_focus() const
 {
     SolarMutexGuard g;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 3141286c0972..580a98a34198 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1651,11 +1651,6 @@ Size SalInstanceWindow::get_size() const { return 
m_xWindow->GetSizePixel(); }
 
 Point SalInstanceWindow::get_position() const { return 
m_xWindow->GetPosPixel(); }
 
-AbsoluteScreenPixelRectangle SalInstanceWindow::get_monitor_workarea() const
-{
-    return m_xWindow->GetDesktopRectPixel();
-}
-
 bool SalInstanceWindow::get_resizable() const { return m_xWindow->GetStyle() & 
WB_SIZEABLE; }
 
 bool SalInstanceWindow::has_toplevel_focus() const { return 
m_xWindow->HasChildPathFocus(); }
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 91356d586874..b4591dae1a1d 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -6328,21 +6328,16 @@ namespace
 #endif
     }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
     AbsoluteScreenPixelRectangle get_monitor_workarea(GtkWidget* pWindow)
     {
         GdkRectangle aRect;
-#if !GTK_CHECK_VERSION(4, 0, 0)
         GdkScreen* pScreen = gtk_widget_get_screen(pWindow);
         gint nMonitor = gdk_screen_get_monitor_at_window(pScreen, 
widget_get_surface(pWindow));
         gdk_screen_get_monitor_workarea(pScreen, nMonitor, &aRect);
-#else
-        GdkDisplay* pDisplay = gtk_widget_get_display(pWindow);
-        GdkSurface* gdkWindow = widget_get_surface(pWindow);
-        GdkMonitor* pMonitor = gdk_display_get_monitor_at_surface(pDisplay, 
gdkWindow);
-        gdk_monitor_get_geometry(pMonitor, &aRect);
-#endif
         return AbsoluteScreenPixelRectangle(aRect.x, aRect.y, aRect.x + 
aRect.width, aRect.y + aRect.height);
     }
+#endif
 
 
 class GtkInstanceWindow : public GtkInstanceContainer, public virtual 
weld::Window
@@ -6497,11 +6492,6 @@ public:
         GtkInstanceContainer::hide();
     }
 
-    virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const override
-    {
-        return ::get_monitor_workarea(GTK_WIDGET(m_pWindow));
-    }
-
     virtual bool get_resizable() const override
     {
         return gtk_window_get_resizable(m_pWindow);
commit 80f1669984448ff4cbf01070ac47cae2543b0c76
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Jan 8 22:50:31 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat Jan 10 23:19:04 2026 +0100

    tdf#130857 Drop initial pos logic for hyperlink child dialog
    
    Drop custom logic to determine an initial position for
    the "Target in Document" child dialog that can be triggered
    from the "Hyperlink" dialog.
    
    It's unclear why the dialog should be positioned in a certain
    position relative to the parent dialog, as there is no need
    to work with both dialogs at the same time. Therefore, leave
    it to the window manager/OS to determine the initial position
    and drop the custom logic only used here.
    
    This commit drops the only use of
    weld::Window::get_monitor_workarea, so the method
    can be dropped in an upcoming commit (instead of
    also implementing it for QtInstanceWindow).
    
    However, leave the logic to remember and restore the
    previous position in place, as introduced in
    
        commit bf927cb4513f8ef2a5205e98fbcf1ff02c344b4a
        Author: Andreas Heinisch <[email protected]>
        Date:   Fri Nov 3 14:07:34 2023 +0100
    
            tdf#149935 - Hyperlink Target Dialog: remember last used position 
and size
    
    , and rename SvxHlinkDlgMarkWnd::MoveTo to
    SvxHlinkDlgMarkWnd::RestorePosSize accordingly.
    
    This still works as expected in a quick test with the
    gen vcl plugin as follows:
    
    * start Writer
    * press Ctrl+K to open the hyperlink dialog
    * switch to the "Document" tab
    * click on the "Target in Document" button
    
    (Moving a window to a specific position on screen
    is not supported e.g. for native Wayland apps on on
    Wayland however.)
    
    Change-Id: If30022d71a124bc981cbc6abf0623fd70945be83
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196890
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
index 096cb1a513f3..5e184e6dffdc 100644
--- a/cui/source/dialogs/hlmarkwn.cxx
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -132,14 +132,12 @@ sal_uInt16 SvxHlinkDlgMarkWnd::SetError( sal_uInt16 
nError)
 }
 
 // Move window
-void SvxHlinkDlgMarkWnd::MoveTo(const Point& rNewPos)
+void SvxHlinkDlgMarkWnd::RestorePosSize()
 {
     // tdf#149935 - remember last used position and size
     SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id());
     if (aDlgOpt.Exists())
         m_xDialog->set_window_state(aDlgOpt.GetWindowState());
-    else
-        m_xDialog->window_move(rNewPos.X(), rNewPos.Y());
 }
 
 namespace
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index 9fee4c0b7d0a..87cdb81a917c 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -179,37 +179,12 @@ void SvxHyperlinkTabPageBase::ShowMarkWnd()
     mxMarkWnd = std::make_shared<SvxHlinkDlgMarkWnd>(pDialog, this);
 
     // Size of dialog-window in screen pixels
-    Point aDlgPos(pDialog->get_position());
     Size aDlgSize(pDialog->get_size());
 
-    // Absolute size of the screen
-    ::tools::Rectangle aScreen(pDialog->get_monitor_workarea());
-
     // Size of Extrawindow
     Size aExtraWndSize(mxMarkWnd->getDialog()->get_preferred_size());
 
-    // mxMarkWnd is a child of mpDialog, so coordinates for positioning must 
be relative to mpDialog
-    Point aPos;
-    if( aDlgPos.X()+(1.05*aDlgSize.Width())+aExtraWndSize.Width() > 
aScreen.Right() )
-    {
-        if( aDlgPos.X() - ( 0.05*aDlgSize.Width() ) - aExtraWndSize.Width() < 
0 )
-        {
-            // Pos Extrawindow anywhere
-            aPos = Point(10, 10); // very unlikely
-        }
-        else
-        {
-            // Pos Extrawindow on the left side of Dialog
-            aPos = Point(0, 0) - Point(tools::Long(0.05 * aDlgSize.Width()), 0)
-                   - Point(aExtraWndSize.Width(), 0);
-        }
-    }
-    else
-    {
-        // Pos Extrawindow on the right side of Dialog
-        aPos = Point(tools::Long(1.05 * aDlgSize.getWidth()), 0);
-    }
-    mxMarkWnd->MoveTo(aPos);
+    mxMarkWnd->RestorePosSize();
 
     // Set size of Extra-Window
     mxMarkWnd->getDialog()->set_size_request(aExtraWndSize.Width(), 
aDlgSize.Height());
diff --git a/cui/source/inc/hlmarkwn.hxx b/cui/source/inc/hlmarkwn.hxx
index 1cff9f901dbc..a4d61b131e82 100644
--- a/cui/source/inc/hlmarkwn.hxx
+++ b/cui/source/inc/hlmarkwn.hxx
@@ -59,7 +59,7 @@ public:
     SvxHlinkDlgMarkWnd(weld::Window* pParentDialog, SvxHyperlinkTabPageBase 
*pParentPage);
     virtual ~SvxHlinkDlgMarkWnd() override;
 
-    void MoveTo(const Point& rNewPos);
+    void RestorePosSize();
     void RefreshTree(const OUString& aStrURL);
     bool SelectEntry(std::u16string_view aStrMark);
 
commit a3ca23b58684aef136e20f3a97ddad4b5d59275d
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Jan 8 22:43:53 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat Jan 10 23:18:57 2026 +0100

    cui: Move SvxHyperlinkTabPageBase::MoveToExtraWnd logic to ShowMarkWnd
    
    SvxHyperlinkTabPageBase::MoveToExtraWnd only gets called
    from SvxHyperlinkTabPageBase::MoveToExtraWnd::ShowMarkWnd.
    
    Move the logic there and drop
    SvxHyperlinkTabPageBase::MoveToExtraWnd, as there is no
    need for a separate (public) method.
    
    Change-Id: Ic1126a6df5ea8c6ea49d3b833ba8eb83f7cd8632
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196889
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index 8a4d623cc2de..9fee4c0b7d0a 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -165,12 +165,6 @@ void SvxHyperlinkTabPageBase::InitStdControls ()
     mbStdControlsInit = true;
 }
 
-// Move Extra-Window
-void SvxHyperlinkTabPageBase::MoveToExtraWnd( Point aNewPos )
-{
-    mxMarkWnd->MoveTo(aNewPos);
-}
-
 // Show Extra-Window
 void SvxHyperlinkTabPageBase::ShowMarkWnd()
 {
@@ -195,24 +189,27 @@ void SvxHyperlinkTabPageBase::ShowMarkWnd()
     Size aExtraWndSize(mxMarkWnd->getDialog()->get_preferred_size());
 
     // mxMarkWnd is a child of mpDialog, so coordinates for positioning must 
be relative to mpDialog
+    Point aPos;
     if( aDlgPos.X()+(1.05*aDlgSize.Width())+aExtraWndSize.Width() > 
aScreen.Right() )
     {
         if( aDlgPos.X() - ( 0.05*aDlgSize.Width() ) - aExtraWndSize.Width() < 
0 )
         {
             // Pos Extrawindow anywhere
-            MoveToExtraWnd( Point(10,10) );  // very unlikely
+            aPos = Point(10, 10); // very unlikely
         }
         else
         {
             // Pos Extrawindow on the left side of Dialog
-            MoveToExtraWnd( Point(0,0) - Point( 
tools::Long(0.05*aDlgSize.Width()), 0 ) - Point( aExtraWndSize.Width(), 0 ) );
+            aPos = Point(0, 0) - Point(tools::Long(0.05 * aDlgSize.Width()), 0)
+                   - Point(aExtraWndSize.Width(), 0);
         }
     }
     else
     {
         // Pos Extrawindow on the right side of Dialog
-        MoveToExtraWnd ( Point( tools::Long(1.05*aDlgSize.getWidth()), 0 ) );
+        aPos = Point(tools::Long(1.05 * aDlgSize.getWidth()), 0);
     }
+    mxMarkWnd->MoveTo(aPos);
 
     // Set size of Extra-Window
     mxMarkWnd->getDialog()->set_size_request(aExtraWndSize.Width(), 
aDlgSize.Height());
diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx
index c720ba9a353e..528de025b0a2 100644
--- a/cui/source/inc/hltpbase.hxx
+++ b/cui/source/inc/hltpbase.hxx
@@ -121,7 +121,6 @@ public:
     virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
 
     bool IsMarkWndVisible() const { return static_cast<bool>(mxMarkWnd); }
-    void MoveToExtraWnd ( Point aNewPos );
 
     virtual bool        QueryClose() override;
 

Reply via email to