summaryrefslogtreecommitdiff
path: root/applets/wncklet/workspace-switcher.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2022-01-26 15:09:45 +0100
committerraveit65 <[email protected]>2022-02-20 14:04:23 +0100
commitc4602959df4f2856e49ebf6b6c7a03be00d311f4 (patch)
tree6730e308397343b87ba9c5411929391c8e35e33a /applets/wncklet/workspace-switcher.c
parent8d44fb8753b429f2c01e9ce964960723c5cabf54 (diff)
downloadmate-panel-c4602959df4f2856e49ebf6b6c7a03be00d311f4.tar.bz2
mate-panel-c4602959df4f2856e49ebf6b6c7a03be00d311f4.tar.xz
wncklet: do not exceed workspace number when setting n_rows
Diffstat (limited to 'applets/wncklet/workspace-switcher.c')
-rw-r--r--applets/wncklet/workspace-switcher.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index 153614d9..065e951a 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -490,11 +490,12 @@ static const GtkActionEntry pager_menu_actions[] = {
static void num_rows_changed(GSettings* settings, gchar* key, PagerData* pager)
{
- int n_rows = DEFAULT_ROWS;
+ int n_rows;
- n_rows = g_settings_get_int (settings, key);
-
- n_rows = CLAMP(n_rows, 1, MAX_REASONABLE_ROWS);
+ n_rows = CLAMP (g_settings_get_int (settings, key),
+ 1,
+ MIN (wnck_screen_get_workspace_count (pager->screen),
+ MAX_REASONABLE_ROWS));
pager->n_rows = n_rows;
pager_update(pager);
@@ -835,6 +836,8 @@ on_num_workspaces_value_changed (GtkSpinButton *button,
{
int workspace_count = gtk_spin_button_get_value_as_int (button);
wnck_screen_change_workspace_count(pager->screen, workspace_count);
+ if (workspace_count < pager->n_rows)
+ g_settings_set_int (pager->settings, "num-rows", workspace_count);
}
#endif /* HAVE_X11 */
}