From c4602959df4f2856e49ebf6b6c7a03be00d311f4 Mon Sep 17 00:00:00 2001 From: rbuj Date: Wed, 26 Jan 2022 15:09:45 +0100 Subject: wncklet: do not exceed workspace number when setting n_rows --- applets/wncklet/workspace-switcher.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'applets') 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 */ } -- cgit v1.2.1