summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-11-15 10:26:53 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-11-15 13:38:04 +0100
commit28fc57ee7dcd26284649c5fefbf5d06abd9b70ca (patch)
tree6117dc2d24686ca5c416e88c816c5b24dd8e7cc9
parent5470514db7993b4c9f079a961adc30d70fb77fba (diff)
gtk4: implement something meaningful for get_monitor_workarea
Change-Id: I3f107f591ebdcaad2f4e986a665b132ccfb78f1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125224 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index bb34db67447c..ef1a817d1de1 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -6040,16 +6040,18 @@ namespace
tools::Rectangle get_monitor_workarea(GtkWidget* pWindow)
{
+ GdkRectangle aRect;
#if !GTK_CHECK_VERSION(4, 0, 0)
GdkScreen* pScreen = gtk_widget_get_screen(pWindow);
gint nMonitor = gdk_screen_get_monitor_at_window(pScreen, widget_get_surface(pWindow));
- GdkRectangle aRect;
gdk_screen_get_monitor_workarea(pScreen, nMonitor, &aRect);
- return tools::Rectangle(aRect.x, aRect.y, aRect.x + aRect.width, aRect.y + aRect.height);
#else
- (void)pWindow;
- return tools::Rectangle();
+ GdkDisplay* pDisplay = gtk_widget_get_display(pWindow);
+ GdkSurface* gdkWindow = widget_get_surface(pWindow);
+ GdkMonitor* pMonitor = gdk_display_get_monitor_at_surface(pDisplay, gdkWindow);
+ gdk_monitor_get_geometry(pMonitor, &aRect);
#endif
+ return tools::Rectangle(aRect.x, aRect.y, aRect.x + aRect.width, aRect.y + aRect.height);
}