From 6b8e2636911c79d77d95aaac62336dd4f4063f63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Tue, 4 Jun 2019 21:21:37 +0200
Subject: [PATCH] screen: Expose workspace 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/screen.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/core/screen.c b/src/core/screen.c
index c14bba0cf..4fac02cdb 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -81,6 +81,9 @@ static void on_monitors_changed (MetaMonitorManager *manager,
enum
{
PROP_N_WORKSPACES = 1,
+
+ PROP_LAYOUT_COLUMNS,
+ PROP_LAYOUT_ROWS,
};
enum
@@ -138,6 +141,12 @@ meta_screen_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_LAYOUT_COLUMNS:
+ g_value_set_int (value, screen->columns_of_workspaces);
+ break;
+ case PROP_LAYOUT_ROWS:
+ g_value_set_int (value, screen->rows_of_workspaces);
+ break;
case PROP_N_WORKSPACES:
g_value_set_int (value, meta_screen_get_n_workspaces (screen));
break;
@@ -261,6 +270,22 @@ meta_screen_class_init (MetaScreenClass *klass)
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,
pspec);
@@ -1753,6 +1778,8 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
screen->columns_of_workspaces,
screen->vertical_workspaces,
screen->starting_corner);
+ g_object_notify (G_OBJECT (screen), "layout-columns");
+ g_object_notify (G_OBJECT (screen), "layout-rows");
}
/**
--
2.21.0