Add API for getting work area given a logical monitor
To complement the current API which takes an index referencing a logical monitor in the logical monitor array, add API that takes a direct reference to the logical monitor itself. The intention is to replace the usage of the index based API with one that doesn't rely on internal implementation details. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
e659b07c39
commit
79fd91ec35
@ -630,6 +630,10 @@ gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
|||||||
|
|
||||||
GList* meta_window_get_workspaces (MetaWindow *window);
|
GList* meta_window_get_workspaces (MetaWindow *window);
|
||||||
|
|
||||||
|
void meta_window_get_work_area_for_logical_monitor (MetaWindow *window,
|
||||||
|
MetaLogicalMonitor *logical_monitor,
|
||||||
|
MetaRectangle *area);
|
||||||
|
|
||||||
int meta_window_get_current_tile_monitor_number (MetaWindow *window);
|
int meta_window_get_current_tile_monitor_number (MetaWindow *window);
|
||||||
void meta_window_get_current_tile_area (MetaWindow *window,
|
void meta_window_get_current_tile_area (MetaWindow *window,
|
||||||
MetaRectangle *tile_area);
|
MetaRectangle *tile_area);
|
||||||
|
@ -6095,31 +6095,24 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
get_work_area_monitor (MetaWindow *window,
|
meta_window_get_work_area_for_logical_monitor (MetaWindow *window,
|
||||||
MetaRectangle *area,
|
MetaLogicalMonitor *logical_monitor,
|
||||||
int which_monitor)
|
MetaRectangle *area)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
|
||||||
MetaMonitorManager *monitor_manager =
|
|
||||||
meta_backend_get_monitor_manager (backend);
|
|
||||||
MetaLogicalMonitor *logical_monitors;
|
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
|
|
||||||
g_assert (which_monitor >= 0);
|
g_assert (logical_monitor);
|
||||||
|
|
||||||
logical_monitors = meta_monitor_manager_get_logical_monitors (monitor_manager,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* Initialize to the whole monitor */
|
/* Initialize to the whole monitor */
|
||||||
*area = logical_monitors[which_monitor].rect;
|
*area = logical_monitor->rect;
|
||||||
|
|
||||||
tmp = meta_window_get_workspaces (window);
|
tmp = meta_window_get_workspaces (window);
|
||||||
while (tmp != NULL)
|
while (tmp != NULL)
|
||||||
{
|
{
|
||||||
MetaRectangle workspace_work_area;
|
MetaRectangle workspace_work_area;
|
||||||
meta_workspace_get_work_area_for_monitor (tmp->data,
|
meta_workspace_get_work_area_for_logical_monitor (tmp->data,
|
||||||
which_monitor,
|
logical_monitor,
|
||||||
&workspace_work_area);
|
&workspace_work_area);
|
||||||
meta_rectangle_intersect (area,
|
meta_rectangle_intersect (area,
|
||||||
&workspace_work_area,
|
&workspace_work_area,
|
||||||
@ -6129,7 +6122,7 @@ get_work_area_monitor (MetaWindow *window,
|
|||||||
|
|
||||||
meta_topic (META_DEBUG_WORKAREA,
|
meta_topic (META_DEBUG_WORKAREA,
|
||||||
"Window %s monitor %d has work area %d,%d %d x %d\n",
|
"Window %s monitor %d has work area %d,%d %d x %d\n",
|
||||||
window->desc, which_monitor,
|
window->desc, logical_monitor->number,
|
||||||
area->x, area->y, area->width, area->height);
|
area->x, area->y, area->width, area->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6163,11 +6156,17 @@ meta_window_get_work_area_for_monitor (MetaWindow *window,
|
|||||||
int which_monitor,
|
int which_monitor,
|
||||||
MetaRectangle *area)
|
MetaRectangle *area)
|
||||||
{
|
{
|
||||||
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend);
|
||||||
|
MetaLogicalMonitor *logical_monitor;
|
||||||
|
|
||||||
g_return_if_fail (which_monitor >= 0);
|
g_return_if_fail (which_monitor >= 0);
|
||||||
|
|
||||||
get_work_area_monitor (window,
|
logical_monitor =
|
||||||
area,
|
meta_monitor_manager_get_logical_monitor_from_number (monitor_manager,
|
||||||
which_monitor);
|
which_monitor);
|
||||||
|
|
||||||
|
meta_window_get_work_area_for_logical_monitor (window, logical_monitor, area);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,6 +82,10 @@ void meta_workspace_remove_window (MetaWorkspace *workspace,
|
|||||||
void meta_workspace_relocate_windows (MetaWorkspace *workspace,
|
void meta_workspace_relocate_windows (MetaWorkspace *workspace,
|
||||||
MetaWorkspace *new_home);
|
MetaWorkspace *new_home);
|
||||||
|
|
||||||
|
void meta_workspace_get_work_area_for_logical_monitor (MetaWorkspace *workspace,
|
||||||
|
MetaLogicalMonitor *logical_monitor,
|
||||||
|
MetaRectangle *area);
|
||||||
|
|
||||||
void meta_workspace_invalidate_work_area (MetaWorkspace *workspace);
|
void meta_workspace_invalidate_work_area (MetaWorkspace *workspace);
|
||||||
|
|
||||||
GList* meta_workspace_get_onscreen_region (MetaWorkspace *workspace);
|
GList* meta_workspace_get_onscreen_region (MetaWorkspace *workspace);
|
||||||
|
@ -1006,6 +1006,16 @@ meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
|
|||||||
meta_workspace_invalidate_work_area (workspace);
|
meta_workspace_invalidate_work_area (workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_workspace_get_work_area_for_logical_monitor (MetaWorkspace *workspace,
|
||||||
|
MetaLogicalMonitor *logical_monitor,
|
||||||
|
MetaRectangle *area)
|
||||||
|
{
|
||||||
|
meta_workspace_get_work_area_for_monitor (workspace,
|
||||||
|
logical_monitor->number,
|
||||||
|
area);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_workspace_get_work_area_for_monitor:
|
* meta_workspace_get_work_area_for_monitor:
|
||||||
* @workspace: a #MetaWorkspace
|
* @workspace: a #MetaWorkspace
|
||||||
|
Loading…
Reference in New Issue
Block a user