workspace-manager: Expose layout properties

gnome-shell hardcodes a vertical one-column workspace layout, and
while not supporting arbitrary grids is very much by design, it
currently doesn't have a choice: We simply don't expose the workspace
layout we use.

Change that to allow gnome-shell to be a bit more flexible with the
workspace layouts it supports.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/618
This commit is contained in:
Florian Müllner 2019-06-04 21:21:37 +02:00
parent 01e20a6ba9
commit 5a4bc15d0b

View File

@ -50,6 +50,9 @@ enum
{
PROP_0,
PROP_LAYOUT_COLUMNS,
PROP_LAYOUT_ROWS,
PROP_N_WORKSPACES
};
@ -68,6 +71,12 @@ meta_workspace_manager_get_property (GObject *object,
switch (prop_id)
{
case PROP_LAYOUT_COLUMNS:
g_value_set_int (value, workspace_manager->columns_of_workspaces);
break;
case PROP_LAYOUT_ROWS:
g_value_set_int (value, workspace_manager->rows_of_workspaces);
break;
case PROP_N_WORKSPACES:
g_value_set_int (value, meta_workspace_manager_get_n_workspaces (workspace_manager));
break;
@ -154,6 +163,22 @@ meta_workspace_manager_class_init (MetaWorkspaceManagerClass *klass)
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
g_object_class_install_property (object_class,
PROP_LAYOUT_COLUMNS,
g_param_spec_int ("layout-columns",
"Layout columns",
"Number of columns in layout",
-1, G_MAXINT, 1,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_LAYOUT_ROWS,
g_param_spec_int ("layout-rows",
"Layout rows",
"Number of rows in layout",
-1, G_MAXINT, -1,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_N_WORKSPACES,
g_param_spec_int ("n-workspaces",
@ -474,6 +499,8 @@ meta_workspace_manager_update_workspace_layout (MetaWorkspaceManager *workspace_
workspace_manager->columns_of_workspaces,
workspace_manager->vertical_workspaces,
workspace_manager->starting_corner);
g_object_notify (G_OBJECT (workspace_manager), "layout-columns");
g_object_notify (G_OBJECT (workspace_manager), "layout-rows");
}
/**