window: Add function to calculate current bounds
This will later be used to tell Wayland clients about a size they shouldn't exceed. If the window doesn't have a main monitor, this function does nothing and returns FALSE. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
This commit is contained in:
parent
213f0d8dd3
commit
17e239246a
@ -912,4 +912,8 @@ void meta_window_clear_queued (MetaWindow *window);
|
||||
|
||||
void meta_window_update_layout (MetaWindow *window);
|
||||
|
||||
gboolean meta_window_calculate_bounds (MetaWindow *window,
|
||||
int *bounds_width,
|
||||
int *bounds_height);
|
||||
|
||||
#endif
|
||||
|
@ -8555,3 +8555,29 @@ meta_window_get_alive (MetaWindow *window)
|
||||
{
|
||||
return window->is_alive;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_window_calculate_bounds (MetaWindow *window,
|
||||
int *bounds_width,
|
||||
int *bounds_height)
|
||||
{
|
||||
MetaLogicalMonitor *main_monitor;
|
||||
|
||||
main_monitor = meta_window_get_main_logical_monitor (window);
|
||||
if (main_monitor)
|
||||
{
|
||||
MetaRectangle work_area;
|
||||
|
||||
meta_window_get_work_area_for_logical_monitor (window,
|
||||
main_monitor,
|
||||
&work_area);
|
||||
|
||||
*bounds_width = work_area.width;
|
||||
*bounds_height = work_area.height;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user