[mutter] window/x11: Add function to convert the buffer to frame rect
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window/x11: Add function to convert the buffer to frame rect
- Date: Wed, 29 Jan 2020 11:05:21 +0000 (UTC)
commit 1000ebe203fa56fafc1757f8c087862181279f4b
Author: Olivier Fourdan <ofourdan redhat com>
Date: Fri Jan 17 17:56:12 2020 +0100
window/x11: Add function to convert the buffer to frame rect
Add a convenient function to get the frame rectangle from a given
buffer.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1009
src/x11/window-x11.c | 19 +++++++++++++++++++
src/x11/window-x11.h | 4 ++++
2 files changed, 23 insertions(+)
---
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index 87067955b..aeaebb7c7 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -4066,3 +4066,22 @@ meta_window_x11_always_update_shape (MetaWindow *window)
return META_WINDOW_X11_GET_CLASS (window_x11)->always_update_shape (window);
}
+
+void
+meta_window_x11_buffer_rect_to_frame_rect (MetaWindow *window,
+ MetaRectangle *buffer_rect,
+ MetaRectangle *frame_rect)
+
+{
+ MetaFrameBorders borders;
+
+ g_return_if_fail (window->frame);
+
+ meta_frame_calc_borders (window->frame, &borders);
+
+ *frame_rect = *buffer_rect;
+ frame_rect->x += borders.invisible.left;
+ frame_rect->y += borders.invisible.top;
+ frame_rect->width -= borders.invisible.left + borders.invisible.right;
+ frame_rect->height -= borders.invisible.top + borders.invisible.bottom;
+}
diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h
index 256bca568..03c52c5ab 100644
--- a/src/x11/window-x11.h
+++ b/src/x11/window-x11.h
@@ -89,4 +89,8 @@ void meta_window_x11_set_thaw_after_paint (MetaWindow *window,
gboolean meta_window_x11_should_thaw_after_paint (MetaWindow *window);
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);
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]