kiosk-shell: Enable debug keybindings

We are missing debug keybinds in kiosk-shell so install them. Adds
the binding-modifier like in desktop-shell in a helper.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 3 years ago committed by Daniel Stone
parent dac2f146ea
commit f7ba35f5fc
  1. 12
      kiosk-shell/kiosk-shell.c
  2. 31
      shell-utils/shell-utils.c
  3. 6
      shell-utils/shell-utils.h

@ -1064,15 +1064,21 @@ kiosk_shell_touch_to_activate_binding(struct weston_touch *touch,
static void static void
kiosk_shell_add_bindings(struct kiosk_shell *shell) kiosk_shell_add_bindings(struct kiosk_shell *shell)
{ {
weston_compositor_add_button_binding(shell->compositor, BTN_LEFT, 0, uint32_t mod = 0;
mod = weston_shell_get_binding_modifier(shell->config, MODIFIER_SUPER);
weston_compositor_add_button_binding(shell->compositor, BTN_LEFT, mod,
kiosk_shell_click_to_activate_binding, kiosk_shell_click_to_activate_binding,
shell); shell);
weston_compositor_add_button_binding(shell->compositor, BTN_RIGHT, 0, weston_compositor_add_button_binding(shell->compositor, BTN_RIGHT, mod,
kiosk_shell_click_to_activate_binding, kiosk_shell_click_to_activate_binding,
shell); shell);
weston_compositor_add_touch_binding(shell->compositor, 0, weston_compositor_add_touch_binding(shell->compositor, mod,
kiosk_shell_touch_to_activate_binding, kiosk_shell_touch_to_activate_binding,
shell); shell);
weston_install_debug_key_binding(shell->compositor, mod);
} }
static void static void

@ -212,3 +212,34 @@ weston_curtain_destroy(struct weston_curtain *curtain)
weston_buffer_destroy_solid(curtain->buffer_ref); weston_buffer_destroy_solid(curtain->buffer_ref);
free(curtain); free(curtain);
} }
uint32_t
weston_shell_get_binding_modifier(struct weston_config *config,
uint32_t default_mod)
{
struct weston_config_section *shell_section = NULL;
char *mod_string = NULL;
uint32_t mod = default_mod;
if (config)
shell_section = weston_config_get_section(config, "shell", NULL, NULL);
if (shell_section)
weston_config_section_get_string(shell_section,
"binding-modifier", &mod_string, "super");
if (!mod_string || !strcmp(mod_string, "none"))
mod = default_mod;
else if (!strcmp(mod_string, "super"))
mod = MODIFIER_SUPER;
else if (!strcmp(mod_string, "alt"))
mod = MODIFIER_ALT;
else if (!strcmp(mod_string, "ctrl"))
mod = MODIFIER_CTRL;
else if (!strcmp(mod_string, "shift"))
mod = MODIFIER_SHIFT;
free(mod_string);
return mod;
}

@ -26,6 +26,9 @@
#include "shared/helpers.h" #include "shared/helpers.h"
#include <libweston/libweston.h> #include <libweston/libweston.h>
#include <libweston/config-parser.h>
#include <string.h>
/* parameter for weston_curtain_create() */ /* parameter for weston_curtain_create() */
struct weston_curtain_params { struct weston_curtain_params {
int (*get_label)(struct weston_surface *es, char *buf, size_t len); int (*get_label)(struct weston_surface *es, char *buf, size_t len);
@ -63,3 +66,6 @@ weston_curtain_create(struct weston_compositor *compositor,
struct weston_curtain_params *params); struct weston_curtain_params *params);
void void
weston_curtain_destroy(struct weston_curtain *curtain); weston_curtain_destroy(struct weston_curtain *curtain);
uint32_t
weston_shell_get_binding_modifier(struct weston_config *config, uint32_t default_mod);

Loading…
Cancel
Save