aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-12-10 10:07:16 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-12-10 10:07:16 +0100
commit37b0e88b07655eb7c93adbf74ffa9fa8694fdaf1 (patch)
treede60dad42abf12d9c94b5dd6481eae87b6545749
parent6837027fd885a3617fcebeae2cd74788d48ae8df (diff)
downloadd2tk-37b0e88b07655eb7c93adbf74ffa9fa8694fdaf1.tar.xz
base: handle vterm key modifiers.
-rw-r--r--VERSION2
-rw-r--r--src/base_pty.c57
2 files changed, 37 insertions, 22 deletions
diff --git a/VERSION b/VERSION
index af4df06..d0e2ef6 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.909
+0.1.911
diff --git a/src/base_pty.c b/src/base_pty.c
index a106f5b..acb1f03 100644
--- a/src/base_pty.c
+++ b/src/base_pty.c
@@ -504,65 +504,80 @@ _term_behave(d2tk_base_t *base, d2tk_atom_body_pty_t *vpty,
const d2tk_state_t state = d2tk_base_is_active_hot(base, D2TK_ID, rect,
D2TK_FLAG_NONE);
+ VTermModifier mod = VTERM_MOD_NONE;
+
+ if(d2tk_base_get_modmask(base, D2TK_MODMASK_SHIFT, false))
+ {
+ mod |= VTERM_MOD_SHIFT;
+ }
+ if(d2tk_base_get_modmask(base, D2TK_MODMASK_ALT, false))
+ {
+ mod |= VTERM_MOD_ALT;
+ }
+ if(d2tk_base_get_modmask(base, D2TK_MODMASK_CTRL, false))
+ {
+ mod |= VTERM_MOD_CTRL;
+ }
+
if(d2tk_state_is_focused(state))
{
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_ENTER, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_ENTER, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_ENTER, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_TAB, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_TAB, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_TAB, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_BACKSPACE, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_BACKSPACE, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_BACKSPACE, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_ESCAPE, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_ESCAPE, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_ESCAPE, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_UP, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_UP, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_UP, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_DOWN, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_DOWN, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_DOWN, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_LEFT, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_LEFT, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_LEFT, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_RIGHT, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_RIGHT, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_RIGHT, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_INS, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_INS, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_INS, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_DEL, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_DEL, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_DEL, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_HOME, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_HOME, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_HOME, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_END, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_END, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_END, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_PAGEUP, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_PAGEUP, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_PAGEUP, mod);
}
if(d2tk_base_get_keymask(base, D2TK_KEYMASK_PAGEDOWN, true))
{
- vterm_keyboard_key(vpty->vterm, VTERM_KEY_PAGEDOWN, VTERM_MOD_NONE);
+ vterm_keyboard_key(vpty->vterm, VTERM_KEY_PAGEDOWN, mod);
}
{
@@ -573,7 +588,7 @@ _term_behave(d2tk_base_t *base, d2tk_atom_body_pty_t *vpty,
for(ssize_t i = 0; i < len; i++)
{
- vterm_keyboard_unichar(vpty->vterm, utf8[i], VTERM_MOD_NONE);
+ vterm_keyboard_unichar(vpty->vterm, utf8[i], mod);
}
}
}
@@ -588,22 +603,22 @@ _term_behave(d2tk_base_t *base, d2tk_atom_body_pty_t *vpty,
const int row = (my - rect->y) * vpty->nrows / rect->h;
const int col = (mx - rect->x) * vpty->ncols / rect->w;
- vterm_mouse_move(vpty->vterm, row, col, VTERM_MOD_NONE);
+ vterm_mouse_move(vpty->vterm, row, col, mod);
vterm_mouse_button(vpty->vterm, 1,
- d2tk_base_get_butmask(base, D2TK_BUTMASK_LEFT, false), VTERM_MOD_NONE);
+ d2tk_base_get_butmask(base, D2TK_BUTMASK_LEFT, false), mod);
vterm_mouse_button(vpty->vterm, 2,
- d2tk_base_get_butmask(base, D2TK_BUTMASK_MIDDLE, false), VTERM_MOD_NONE);
+ d2tk_base_get_butmask(base, D2TK_BUTMASK_MIDDLE, false), mod);
vterm_mouse_button(vpty->vterm, 3,
- d2tk_base_get_butmask(base, D2TK_BUTMASK_RIGHT, false), VTERM_MOD_NONE);
+ d2tk_base_get_butmask(base, D2TK_BUTMASK_RIGHT, false), mod);
if(dy > 0)
{
- vterm_mouse_button(vpty->vterm, 4, true, VTERM_MOD_NONE);
+ vterm_mouse_button(vpty->vterm, 4, true, mod);
}
else if(dy < 0)
{
- vterm_mouse_button(vpty->vterm, 5, true, VTERM_MOD_NONE);
+ vterm_mouse_button(vpty->vterm, 5, true, mod);
}
}
}