summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk3/gtksys.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-05-10 11:04:52 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-05-10 13:36:58 +0200
commit603c959482ae89c16240b07bd1698d060cdf7a87 (patch)
treef6b8459f685a11f8b7a9561973e5b9b96381a085 /vcl/unx/gtk3/gtksys.cxx
parentcbfeec278196f2083db52cb6b1eb627b624b44aa (diff)
gtk4: implement GetDisplayScreenCount
Change-Id: I23cb4607da4ec4bbe1a8dac0484b269a919011a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115317 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx/gtk3/gtksys.cxx')
-rw-r--r--vcl/unx/gtk3/gtksys.cxx12
1 files changed, 7 insertions, 5 deletions
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
}