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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 11 10:17:10 UTC 2021


 vcl/unx/gtk3/gtkframe.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 56ba9c544d2e5dce9022a245a6835d79bbf0f31d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 11 09:52:36 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Aug 11 12:16:35 2021 +0200

    gtk4: use monitor size for workarea
    
    which is better than nothing now that gdk_monitor_get_workarea is gone
    
    Change-Id: I8e691f733ec05d981a621f17efa5c968fd078193
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120311
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 3b23b5c2a07e..cd596b3a4297 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -1835,20 +1835,24 @@ void GtkSalFrame::GetClientSize( tools::Long& rWidth, tools::Long& rHeight )
 
 void GtkSalFrame::GetWorkArea( tools::Rectangle& rRect )
 {
+    GdkRectangle aRect;
 #if !GTK_CHECK_VERSION(4, 0, 0)
     GdkScreen  *pScreen = gtk_widget_get_screen(m_pWindow);
     tools::Rectangle aRetRect;
     int max = gdk_screen_get_n_monitors (pScreen);
     for (int i = 0; i < max; ++i)
     {
-        GdkRectangle aRect;
         gdk_screen_get_monitor_workarea(pScreen, i, &aRect);
         tools::Rectangle aMonitorRect(aRect.x, aRect.y, aRect.x+aRect.width, aRect.y+aRect.height);
         aRetRect.Union(aMonitorRect);
     }
     rRect = aRetRect;
 #else
-    (void)rRect;
+    GdkDisplay* pDisplay = gtk_widget_get_display(m_pWindow);
+    GdkSurface* gdkWindow = widget_get_surface(m_pWindow);
+    GdkMonitor* pMonitor = gdk_display_get_monitor_at_surface(pDisplay, gdkWindow);
+    gdk_monitor_get_geometry(pMonitor, &aRect);
+    rRect = tools::Rectangle(aRect.x, aRect.y, aRect.x+aRect.width, aRect.y+aRect.height);
 #endif
 }
 


More information about the Libreoffice-commits mailing list