Add ability to override workspace layout
A plugin that does workspace management on its on may want to set the workspace layout without having to deal with putting a property on the root window to be read back and parsed. Add meta_screen_override_window_layout() that allows the same types of layouts as _NET_DESKTOP_LAYOUT but without setting a property. https://bugzilla.gnome.org/show_bug.cgi?id=640552
This commit is contained in:
parent
2df95970d9
commit
8b220079d0
@ -50,14 +50,6 @@ struct _MetaMonitorInfo
|
|||||||
typedef void (* MetaScreenWindowFunc) (MetaScreen *screen, MetaWindow *window,
|
typedef void (* MetaScreenWindowFunc) (MetaScreen *screen, MetaWindow *window,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
META_SCREEN_TOPLEFT,
|
|
||||||
META_SCREEN_TOPRIGHT,
|
|
||||||
META_SCREEN_BOTTOMLEFT,
|
|
||||||
META_SCREEN_BOTTOMRIGHT
|
|
||||||
} MetaScreenCorner;
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
META_SCREEN_UP,
|
META_SCREEN_UP,
|
||||||
@ -127,6 +119,7 @@ struct _MetaScreen
|
|||||||
int columns_of_workspaces;
|
int columns_of_workspaces;
|
||||||
MetaScreenCorner starting_corner;
|
MetaScreenCorner starting_corner;
|
||||||
guint vertical_workspaces : 1;
|
guint vertical_workspaces : 1;
|
||||||
|
guint workspace_layout_overridden : 1;
|
||||||
|
|
||||||
guint keys_grabbed : 1;
|
guint keys_grabbed : 1;
|
||||||
guint all_keys_grabbed : 1;
|
guint all_keys_grabbed : 1;
|
||||||
|
@ -2163,6 +2163,9 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
|
|||||||
{
|
{
|
||||||
gulong *list;
|
gulong *list;
|
||||||
int n_items;
|
int n_items;
|
||||||
|
|
||||||
|
if (screen->workspace_layout_overridden)
|
||||||
|
return;
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
n_items = 0;
|
n_items = 0;
|
||||||
@ -2249,6 +2252,43 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
|
|||||||
screen->starting_corner);
|
screen->starting_corner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_screen_override_workspace_layout:
|
||||||
|
* @screen: a #MetaScreen
|
||||||
|
* @starting_corner: the corner at which the first workspace is found
|
||||||
|
* @vertical_layout: if %TRUE the workspaces are laid out in columns rather than rows
|
||||||
|
* @n_rows: number of rows of workspaces, or -1 to determine the number of rows from
|
||||||
|
* @n_columns and the total number of workspaces
|
||||||
|
* @n_columns: number of columns of workspaces, or -1 to determine the number of columns from
|
||||||
|
* @n_rows and the total number of workspaces
|
||||||
|
*
|
||||||
|
* Explicitly set the layout of workspaces. Once this has been called, the contents of the
|
||||||
|
* _NET_DESKTOP_LAYOUT property on the root window are completely ignored.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
meta_screen_override_workspace_layout (MetaScreen *screen,
|
||||||
|
MetaScreenCorner starting_corner,
|
||||||
|
gboolean vertical_layout,
|
||||||
|
int n_rows,
|
||||||
|
int n_columns)
|
||||||
|
{
|
||||||
|
g_return_if_fail (META_IS_SCREEN (screen));
|
||||||
|
g_return_if_fail (n_rows > 0 || n_columns > 0);
|
||||||
|
g_return_if_fail (n_rows != 0 && n_columns != 0);
|
||||||
|
|
||||||
|
screen->workspace_layout_overridden = TRUE;
|
||||||
|
screen->vertical_workspaces = vertical_layout != FALSE;
|
||||||
|
screen->starting_corner = starting_corner;
|
||||||
|
screen->rows_of_workspaces = n_rows;
|
||||||
|
screen->columns_of_workspaces = n_columns;
|
||||||
|
|
||||||
|
/* In theory we should remove _NET_DESKTOP_LAYOUT from _NET_SUPPORTED at this
|
||||||
|
* point, but it's unlikely that anybody checks that, and it's unlikely that
|
||||||
|
* anybody who checks that handles changes, so we'd probably just create
|
||||||
|
* a race condition. And it's hard to implement with the code in set_supported_hint()
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_workspace_names (MetaScreen *screen)
|
set_workspace_names (MetaScreen *screen)
|
||||||
{
|
{
|
||||||
|
@ -80,4 +80,17 @@ void meta_screen_get_monitor_geometry (MetaScreen *screen,
|
|||||||
int monitor,
|
int monitor,
|
||||||
MetaRectangle *geometry);
|
MetaRectangle *geometry);
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
META_SCREEN_TOPLEFT,
|
||||||
|
META_SCREEN_TOPRIGHT,
|
||||||
|
META_SCREEN_BOTTOMLEFT,
|
||||||
|
META_SCREEN_BOTTOMRIGHT
|
||||||
|
} MetaScreenCorner;
|
||||||
|
|
||||||
|
void meta_screen_override_workspace_layout (MetaScreen *screen,
|
||||||
|
MetaScreenCorner starting_corner,
|
||||||
|
gboolean vertical_layout,
|
||||||
|
int n_rows,
|
||||||
|
int n_columns);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user