mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
Fixed style issues
This commit is contained in:
parent
7f1230fe78
commit
7da50d065b
7 changed files with 51 additions and 80 deletions
|
@ -205,8 +205,8 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
||||||
for (int i = 0; i < nsyms; i++) {
|
for (int i = 0; i < nsyms; i++) {
|
||||||
xkb_keysym_t sym = syms[i];
|
xkb_keysym_t sym = syms[i];
|
||||||
if (sym == XKB_KEY_Escape) {
|
if (sym == XKB_KEY_Escape) {
|
||||||
wl_display_terminate(sample->display);
|
wl_display_terminate(sample->display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,28 +220,22 @@ void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
|
||||||
void new_input_notify(struct wl_listener *listener, void *data) {
|
void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_device *device = data;
|
struct wlr_input_device *device = data;
|
||||||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||||
struct sample_keyboard *keyboard;
|
|
||||||
struct xkb_rule_names rules;
|
|
||||||
struct xkb_context *context;
|
|
||||||
struct sample_cursor *cursor = 0;
|
|
||||||
struct sample_pointer *pointer = 0;
|
|
||||||
struct wlr_xcursor_image *image;
|
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||||
keyboard = calloc(1, sizeof(struct sample_keyboard));
|
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||||
keyboard->device = device;
|
keyboard->device = device;
|
||||||
keyboard->sample = sample;
|
keyboard->sample = sample;
|
||||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||||
keyboard->destroy.notify = keyboard_destroy_notify;
|
keyboard->destroy.notify = keyboard_destroy_notify;
|
||||||
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
||||||
keyboard->key.notify = keyboard_key_notify;
|
keyboard->key.notify = keyboard_key_notify;
|
||||||
memset(&rules, 0, sizeof(rules));
|
struct xkb_rule_names rules = { 0 };
|
||||||
rules.rules = getenv("XKB_DEFAULT_RULES");
|
rules.rules = getenv("XKB_DEFAULT_RULES");
|
||||||
rules.model = getenv("XKB_DEFAULT_MODEL");
|
rules.model = getenv("XKB_DEFAULT_MODEL");
|
||||||
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
||||||
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(L_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -250,9 +244,9 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
break;
|
break;
|
||||||
case WLR_INPUT_DEVICE_POINTER:
|
case WLR_INPUT_DEVICE_POINTER:;
|
||||||
cursor = calloc(1, sizeof(struct sample_cursor));
|
struct sample_cursor *cursor = calloc(1, sizeof(struct sample_cursor));
|
||||||
pointer = calloc(1, sizeof(struct sample_pointer));
|
struct sample_pointer *pointer = calloc(1, sizeof(struct sample_pointer));
|
||||||
pointer->device = device;
|
pointer->device = device;
|
||||||
cursor->sample = sample;
|
cursor->sample = sample;
|
||||||
cursor->device = device;
|
cursor->device = device;
|
||||||
|
@ -270,7 +264,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_cursor_attach_input_device(cursor->cursor, device);
|
wlr_cursor_attach_input_device(cursor->cursor, device);
|
||||||
configure_cursor(cursor->cursor, device, sample);
|
configure_cursor(cursor->cursor, device, sample);
|
||||||
|
|
||||||
image = sample->xcursor->images[0];
|
struct wlr_xcursor_image *image = sample->xcursor->images[0];
|
||||||
wlr_cursor_set_image(cursor->cursor, image->buffer, image->width * 4,
|
wlr_cursor_set_image(cursor->cursor, image->buffer, image->width * 4,
|
||||||
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
|
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
|
||||||
|
|
||||||
|
|
|
@ -184,8 +184,8 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
||||||
for (int i = 0; i < nsyms; i++) {
|
for (int i = 0; i < nsyms; i++) {
|
||||||
xkb_keysym_t sym = syms[i];
|
xkb_keysym_t sym = syms[i];
|
||||||
if (sym == XKB_KEY_Escape) {
|
if (sym == XKB_KEY_Escape) {
|
||||||
wl_display_terminate(sample->display);
|
wl_display_terminate(sample->display);
|
||||||
}
|
}
|
||||||
// NOTE: It may be better to simply refer to our key state during each frame
|
// NOTE: It may be better to simply refer to our key state during each frame
|
||||||
// and make this change in pixels/sec^2
|
// and make this change in pixels/sec^2
|
||||||
// Also, key repeat
|
// Also, key repeat
|
||||||
|
@ -219,25 +219,22 @@ void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
|
||||||
void new_input_notify(struct wl_listener *listener, void *data) {
|
void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_device *device = data;
|
struct wlr_input_device *device = data;
|
||||||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||||
struct sample_keyboard *keyboard;
|
|
||||||
struct xkb_rule_names rules;
|
|
||||||
struct xkb_context *context;
|
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||||
keyboard = calloc(1, sizeof(struct sample_keyboard));
|
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||||
keyboard->device = device;
|
keyboard->device = device;
|
||||||
keyboard->sample = sample;
|
keyboard->sample = sample;
|
||||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||||
keyboard->destroy.notify = keyboard_destroy_notify;
|
keyboard->destroy.notify = keyboard_destroy_notify;
|
||||||
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
||||||
keyboard->key.notify = keyboard_key_notify;
|
keyboard->key.notify = keyboard_key_notify;
|
||||||
memset(&rules, 0, sizeof(rules));
|
struct xkb_rule_names rules = { 0 };
|
||||||
rules.rules = getenv("XKB_DEFAULT_RULES");
|
rules.rules = getenv("XKB_DEFAULT_RULES");
|
||||||
rules.model = getenv("XKB_DEFAULT_MODEL");
|
rules.model = getenv("XKB_DEFAULT_MODEL");
|
||||||
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
||||||
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(L_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -74,7 +74,6 @@ struct sample_keyboard {
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void warp_to_touch(struct sample_state *sample,
|
static void warp_to_touch(struct sample_state *sample,
|
||||||
struct wlr_input_device *dev) {
|
struct wlr_input_device *dev) {
|
||||||
if (wl_list_empty(&sample->touch_points)) {
|
if (wl_list_empty(&sample->touch_points)) {
|
||||||
|
@ -235,8 +234,8 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
||||||
for (int i = 0; i < nsyms; i++) {
|
for (int i = 0; i < nsyms; i++) {
|
||||||
xkb_keysym_t sym = syms[i];
|
xkb_keysym_t sym = syms[i];
|
||||||
if (sym == XKB_KEY_Escape) {
|
if (sym == XKB_KEY_Escape) {
|
||||||
wl_display_terminate(sample->display);
|
wl_display_terminate(sample->display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,9 +281,6 @@ void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
|
||||||
void new_input_notify(struct wl_listener *listener, void *data) {
|
void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_device *device = data;
|
struct wlr_input_device *device = data;
|
||||||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||||
struct sample_keyboard *keyboard;
|
|
||||||
struct xkb_rule_names rules;
|
|
||||||
struct xkb_context *context;
|
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case WLR_INPUT_DEVICE_POINTER:
|
case WLR_INPUT_DEVICE_POINTER:
|
||||||
case WLR_INPUT_DEVICE_TOUCH:
|
case WLR_INPUT_DEVICE_TOUCH:
|
||||||
|
@ -292,21 +288,21 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_cursor_attach_input_device(sample->cursor, device);
|
wlr_cursor_attach_input_device(sample->cursor, device);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||||
keyboard = calloc(1, sizeof(struct sample_keyboard));
|
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||||
keyboard->device = device;
|
keyboard->device = device;
|
||||||
keyboard->sample = sample;
|
keyboard->sample = sample;
|
||||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||||
keyboard->destroy.notify = keyboard_destroy_notify;
|
keyboard->destroy.notify = keyboard_destroy_notify;
|
||||||
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
||||||
keyboard->key.notify = keyboard_key_notify;
|
keyboard->key.notify = keyboard_key_notify;
|
||||||
memset(&rules, 0, sizeof(rules));
|
struct xkb_rule_names rules = { 0 };
|
||||||
rules.rules = getenv("XKB_DEFAULT_RULES");
|
rules.rules = getenv("XKB_DEFAULT_RULES");
|
||||||
rules.model = getenv("XKB_DEFAULT_MODEL");
|
rules.model = getenv("XKB_DEFAULT_MODEL");
|
||||||
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
||||||
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(L_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -138,8 +138,8 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
||||||
for (int i = 0; i < nsyms; i++) {
|
for (int i = 0; i < nsyms; i++) {
|
||||||
xkb_keysym_t sym = syms[i];
|
xkb_keysym_t sym = syms[i];
|
||||||
if (sym == XKB_KEY_Escape) {
|
if (sym == XKB_KEY_Escape) {
|
||||||
wl_display_terminate(sample->display);
|
wl_display_terminate(sample->display);
|
||||||
}
|
}
|
||||||
if (event->state == WLR_KEY_PRESSED) {
|
if (event->state == WLR_KEY_PRESSED) {
|
||||||
switch (sym) {
|
switch (sym) {
|
||||||
case XKB_KEY_Left:
|
case XKB_KEY_Left:
|
||||||
|
@ -169,25 +169,22 @@ void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
|
||||||
void new_input_notify(struct wl_listener *listener, void *data) {
|
void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_device *device = data;
|
struct wlr_input_device *device = data;
|
||||||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||||
struct sample_keyboard *keyboard;
|
|
||||||
struct xkb_rule_names rules;
|
|
||||||
struct xkb_context *context;
|
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||||
keyboard = calloc(1, sizeof(struct sample_keyboard));
|
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||||
keyboard->device = device;
|
keyboard->device = device;
|
||||||
keyboard->sample = sample;
|
keyboard->sample = sample;
|
||||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||||
keyboard->destroy.notify = keyboard_destroy_notify;
|
keyboard->destroy.notify = keyboard_destroy_notify;
|
||||||
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
||||||
keyboard->key.notify = keyboard_key_notify;
|
keyboard->key.notify = keyboard_key_notify;
|
||||||
memset(&rules, 0, sizeof(rules));
|
struct xkb_rule_names rules = { 0 };
|
||||||
rules.rules = getenv("XKB_DEFAULT_RULES");
|
rules.rules = getenv("XKB_DEFAULT_RULES");
|
||||||
rules.model = getenv("XKB_DEFAULT_MODEL");
|
rules.model = getenv("XKB_DEFAULT_MODEL");
|
||||||
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
||||||
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(L_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -36,7 +36,6 @@ struct sample_keyboard {
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void output_frame_notify(struct wl_listener *listener, void *data) {
|
void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(L_DEBUG, "Output removed");
|
wlr_log(L_DEBUG, "Output removed");
|
||||||
struct sample_output *sample_output = wl_container_of(listener, sample_output, frame);
|
struct sample_output *sample_output = wl_container_of(listener, sample_output, frame);
|
||||||
|
@ -100,8 +99,8 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
||||||
for (int i = 0; i < nsyms; i++) {
|
for (int i = 0; i < nsyms; i++) {
|
||||||
xkb_keysym_t sym = syms[i];
|
xkb_keysym_t sym = syms[i];
|
||||||
if (sym == XKB_KEY_Escape) {
|
if (sym == XKB_KEY_Escape) {
|
||||||
wl_display_terminate(sample->display);
|
wl_display_terminate(sample->display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,25 +114,22 @@ void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
|
||||||
void new_input_notify(struct wl_listener *listener, void *data) {
|
void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_device *device = data;
|
struct wlr_input_device *device = data;
|
||||||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||||
struct sample_keyboard *keyboard;
|
|
||||||
struct xkb_rule_names rules;
|
|
||||||
struct xkb_context *context;
|
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||||
keyboard = calloc(1, sizeof(struct sample_keyboard));
|
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||||
keyboard->device = device;
|
keyboard->device = device;
|
||||||
keyboard->sample = sample;
|
keyboard->sample = sample;
|
||||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||||
keyboard->destroy.notify = keyboard_destroy_notify;
|
keyboard->destroy.notify = keyboard_destroy_notify;
|
||||||
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
||||||
keyboard->key.notify = keyboard_key_notify;
|
keyboard->key.notify = keyboard_key_notify;
|
||||||
memset(&rules, 0, sizeof(rules));
|
struct xkb_rule_names rules = { 0 };
|
||||||
rules.rules = getenv("XKB_DEFAULT_RULES");
|
rules.rules = getenv("XKB_DEFAULT_RULES");
|
||||||
rules.model = getenv("XKB_DEFAULT_MODEL");
|
rules.model = getenv("XKB_DEFAULT_MODEL");
|
||||||
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
||||||
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(L_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -263,8 +263,8 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
||||||
for (int i = 0; i < nsyms; i++) {
|
for (int i = 0; i < nsyms; i++) {
|
||||||
xkb_keysym_t sym = syms[i];
|
xkb_keysym_t sym = syms[i];
|
||||||
if (sym == XKB_KEY_Escape) {
|
if (sym == XKB_KEY_Escape) {
|
||||||
wl_display_terminate(sample->display);
|
wl_display_terminate(sample->display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,27 +278,22 @@ void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
|
||||||
void new_input_notify(struct wl_listener *listener, void *data) {
|
void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_device *device = data;
|
struct wlr_input_device *device = data;
|
||||||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||||
struct sample_keyboard *keyboard;
|
|
||||||
struct xkb_rule_names rules;
|
|
||||||
struct xkb_context *context;
|
|
||||||
struct tablet_tool_state *tstate;
|
|
||||||
struct tablet_pad_state *pstate;
|
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||||
keyboard = calloc(1, sizeof(struct sample_keyboard));
|
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||||
keyboard->device = device;
|
keyboard->device = device;
|
||||||
keyboard->sample = sample;
|
keyboard->sample = sample;
|
||||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||||
keyboard->destroy.notify = keyboard_destroy_notify;
|
keyboard->destroy.notify = keyboard_destroy_notify;
|
||||||
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
||||||
keyboard->key.notify = keyboard_key_notify;
|
keyboard->key.notify = keyboard_key_notify;
|
||||||
memset(&rules, 0, sizeof(rules));
|
struct xkb_rule_names rules = { 0 };
|
||||||
rules.rules = getenv("XKB_DEFAULT_RULES");
|
rules.rules = getenv("XKB_DEFAULT_RULES");
|
||||||
rules.model = getenv("XKB_DEFAULT_MODEL");
|
rules.model = getenv("XKB_DEFAULT_MODEL");
|
||||||
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
||||||
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(L_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -307,8 +302,8 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
break;
|
break;
|
||||||
case WLR_INPUT_DEVICE_TABLET_PAD:
|
case WLR_INPUT_DEVICE_TABLET_PAD:;
|
||||||
pstate = calloc(sizeof(struct tablet_pad_state), 1);
|
struct tablet_pad_state *pstate = calloc(sizeof(struct tablet_pad_state), 1);
|
||||||
pstate->device = device;
|
pstate->device = device;
|
||||||
pstate->sample = sample;
|
pstate->sample = sample;
|
||||||
pstate->destroy.notify = tablet_pad_destroy_notify;
|
pstate->destroy.notify = tablet_pad_destroy_notify;
|
||||||
|
@ -325,7 +320,7 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
sample->height_mm = device->height_mm == 0 ?
|
sample->height_mm = device->height_mm == 0 ?
|
||||||
10 : device->height_mm;
|
10 : device->height_mm;
|
||||||
|
|
||||||
tstate = calloc(sizeof(struct tablet_tool_state), 1);
|
struct tablet_tool_state *tstate = calloc(sizeof(struct tablet_tool_state), 1);
|
||||||
tstate->device = device;
|
tstate->device = device;
|
||||||
tstate->sample = sample;
|
tstate->sample = sample;
|
||||||
tstate->destroy.notify = tablet_tool_destroy_notify;
|
tstate->destroy.notify = tablet_tool_destroy_notify;
|
||||||
|
|
|
@ -176,8 +176,8 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
||||||
for (int i = 0; i < nsyms; i++) {
|
for (int i = 0; i < nsyms; i++) {
|
||||||
xkb_keysym_t sym = syms[i];
|
xkb_keysym_t sym = syms[i];
|
||||||
if (sym == XKB_KEY_Escape) {
|
if (sym == XKB_KEY_Escape) {
|
||||||
wl_display_terminate(sample->display);
|
wl_display_terminate(sample->display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,26 +191,22 @@ void keyboard_destroy_notify(struct wl_listener *listener, void *data) {
|
||||||
void new_input_notify(struct wl_listener *listener, void *data) {
|
void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_device *device = data;
|
struct wlr_input_device *device = data;
|
||||||
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
struct sample_state *sample = wl_container_of(listener, sample, new_input);
|
||||||
struct sample_keyboard *keyboard;
|
|
||||||
struct xkb_rule_names rules;
|
|
||||||
struct xkb_context *context;
|
|
||||||
struct touch_state *tstate;
|
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:;
|
||||||
keyboard = calloc(1, sizeof(struct sample_keyboard));
|
struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard));
|
||||||
keyboard->device = device;
|
keyboard->device = device;
|
||||||
keyboard->sample = sample;
|
keyboard->sample = sample;
|
||||||
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
wl_signal_add(&device->events.destroy, &keyboard->destroy);
|
||||||
keyboard->destroy.notify = keyboard_destroy_notify;
|
keyboard->destroy.notify = keyboard_destroy_notify;
|
||||||
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
||||||
keyboard->key.notify = keyboard_key_notify;
|
keyboard->key.notify = keyboard_key_notify;
|
||||||
memset(&rules, 0, sizeof(rules));
|
struct xkb_rule_names rules = { 0 };
|
||||||
rules.rules = getenv("XKB_DEFAULT_RULES");
|
rules.rules = getenv("XKB_DEFAULT_RULES");
|
||||||
rules.model = getenv("XKB_DEFAULT_MODEL");
|
rules.model = getenv("XKB_DEFAULT_MODEL");
|
||||||
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
rules.layout = getenv("XKB_DEFAULT_LAYOUT");
|
||||||
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
rules.variant = getenv("XKB_DEFAULT_VARIANT");
|
||||||
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
rules.options = getenv("XKB_DEFAULT_OPTIONS");
|
||||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
wlr_log(L_ERROR, "Failed to create XKB context");
|
wlr_log(L_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -219,8 +215,8 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
break;
|
break;
|
||||||
case WLR_INPUT_DEVICE_TOUCH:
|
case WLR_INPUT_DEVICE_TOUCH:;
|
||||||
tstate = calloc(sizeof(struct touch_state), 1);
|
struct touch_state *tstate = calloc(sizeof(struct touch_state), 1);
|
||||||
tstate->device = device;
|
tstate->device = device;
|
||||||
tstate->sample = sample;
|
tstate->sample = sample;
|
||||||
tstate->destroy.notify = touch_destroy_notify;
|
tstate->destroy.notify = touch_destroy_notify;
|
||||||
|
|
Loading…
Reference in a new issue