mirror of
https://github.com/swaywm/sway.git
synced 2024-11-28 10:51:28 +00:00
Merge branch 'swaywm:master' into disable_titlebar
This commit is contained in:
commit
b57879f9b2
|
@ -37,19 +37,26 @@
|
||||||
struct sway_config *config = NULL;
|
struct sway_config *config = NULL;
|
||||||
|
|
||||||
static struct xkb_state *keysym_translation_state_create(
|
static struct xkb_state *keysym_translation_state_create(
|
||||||
struct xkb_rule_names rules) {
|
struct xkb_rule_names rules, uint32_t context_flags) {
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_SECURE_GETENV);
|
struct xkb_context *context = xkb_context_new(context_flags | XKB_CONTEXT_NO_SECURE_GETENV);
|
||||||
struct xkb_keymap *xkb_keymap = xkb_keymap_new_from_names(
|
struct xkb_keymap *xkb_keymap = xkb_keymap_new_from_names(
|
||||||
context,
|
context,
|
||||||
&rules,
|
&rules,
|
||||||
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
|
if (xkb_keymap == NULL) {
|
||||||
|
sway_log(SWAY_ERROR, "Failed to compile keysym translation XKB keymap");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return xkb_state_new(xkb_keymap);
|
return xkb_state_new(xkb_keymap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keysym_translation_state_destroy(
|
static void keysym_translation_state_destroy(
|
||||||
struct xkb_state *state) {
|
struct xkb_state *state) {
|
||||||
|
if (state == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
xkb_keymap_unref(xkb_state_get_keymap(state));
|
xkb_keymap_unref(xkb_state_get_keymap(state));
|
||||||
xkb_state_unref(state);
|
xkb_state_unref(state);
|
||||||
}
|
}
|
||||||
|
@ -338,8 +345,14 @@ static void config_defaults(struct sway_config *config) {
|
||||||
|
|
||||||
// The keysym to keycode translation
|
// The keysym to keycode translation
|
||||||
struct xkb_rule_names rules = {0};
|
struct xkb_rule_names rules = {0};
|
||||||
config->keysym_translation_state =
|
config->keysym_translation_state = keysym_translation_state_create(rules, 0);
|
||||||
keysym_translation_state_create(rules);
|
if (config->keysym_translation_state == NULL) {
|
||||||
|
config->keysym_translation_state = keysym_translation_state_create(rules,
|
||||||
|
XKB_CONTEXT_NO_ENVIRONMENT_NAMES);
|
||||||
|
}
|
||||||
|
if (config->keysym_translation_state == NULL) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -986,8 +999,12 @@ void translate_keysyms(struct input_config *input_config) {
|
||||||
|
|
||||||
struct xkb_rule_names rules = {0};
|
struct xkb_rule_names rules = {0};
|
||||||
input_config_fill_rule_names(input_config, &rules);
|
input_config_fill_rule_names(input_config, &rules);
|
||||||
config->keysym_translation_state =
|
config->keysym_translation_state = keysym_translation_state_create(rules, 0);
|
||||||
keysym_translation_state_create(rules);
|
if (config->keysym_translation_state == NULL) {
|
||||||
|
sway_log(SWAY_ERROR, "Failed to create keysym translation XKB state "
|
||||||
|
"for device '%s'", input_config->identifier);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < config->modes->length; ++i) {
|
for (int i = 0; i < config->modes->length; ++i) {
|
||||||
struct sway_mode *mode = config->modes->items[i];
|
struct sway_mode *mode = config->modes->items[i];
|
||||||
|
|
|
@ -65,8 +65,15 @@ struct sway_seat *input_manager_sway_seat_from_wlr_seat(struct wlr_seat *wlr_sea
|
||||||
}
|
}
|
||||||
|
|
||||||
char *input_device_get_identifier(struct wlr_input_device *device) {
|
char *input_device_get_identifier(struct wlr_input_device *device) {
|
||||||
int vendor = device->vendor;
|
int vendor = 0, product = 0;
|
||||||
int product = device->product;
|
#if WLR_HAS_LIBINPUT_BACKEND
|
||||||
|
if (wlr_input_device_is_libinput(device)) {
|
||||||
|
struct libinput_device *libinput_dev = wlr_libinput_get_device_handle(device);
|
||||||
|
vendor = libinput_device_get_id_vendor(libinput_dev);
|
||||||
|
product = libinput_device_get_id_product(libinput_dev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
char *name = strdup(device->name ? device->name : "");
|
char *name = strdup(device->name ? device->name : "");
|
||||||
strip_whitespace(name);
|
strip_whitespace(name);
|
||||||
|
|
||||||
|
|
|
@ -1097,10 +1097,6 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) {
|
||||||
json_object_new_string(device->identifier));
|
json_object_new_string(device->identifier));
|
||||||
json_object_object_add(object, "name",
|
json_object_object_add(object, "name",
|
||||||
json_object_new_string(device->wlr_device->name));
|
json_object_new_string(device->wlr_device->name));
|
||||||
json_object_object_add(object, "vendor",
|
|
||||||
json_object_new_int(device->wlr_device->vendor));
|
|
||||||
json_object_object_add(object, "product",
|
|
||||||
json_object_new_int(device->wlr_device->product));
|
|
||||||
json_object_object_add(object, "type",
|
json_object_object_add(object, "type",
|
||||||
json_object_new_string(
|
json_object_new_string(
|
||||||
input_device_get_type(device)));
|
input_device_get_type(device)));
|
||||||
|
@ -1154,6 +1150,10 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) {
|
||||||
libinput_dev = wlr_libinput_get_device_handle(device->wlr_device);
|
libinput_dev = wlr_libinput_get_device_handle(device->wlr_device);
|
||||||
json_object_object_add(object, "libinput",
|
json_object_object_add(object, "libinput",
|
||||||
describe_libinput_device(libinput_dev));
|
describe_libinput_device(libinput_dev));
|
||||||
|
json_object_object_add(object, "vendor",
|
||||||
|
json_object_new_int(libinput_device_get_id_vendor(libinput_dev)));
|
||||||
|
json_object_object_add(object, "product",
|
||||||
|
json_object_new_int(libinput_device_get_id_product(libinput_dev)));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue