mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-08-29 07:12:02 +02:00
added SHIFT_SPACE_IS_TAB as compile time parameter
for the mobile layout, we want shift+space to produce tab , which needed to be implemented in the main code. For the desktop layout, we don't want this though, a config parameter now handles this at compile time. Ref: https://github.com/jjsullivan5196/wvkbd/pull/103
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#define DEFAULT_FONT "Sans 14"
|
#define DEFAULT_FONT "Sans 14"
|
||||||
#define DEFAULT_ROUNDING 5
|
#define DEFAULT_ROUNDING 5
|
||||||
|
#define SHIFT_SPACE_IS_TAB
|
||||||
static const int transparency = 255;
|
static const int transparency = 255;
|
||||||
|
|
||||||
struct clr_scheme schemes[] = {
|
struct clr_scheme schemes[] = {
|
||||||
|
@@ -301,7 +301,7 @@ kbd_unpress_key(struct kbd *kb, uint32_t time)
|
|||||||
zwp_virtual_keyboard_v1_key(kb->vkbd, time, 127, // COMP key
|
zwp_virtual_keyboard_v1_key(kb->vkbd, time, 127, // COMP key
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED);
|
WL_KEYBOARD_KEY_STATE_RELEASED);
|
||||||
} else {
|
} else {
|
||||||
if ((kb->last_press->code == KEY_SPACE) && (unlatch_shift)) {
|
if ((kb->shift_space_is_tab) && (kb->last_press->code == KEY_SPACE) && (unlatch_shift)) {
|
||||||
// shift + space is tab
|
// shift + space is tab
|
||||||
zwp_virtual_keyboard_v1_key(kb->vkbd, time, KEY_TAB,
|
zwp_virtual_keyboard_v1_key(kb->vkbd, time, KEY_TAB,
|
||||||
WL_KEYBOARD_KEY_STATE_RELEASED);
|
WL_KEYBOARD_KEY_STATE_RELEASED);
|
||||||
@@ -404,7 +404,7 @@ kbd_press_key(struct kbd *kb, struct key *k, uint32_t time)
|
|||||||
}
|
}
|
||||||
kb->last_swipe = kb->last_press = k;
|
kb->last_swipe = kb->last_press = k;
|
||||||
kbd_draw_key(kb, k, Press);
|
kbd_draw_key(kb, k, Press);
|
||||||
if ((k->code == KEY_SPACE) && (kb->mods & Shift)) {
|
if ((kb->shift_space_is_tab) && (k->code == KEY_SPACE) && (kb->mods & Shift)) {
|
||||||
// shift space is tab
|
// shift space is tab
|
||||||
zwp_virtual_keyboard_v1_modifiers(kb->vkbd, 0, 0, 0, 0);
|
zwp_virtual_keyboard_v1_modifiers(kb->vkbd, 0, 0, 0, 0);
|
||||||
zwp_virtual_keyboard_v1_key(kb->vkbd, time, KEY_TAB,
|
zwp_virtual_keyboard_v1_key(kb->vkbd, time, KEY_TAB,
|
||||||
|
@@ -101,6 +101,7 @@ struct kbd {
|
|||||||
double scale;
|
double scale;
|
||||||
double preferred_scale, preferred_fractional_scale;
|
double preferred_scale, preferred_fractional_scale;
|
||||||
bool landscape;
|
bool landscape;
|
||||||
|
bool shift_space_is_tab;
|
||||||
uint8_t mods;
|
uint8_t mods;
|
||||||
uint8_t compose;
|
uint8_t compose;
|
||||||
struct key *last_press;
|
struct key *last_press;
|
||||||
|
5
main.c
5
main.c
@@ -1058,6 +1058,11 @@ main(int argc, char **argv)
|
|||||||
if (keyboard.vkbd == NULL) {
|
if (keyboard.vkbd == NULL) {
|
||||||
die("failed to init virtual keyboard_manager\n");
|
die("failed to init virtual keyboard_manager\n");
|
||||||
}
|
}
|
||||||
|
#ifdef SHIFT_SPACE_IS_TAB
|
||||||
|
keyboard.shift_space_is_tab = true;
|
||||||
|
#else
|
||||||
|
keyboard.shift_space_is_tab = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
kbd_init(&keyboard, (struct layout *)&layouts, layer_names_list,
|
kbd_init(&keyboard, (struct layout *)&layouts, layer_names_list,
|
||||||
landscape_layer_names_list);
|
landscape_layer_names_list);
|
||||||
|
Reference in New Issue
Block a user