39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
From 7eed6c94204de780e7248fa711da03f72f900080 Mon Sep 17 00:00:00 2001
|
|
From: rbuj <robert.buj@gmail.com>
|
|
Date: Wed, 26 Jan 2022 15:09:45 +0100
|
|
Subject: [PATCH] wncklet: do not exceed workspace number when setting n_rows
|
|
|
|
---
|
|
applets/wncklet/workspace-switcher.c | 11 +++++++----
|
|
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
|
|
index a58abce21..f908ffe1c 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);
|
|
@@ -823,6 +824,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 */
|
|
}
|