mutter/0009-window-x11-Add-function-to-convert-the-surface-to-cl.patch

56 lines
2.2 KiB
Diff

From be11525b28da70ff60eb40925127d187a3f50672 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Wed, 26 Feb 2020 11:03:48 +0100
Subject: [PATCH 09/48] window/x11: Add function to convert the surface to
client area
Add a convenient function to get the client area rectangle from a given
surface rectangle.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1091
---
src/x11/window-x11.c | 16 ++++++++++++++++
src/x11/window-x11.h | 4 +++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index 2c745f4aa..49f7f1526 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -4092,3 +4092,19 @@ meta_window_x11_buffer_rect_to_frame_rect (MetaWindow *window,
frame_rect->width -= borders.invisible.left + borders.invisible.right;
frame_rect->height -= borders.invisible.top + borders.invisible.bottom;
}
+
+void
+meta_window_x11_surface_rect_to_client_rect (MetaWindow *window,
+ MetaRectangle *surface_rect,
+ MetaRectangle *client_rect)
+{
+ MetaFrameBorders borders;
+
+ meta_frame_calc_borders (window->frame, &borders);
+
+ *client_rect = *surface_rect;
+ client_rect->x += borders.total.left;
+ client_rect->y += borders.total.top;
+ client_rect->width -= borders.total.left + borders.total.right;
+ client_rect->height -= borders.total.top + borders.total.bottom;
+}
diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h
index 03c52c5ab..7f4f96f6c 100644
--- a/src/x11/window-x11.h
+++ b/src/x11/window-x11.h
@@ -92,5 +92,7 @@ gboolean meta_window_x11_always_update_shape (MetaWindow *window);
void meta_window_x11_buffer_rect_to_frame_rect (MetaWindow *window,
MetaRectangle *buffer_rect,
MetaRectangle *frame_rect);
-
+void meta_window_x11_surface_rect_to_client_rect (MetaWindow *window,
+ MetaRectangle *surface_rect,
+ MetaRectangle *client_rect);
#endif
--
2.26.0.rc2