From 5a4bc15d0b047fa8ea3392fcfe24340ccfc44789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 4 Jun 2019 21:21:37 +0200 Subject: [PATCH] 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 --- src/core/meta-workspace-manager.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/core/meta-workspace-manager.c b/src/core/meta-workspace-manager.c index 8e1f03fe8..3af6c781c 100644 --- a/src/core/meta-workspace-manager.c +++ b/src/core/meta-workspace-manager.c @@ -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"); } /**