window: Add is_screen_sized method

Add a method that returns whether the window occupies
the whole screen (i.e all montiors).
This commit is contained in:
Adel Gadllah 2013-02-18 13:30:37 +01:00
parent 027593faa5
commit e9709b7ff9
2 changed files with 26 additions and 7 deletions

View File

@ -3646,6 +3646,28 @@ meta_window_is_fullscreen (MetaWindow *window)
return window->fullscreen;
}
/**
* meta_window_is_screen_sized:
*
* Return value: %TRUE if the window is occupies the
* the whole screen (all monitors).
*/
gboolean
meta_window_is_screen_sized (MetaWindow *window)
{
MetaRectangle window_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;
return FALSE;
}
/**
* meta_window_is_monitor_sized:
*
@ -3658,18 +3680,14 @@ meta_window_is_monitor_sized (MetaWindow *window)
if (window->fullscreen)
return TRUE;
if (meta_window_is_screen_sized (window))
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))

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_screen_sized (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);