window: Add a meta_window_get_titlebar_rect

This commit is contained in:
Jasper St. Pierre
2014-05-22 16:48:58 -04:00
parent 0890eaa3fe
commit 3a0af0faae
4 changed files with 35 additions and 26 deletions

View File

@ -4310,6 +4310,28 @@ meta_window_get_client_area_rect (const MetaWindow *window,
rect->height = window->rect.height;
}
void
meta_window_get_titlebar_rect (MetaWindow *window,
MetaRectangle *rect)
{
meta_window_get_frame_rect (window, rect);
/* The returned rectangle is relative to the frame rect. */
rect->x = 0;
rect->y = 0;
if (window->frame)
{
rect->height = window->frame->child_y;
}
else
{
/* Pick an arbitrary height for a titlebar. We might want to
* eventually have CSD windows expose their borders to us. */
rect->height = 15;
}
}
const char*
meta_window_get_startup_id (MetaWindow *window)
{
@ -5381,8 +5403,7 @@ meta_window_titlebar_is_onscreen (MetaWindow *window)
return TRUE;
/* Get the rectangle corresponding to the titlebar */
meta_window_get_frame_rect (window, &titlebar_rect);
titlebar_rect.height = window->frame->child_y;
meta_window_get_titlebar_rect (window, &titlebar_rect);
/* Run through the spanning rectangles for the screen and see if one of
* them overlaps with the titlebar sufficiently to consider it onscreen.