window: Add meta_window_is_monitor_sized

We duplicate this checks in multiple places so lets add this to
avoid code duplication.
This commit is contained in:
Adel Gadllah 2013-02-17 21:12:45 +01:00
parent a215852d3c
commit a6a9d3f448
2 changed files with 34 additions and 0 deletions

View File

@ -3646,6 +3646,39 @@ meta_window_is_fullscreen (MetaWindow *window)
return window->fullscreen;
}
/**
* meta_window_is_monitor_sized:
*
* Return value: %TRUE if the window is occupies an entire monitor or
* the whole screen.
*/
gboolean
meta_window_is_monitor_sized (MetaWindow *window)
{
if (window->fullscreen)
return TRUE;
if (window->override_redirect)
{
MetaRectangle window_rect, monitor_rect;
int screen_width, screen_height;
meta_screen_get_size (window->screen, &screen_width, &screen_height);
meta_window_get_outer_rect (window, &window_rect);
if (window_rect.x == 0 && window_rect.y == 0 &&
window_rect.width == screen_width && window_rect.height == screen_height)
return TRUE;
meta_screen_get_monitor_geometry (window->screen, window->monitor->number, &monitor_rect);
if (meta_rectangle_equal (&window_rect, &monitor_rect))
return TRUE;
}
return FALSE;
}
/**
* meta_window_is_on_primary_monitor:
*

View File

@ -141,6 +141,7 @@ void meta_window_foreach_ancestor (MetaWindow *window,
MetaMaximizeFlags meta_window_get_maximized (MetaWindow *window);
gboolean meta_window_is_fullscreen (MetaWindow *window);
gboolean meta_window_is_monitor_sized (MetaWindow *window);
gboolean meta_window_is_on_primary_monitor (MetaWindow *window);
gboolean meta_window_requested_bypass_compositor (MetaWindow *window);
gboolean meta_window_requested_dont_bypass_compositor (MetaWindow *window);