[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon May 10 11:09:21 UTC 2021


 vcl/unx/gtk3/gtksys.cxx |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit cbfeec278196f2083db52cb6b1eb627b624b44aa
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 10 10:56:43 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon May 10 13:08:37 2021 +0200

    gtk4: get monitor size
    
    Change-Id: I833fbb041c97b10cdca57b21aa7c467a7add646a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115316
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtksys.cxx b/vcl/unx/gtk3/gtksys.cxx
index 79b59d2ccbf8..a1ca0cdd63be 100644
--- a/vcl/unx/gtk3/gtksys.cxx
+++ b/vcl/unx/gtk3/gtksys.cxx
@@ -214,21 +214,24 @@ unsigned int GtkSalSystem::GetDisplayBuiltInScreen()
 #endif
 }
 
-tools::Rectangle GtkSalSystem::GetDisplayScreenPosSizePixel (unsigned int nScreen)
+tools::Rectangle GtkSalSystem::GetDisplayScreenPosSizePixel(unsigned int nScreen)
 {
-#if !GTK_CHECK_VERSION(4, 0, 0)
+    GdkRectangle aRect;
+#if GTK_CHECK_VERSION(4, 0, 0)
+    GListModel* pList = gdk_display_get_monitors(mpDisplay);
+    GdkMonitor* pMonitor = static_cast<GdkMonitor*>(g_list_model_get_item(pList, nScreen));
+    if (!pMonitor)
+        return tools::Rectangle();
+    gdk_monitor_get_geometry(pMonitor, &aRect);
+#else
     gint nMonitor;
     GdkScreen *pScreen;
-    GdkRectangle aRect;
     pScreen = getScreenMonitorFromIdx (nScreen, nMonitor);
     if (!pScreen)
         return tools::Rectangle();
     gdk_screen_get_monitor_geometry (pScreen, nMonitor, &aRect);
-    return tools::Rectangle (Point(aRect.x, aRect.y), Size(aRect.width, aRect.height));
-#else
-    (void)nScreen;
-    return tools::Rectangle();
 #endif
+    return tools::Rectangle (Point(aRect.x, aRect.y), Size(aRect.width, aRect.height));
 }
 
 // convert ~ to indicate mnemonic to '_'


More information about the Libreoffice-commits mailing list