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

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


 vcl/inc/unx/gtk/gtksys.hxx |    2 +-
 vcl/unx/gtk3/gtksys.cxx    |   12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 603c959482ae89c16240b07bd1698d060cdf7a87
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 10 11:04:52 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon May 10 13:36:58 2021 +0200

    gtk4: implement GetDisplayScreenCount
    
    Change-Id: I23cb4607da4ec4bbe1a8dac0484b269a919011a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115317
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/unx/gtk/gtksys.hxx b/vcl/inc/unx/gtk/gtksys.hxx
index ef0376bebf86..7a70763e9929 100644
--- a/vcl/inc/unx/gtk/gtksys.hxx
+++ b/vcl/inc/unx/gtk/gtksys.hxx
@@ -36,8 +36,8 @@ public:
     SalX11Screen      GetDisplayDefaultXScreen()
             { return getXScreenFromDisplayScreen( GetDisplayBuiltInScreen() ); }
     SalX11Screen      getXScreenFromDisplayScreen(unsigned int nDisplayScreen);
-    void              countScreenMonitors();
 #if !GTK_CHECK_VERSION(4,0,0)
+    void              countScreenMonitors();
     // We have a 'screen' number that is combined from screen-idx + monitor-idx
     int        getScreenIdxFromPtr     (GdkScreen *pScreen);
     int        getScreenMonitorIdx     (GdkScreen *pScreen, int nX, int nY);
diff --git a/vcl/unx/gtk3/gtksys.cxx b/vcl/unx/gtk3/gtksys.cxx
index a1ca0cdd63be..d252fe38d5be 100644
--- a/vcl/unx/gtk3/gtksys.cxx
+++ b/vcl/unx/gtk3/gtksys.cxx
@@ -37,7 +37,9 @@ SalSystem *GtkInstance::CreateSalSystem()
 GtkSalSystem::GtkSalSystem() : SalGenericSystem()
 {
     mpDisplay = gdk_display_get_default();
+#if !GTK_CHECK_VERSION(4, 0, 0)
     countScreenMonitors();
+#endif
     // rhbz#1285356, native look will be gtk2, which crashes
     // when gtk3 is already loaded. Until there is a solution
     // java-side force look and feel to something that doesn't
@@ -77,6 +79,7 @@ struct GdkRectangleCoincident
 
 }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
 /**
  * GtkSalSystem::countScreenMonitors()
  *
@@ -87,7 +90,6 @@ struct GdkRectangleCoincident
 void
 GtkSalSystem::countScreenMonitors()
 {
-#if !GTK_CHECK_VERSION(4, 0, 0)
     maScreenMonitors.clear();
     for (gint i = 0; i < gdk_display_get_n_screens(mpDisplay); i++)
     {
@@ -112,8 +114,8 @@ GtkSalSystem::countScreenMonitors()
         }
         maScreenMonitors.emplace_back(pScreen, nMonitors);
     }
-#endif
 }
+#endif
 
 SalX11Screen
 GtkSalSystem::getXScreenFromDisplayScreen(unsigned int nScreen)
@@ -185,12 +187,12 @@ int GtkSalSystem::getScreenMonitorIdx (GdkScreen *pScreen,
 
 unsigned int GtkSalSystem::GetDisplayScreenCount()
 {
-#if !GTK_CHECK_VERSION(4, 0, 0)
+#if GTK_CHECK_VERSION(4, 0, 0)
+    return g_list_model_get_n_items(gdk_display_get_monitors(mpDisplay));
+#else
     gint nMonitor;
     (void)getScreenMonitorFromIdx (G_MAXINT, nMonitor);
     return G_MAXINT - nMonitor;
-#else
-    return 1;
 #endif
 }
 


More information about the Libreoffice-commits mailing list