[PATCH weston 03/11] shell: Always bind F1-F6 to workspace changing

Jonas Ådahl jadahl at gmail.com
Sat Jan 26 06:33:33 PST 2013


Simplifies shell binding configuration. Binding handlers already
handles cases when number of workspaces are lower than the one
triggered.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 src/shell.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index 6d1d6eb..29459ea 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -3828,7 +3828,7 @@ static void
 shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
 {
 	uint32_t mod;
-	int i, num_workspace_bindings;
+	int i;
 
 	/* fixed bindings */
 	weston_compositor_add_key_binding(ec, KEY_BACKSPACE,
@@ -3880,15 +3880,10 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
 					  shell);
 
 	/* Add bindings for mod+F[1-6] for workspace 1 to 6. */
-	if (shell->workspaces.container.num > 1) {
-		num_workspace_bindings = shell->workspaces.container.num;
-		if (num_workspace_bindings > 6)
-			num_workspace_bindings = 6;
-		for (i = 0; i < num_workspace_bindings; i++)
-			weston_compositor_add_key_binding(ec, KEY_F1 + i, mod,
-							  workspace_f_binding,
-							  shell);
-	}
+	for (i = 0; i < 6; i++)
+		weston_compositor_add_key_binding(ec, KEY_F1 + i, mod,
+						  workspace_f_binding,
+						  shell);
 
 	/* Debug bindings */
 	weston_compositor_add_key_binding(ec, KEY_SPACE, mod | MODIFIER_SHIFT,
-- 
1.7.10.4



More information about the wayland-devel mailing list