Fix de-neo layout
- Add possibility to specify layout variant with -k <layout>-<variant> - Add ISO_Level5_Shift and ISO_Level5_Lock to modifier keyspull/75/head
parent
41f30bf7ca
commit
98d703bfa8
|
@ -39,6 +39,6 @@ struct keyboard {
|
||||||
struct intset key_state;
|
struct intset key_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
int keyboard_init(struct keyboard* self, const char* layout);
|
int keyboard_init(struct keyboard* self, const char* layout, const char* variant);
|
||||||
void keyboard_destroy(struct keyboard* self);
|
void keyboard_destroy(struct keyboard* self);
|
||||||
void keyboard_feed(struct keyboard* self, xkb_keysym_t symbol, bool is_pressed);
|
void keyboard_feed(struct keyboard* self, xkb_keysym_t symbol, bool is_pressed);
|
||||||
|
|
|
@ -149,7 +149,7 @@ void keyboard_dump_lookup_table(const struct keyboard* self)
|
||||||
keyboard__dump_entry(self, &self->lookup_table[i]);
|
keyboard__dump_entry(self, &self->lookup_table[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int keyboard_init(struct keyboard* self, const char* layout)
|
int keyboard_init(struct keyboard* self, const char* layout, const char* variant)
|
||||||
{
|
{
|
||||||
self->context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
self->context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!self->context)
|
if (!self->context)
|
||||||
|
@ -161,6 +161,7 @@ int keyboard_init(struct keyboard* self, const char* layout)
|
||||||
struct xkb_rule_names rule_names = {
|
struct xkb_rule_names rule_names = {
|
||||||
.layout = layout,
|
.layout = layout,
|
||||||
.model = "pc105",
|
.model = "pc105",
|
||||||
|
.variant = variant,
|
||||||
};
|
};
|
||||||
|
|
||||||
self->keymap = xkb_keymap_new_from_names(self->context, &rule_names, 0);
|
self->keymap = xkb_keymap_new_from_names(self->context, &rule_names, 0);
|
||||||
|
@ -321,6 +322,8 @@ static bool keyboard_symbol_is_mod(xkb_keysym_t symbol)
|
||||||
case XKB_KEY_Super_R:
|
case XKB_KEY_Super_R:
|
||||||
case XKB_KEY_Hyper_L:
|
case XKB_KEY_Hyper_L:
|
||||||
case XKB_KEY_Hyper_R:
|
case XKB_KEY_Hyper_R:
|
||||||
|
case XKB_KEY_ISO_Level5_Shift:
|
||||||
|
case XKB_KEY_ISO_Level5_Lock:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
src/main.c
21
src/main.c
|
@ -98,6 +98,7 @@ struct wayvnc {
|
||||||
struct pixman_region16 current_damage;
|
struct pixman_region16 current_damage;
|
||||||
|
|
||||||
const char* kb_layout;
|
const char* kb_layout;
|
||||||
|
const char* kb_variant;
|
||||||
|
|
||||||
uint32_t damage_area_sum;
|
uint32_t damage_area_sum;
|
||||||
uint32_t n_frames_captured;
|
uint32_t n_frames_captured;
|
||||||
|
@ -684,7 +685,7 @@ int wayvnc_usage(FILE* stream, int rc)
|
||||||
"\n"
|
"\n"
|
||||||
" -C,--config=<path> Select a config file.\n"
|
" -C,--config=<path> Select a config file.\n"
|
||||||
" -o,--output=<name> Select output to capture.\n"
|
" -o,--output=<name> Select output to capture.\n"
|
||||||
" -k,--keyboard=<layout> Select keyboard layout.\n"
|
" -k,--keyboard=<layout>[-<variant>] Select keyboard layout with an optional variant.\n"
|
||||||
" -s,--seat=<name> Select seat by name.\n"
|
" -s,--seat=<name> Select seat by name.\n"
|
||||||
" -r,--render-cursor Enable overlay cursor rendering.\n"
|
" -r,--render-cursor Enable overlay cursor rendering.\n"
|
||||||
" -f,--max-fps=<fps> Set the rate limit (default 30).\n"
|
" -f,--max-fps=<fps> Set the rate limit (default 30).\n"
|
||||||
|
@ -762,6 +763,18 @@ static void start_performance_ticker(struct wayvnc* self)
|
||||||
aml_unref(ticker);
|
aml_unref(ticker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void parse_keyboard_option(struct wayvnc* self, char* arg)
|
||||||
|
{
|
||||||
|
// Find optional variant, separated by -
|
||||||
|
char* index = strchr(arg, '-');
|
||||||
|
if (index != NULL) {
|
||||||
|
self->kb_variant = index + 1;
|
||||||
|
// layout needs to be 0-terminated, replace the - by 0
|
||||||
|
*index = 0;
|
||||||
|
}
|
||||||
|
self->kb_layout = arg;
|
||||||
|
}
|
||||||
|
|
||||||
int show_version(void)
|
int show_version(void)
|
||||||
{
|
{
|
||||||
printf("wayvnc: %s\n", wayvnc_version);
|
printf("wayvnc: %s\n", wayvnc_version);
|
||||||
|
@ -781,7 +794,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
const char* output_name = NULL;
|
const char* output_name = NULL;
|
||||||
const char* seat_name = NULL;
|
const char* seat_name = NULL;
|
||||||
|
|
||||||
bool overlay_cursor = false;
|
bool overlay_cursor = false;
|
||||||
bool show_performance = false;
|
bool show_performance = false;
|
||||||
int max_rate = 30;
|
int max_rate = 30;
|
||||||
|
@ -815,7 +828,7 @@ int main(int argc, char* argv[])
|
||||||
output_name = optarg;
|
output_name = optarg;
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
self.kb_layout = optarg;
|
parse_keyboard_option(&self, optarg);
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
seat_name = optarg;
|
seat_name = optarg;
|
||||||
|
@ -914,7 +927,7 @@ int main(int argc, char* argv[])
|
||||||
zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(
|
zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(
|
||||||
self.keyboard_manager, self.selected_seat->wl_seat);
|
self.keyboard_manager, self.selected_seat->wl_seat);
|
||||||
|
|
||||||
keyboard_init(&self.keyboard_backend, self.kb_layout);
|
keyboard_init(&self.keyboard_backend, self.kb_layout, self.kb_variant);
|
||||||
|
|
||||||
self.pointer_backend.vnc = self.nvnc;
|
self.pointer_backend.vnc = self.nvnc;
|
||||||
self.pointer_backend.output = self.selected_output;
|
self.pointer_backend.output = self.selected_output;
|
||||||
|
|
Loading…
Reference in New Issue