mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
Change variable name; add key_remove
This commit is contained in:
parent
fe5704d403
commit
7ec472cd22
3 changed files with 9 additions and 8 deletions
|
|
@ -20,7 +20,7 @@ struct keybind {
|
|||
int keycodes_layout;
|
||||
struct wl_list actions; /* struct action.link */
|
||||
struct wl_list link; /* struct rcxml.keybinds */
|
||||
bool mod_only; /* set if only modifier keys used */
|
||||
bool on_release; /* set if only modifier keys used */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ keybind_create(const char *keybind)
|
|||
xkb_keysym_t sym;
|
||||
struct keybind *k = znew(*k);
|
||||
xkb_keysym_t keysyms[MAX_KEYSYMS];
|
||||
bool mod_only = TRUE;
|
||||
bool on_release = true;
|
||||
gchar **symnames = g_strsplit(keybind, "-", -1);
|
||||
for (size_t i = 0; symnames[i]; i++) {
|
||||
char *symname = symnames[i];
|
||||
|
|
@ -132,7 +132,7 @@ keybind_create(const char *keybind)
|
|||
} else {
|
||||
sym = xkb_keysym_from_name(symname, XKB_KEYSYM_CASE_INSENSITIVE);
|
||||
if (!keyboard_is_modifier_key(sym)) {
|
||||
mod_only = FALSE;
|
||||
on_release = false;
|
||||
}
|
||||
if (sym == XKB_KEY_NoSymbol && g_utf8_strlen(symname, -1) == 1) {
|
||||
/*
|
||||
|
|
@ -168,7 +168,7 @@ keybind_create(const char *keybind)
|
|||
if (!k) {
|
||||
return NULL;
|
||||
}
|
||||
k->mod_only = mod_only;
|
||||
k->on_release = on_release;
|
||||
wl_list_append(&rc.keybinds, &k->link);
|
||||
k->keysyms = xmalloc(k->keysyms_len * sizeof(xkb_keysym_t));
|
||||
memcpy(k->keysyms, keysyms, k->keysyms_len * sizeof(xkb_keysym_t));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct keyinfo {
|
|||
|
||||
static bool should_cancel_cycling_on_next_key_release;
|
||||
|
||||
struct keybind *cur_keybind;
|
||||
static struct keybind *cur_keybind;
|
||||
|
||||
static void
|
||||
change_vt(struct server *server, unsigned int vt)
|
||||
|
|
@ -409,11 +409,12 @@ handle_compositor_keybindings(struct keyboard *keyboard,
|
|||
keyinfo.is_modifier);
|
||||
|
||||
if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
||||
if (cur_keybind && cur_keybind->mod_only) {
|
||||
if (cur_keybind && cur_keybind->on_release) {
|
||||
key_state_bound_key_remove(event->keycode);
|
||||
if (seat->active_client_while_inhibited
|
||||
|| seat->server->session_lock) {
|
||||
cur_keybind = NULL;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
actions_run(NULL, server, &cur_keybind->actions, 0);
|
||||
cur_keybind = NULL;
|
||||
|
|
@ -465,7 +466,7 @@ handle_compositor_keybindings(struct keyboard *keyboard,
|
|||
* 'pressed-sent' keys to the new surface.
|
||||
*/
|
||||
key_state_store_pressed_key_as_bound(event->keycode);
|
||||
if (!cur_keybind->mod_only) {
|
||||
if (!cur_keybind->on_release) {
|
||||
actions_run(NULL, server, &cur_keybind->actions, 0);
|
||||
cur_keybind = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue