[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 11 15:58:03 UTC 2021
vcl/unx/gtk3/gtksys.cxx | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
New commits:
commit 87d795a7a25934b11095f401c3bda73056f4f3d6
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 11 15:55:22 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue May 11 17:57:13 2021 +0200
gtk4: incomplete GetDisplayBuiltInScreen implementation
only x11 possible as far as I can see, maybe we can assume index 0 is
built-in otherwise. We like to default to put the presentation console
on the built-in laptop monitor and the presentation on the external
projector.
Change-Id: I5d17403032b04750a5fb4d52904db0a81a6234c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115436
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 aa822c3e4b3e..cf5461fef023 100644
--- a/vcl/unx/gtk3/gtksys.cxx
+++ b/vcl/unx/gtk3/gtksys.cxx
@@ -207,12 +207,27 @@ bool GtkSalSystem::IsUnifiedDisplay()
unsigned int GtkSalSystem::GetDisplayBuiltInScreen()
{
-#if !GTK_CHECK_VERSION(4, 0, 0)
+#if GTK_CHECK_VERSION(4, 0, 0)
+#if defined(GDK_WINDOWING_X11)
+ if (DLSYM_GDK_IS_X11_DISPLAY(mpDisplay))
+ {
+ GdkMonitor* pPrimary = gdk_x11_display_get_primary_monitor(mpDisplay);
+ GListModel* pList = gdk_display_get_monitors(mpDisplay);
+ int nIndex = 0;
+ while (gpointer pElem = g_list_model_get_item(pList, nIndex))
+ {
+ if (pElem == pPrimary)
+ return nIndex;
+ ++nIndex;
+ }
+ }
+#endif
+ // nothing for wayland ?, hope for the best that its at index 0
+ return 0;
+#else // !GTK_CHECK_VERSION(4, 0, 0)
GdkScreen *pDefault = gdk_display_get_default_screen (mpDisplay);
int idx = getScreenIdxFromPtr (pDefault);
return idx + gdk_screen_get_primary_monitor(pDefault);
-#else
- return 0;
#endif
}
More information about the Libreoffice-commits
mailing list