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