vcl/unx/gtk3/gtkinst.cxx |   15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

New commits:
commit ef74db867199efad3807f86be57e24316a01b0d2
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Jan 8 23:30:58 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat Jan 10 23:19:26 2026 +0100

    gtk3: Port from deprecated gdk_screen_get_monitor_workarea
    
    gdk_screen_get_monitor_workarea is deprecated since GTK 3.22. [1]
    Port this use to the suggested alternative instead:
    gdk_monitor_get_workarea
    
    [1] https://docs.gtk.org/gdk3/method.Screen.get_monitor_workarea.html
    
    Change-Id: Ibb51772a266e842ea786cc5283666cd5fed064ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196893
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index f20d7342bf14..137a0259d4f7 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -6332,9 +6332,9 @@ namespace
     AbsoluteScreenPixelRectangle get_monitor_workarea(GtkWidget* pWindow)
     {
         GdkRectangle aRect;
-        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);
+        GdkDisplay* pDisplay = gtk_widget_get_display(pWindow);
+        GdkMonitor* pMonitor = gdk_display_get_monitor_at_window(pDisplay, 
widget_get_surface(pWindow));
+        gdk_monitor_get_workarea(pMonitor, &aRect);
         return AbsoluteScreenPixelRectangle(aRect.x, aRect.y, aRect.x + 
aRect.width, aRect.y + aRect.height);
     }
 #endif
commit d4428ec80b7e1158e2f24045231fbbcb632c0e59
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Jan 8 23:09:54 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat Jan 10 23:19:19 2026 +0100

    gtk3: Use gdk_window_move_to_rect directly
    
    gdk_window_move_to_rect is available since GTK 3.24 [1].
    Use it directly, since that is the minimum GTK version since
    
        commit c392f7b8a614c7ef32cfa9888aeb06b27b535390
        Author: Michael Weghorn <[email protected]>
        Date:   Wed Nov 5 17:44:57 2025 +0100
    
            gtk3: Require GTK >= 3.24
    
    [1] https://docs.gtk.org/gdk3/method.Window.move_to_rect.html
    
    Change-Id: I5f23e6385073a03830e0ef1442d644c8c35a3b8a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196892
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index b4591dae1a1d..f20d7342bf14 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -10498,12 +10498,6 @@ GtkPositionType show_menu_older_gtk(GtkWidget* 
pMenuButton, GtkWindow* pMenu, co
 bool show_menu_newer_gtk(GtkWidget* pComboBox, GtkWindow* pMenu, const 
GdkRectangle &rAnchor,
                          weld::Placement ePlace, bool bTryShrink)
 {
-    static auto window_move_to_rect = reinterpret_cast<void (*) (GdkWindow*, 
const GdkRectangle*, GdkGravity,
-                                                                 GdkGravity, 
GdkAnchorHints, gint, gint)>(
-                                                                    
dlsym(nullptr, "gdk_window_move_to_rect"));
-    if (!window_move_to_rect)
-        return false;
-
     // under wayland gdk_window_move_to_rect works great for me, but in my 
current
     // gtk 3.24 under X it leaves part of long menus outside the work area
     GdkDisplay *pDisplay = gtk_widget_get_display(pComboBox);
@@ -10541,8 +10535,7 @@ bool show_menu_newer_gtk(GtkWidget* pComboBox, 
GtkWindow* pMenu, const GdkRectan
     GdkRectangle rect {x, y, rAnchor.width, rAnchor.height};
     GdkSurface* toplevel = widget_get_surface(GTK_WIDGET(pMenu));
 
-    window_move_to_rect(toplevel, &rect, rect_anchor, menu_anchor, 
anchor_hints,
-                        0, 0);
+    gdk_window_move_to_rect(toplevel, &rect, rect_anchor, menu_anchor, 
anchor_hints, 0, 0);
 
     return true;
 }

Reply via email to