[PATCH v2 3/3] desktop-shell: Allow binding-modifier weston.ini option to be none

Bob Ham bob.ham at collabora.com
Tue Jan 12 02:21:49 PST 2016


Allow the binding-modifier option in weston.ini to take a value of
"none", meaning that none of the usual Super+Tab, Super+K, Super+Fn,
etc. key bindings will be enabled.

Signed-off-by: Bob Ham <bob.ham at collabora.com>
Reviewed-by: Derek Foreman <derekf at osg.samsung.com>
---
 desktop-shell/shell.c | 26 ++++++++++++++------------
 man/weston.ini.man    |  2 +-
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 474d118..6f1c167 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -610,6 +610,8 @@ get_modifier(char *modifier)
 		return MODIFIER_ALT;
 	else if (!strcmp("super", modifier))
 		return MODIFIER_SUPER;
+	else if (!strcmp("none", modifier))
+		return 0;
 	else
 		return MODIFIER_SUPER;
 }
@@ -660,10 +662,7 @@ shell_configuration(struct desktop_shell *shell)
 
 	weston_config_section_get_string(section,
 					 "exposay-modifier", &s, "none");
-	if (strcmp(s, "none") == 0)
-		shell->exposay_modifier = 0;
-	else
-		shell->exposay_modifier = get_modifier(s);
+	shell->exposay_modifier = get_modifier(s);
 	free(s);
 
 	weston_config_section_get_string(section, "animation", &s, "none");
@@ -6452,9 +6451,20 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
 	weston_compositor_add_axis_binding(ec, WL_POINTER_AXIS_VERTICAL_SCROLL,
 					   MODIFIER_SUPER, zoom_axis_binding,
 					   NULL);
+	weston_compositor_add_key_binding(ec, KEY_BRIGHTNESSDOWN, 0,
+				          backlight_binding, ec);
+	weston_compositor_add_key_binding(ec, KEY_BRIGHTNESSUP, 0,
+				          backlight_binding, ec);
 
 	/* configurable bindings */
+	if (shell->exposay_modifier)
+		weston_compositor_add_modifier_binding(ec, shell->exposay_modifier,
+						       exposay_binding, shell);
+
 	mod = shell->binding_modifier;
+	if (!mod)
+		return;
+
 	weston_compositor_add_key_binding(ec, KEY_PAGEUP, mod,
 					  zoom_key_binding, NULL);
 	weston_compositor_add_key_binding(ec, KEY_PAGEDOWN, mod,
@@ -6480,12 +6490,8 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
 					  shell);
 	weston_compositor_add_key_binding(ec, KEY_F9, mod, backlight_binding,
 					  ec);
-	weston_compositor_add_key_binding(ec, KEY_BRIGHTNESSDOWN, 0,
-				          backlight_binding, ec);
 	weston_compositor_add_key_binding(ec, KEY_F10, mod, backlight_binding,
 					  ec);
-	weston_compositor_add_key_binding(ec, KEY_BRIGHTNESSUP, 0,
-				          backlight_binding, ec);
 	weston_compositor_add_key_binding(ec, KEY_K, mod,
 				          force_kill_binding, shell);
 	weston_compositor_add_key_binding(ec, KEY_UP, mod,
@@ -6499,10 +6505,6 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
 					  workspace_move_surface_down_binding,
 					  shell);
 
-	if (shell->exposay_modifier)
-		weston_compositor_add_modifier_binding(ec, shell->exposay_modifier,
-						       exposay_binding, shell);
-
 	/* Add bindings for mod+F[1-6] for workspace 1 to 6. */
 	if (shell->workspaces.num > 1) {
 		num_workspace_bindings = shell->workspaces.num;
diff --git a/man/weston.ini.man b/man/weston.ini.man
index 6ebe68a..6e92066 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -266,7 +266,7 @@ pressed
 sets the modifier key used for common bindings (string), such as moving
 surfaces, resizing, rotating, switching, closing and setting the transparency
 for windows, controlling the backlight and zooming the desktop. Possible values:
-ctrl, alt, super (default)
+none, ctrl, alt, super (default)
 .TP 7
 .BI "num-workspaces=" 6
 defines the number of workspaces (unsigned integer). The user can switch
-- 
2.1.4



More information about the wayland-devel mailing list