mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-03-14 03:12:47 +01:00
scroll wheel switches layers (as opposed to crashing as it did before)
This commit is contained in:
parent
0ca0409400
commit
bfcd3527dd
@ -62,7 +62,7 @@ kbd_next_layer(struct kbd *kb, struct key *k, bool invert) {
|
|||||||
}
|
}
|
||||||
layer_index = layercount - 1;
|
layer_index = layercount - 1;
|
||||||
}
|
}
|
||||||
kb->mods ^= Shift;
|
if (!invert) kb->mods ^= Shift;
|
||||||
} else {
|
} else {
|
||||||
// normal behaviour: switch to the next layout in the layer sequence
|
// normal behaviour: switch to the next layout in the layer sequence
|
||||||
layer_index++;
|
layer_index++;
|
||||||
|
11
main.c
11
main.c
@ -8,6 +8,7 @@
|
|||||||
#include <sys/signalfd.h>
|
#include <sys/signalfd.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <wayland-client-protocol.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
@ -70,6 +71,8 @@ static void wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
|
|||||||
static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
uint32_t serial, uint32_t time, uint32_t button,
|
uint32_t serial, uint32_t time, uint32_t button,
|
||||||
uint32_t state);
|
uint32_t state);
|
||||||
|
static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
|
||||||
|
uint32_t time, uint32_t axis, wl_fixed_t value);
|
||||||
|
|
||||||
static void wl_touch_down(void *data, struct wl_touch *wl_touch,
|
static void wl_touch_down(void *data, struct wl_touch *wl_touch,
|
||||||
uint32_t serial, uint32_t time,
|
uint32_t serial, uint32_t time,
|
||||||
@ -113,6 +116,7 @@ static const struct wl_pointer_listener pointer_listener = {
|
|||||||
.leave = wl_pointer_leave,
|
.leave = wl_pointer_leave,
|
||||||
.motion = wl_pointer_motion,
|
.motion = wl_pointer_motion,
|
||||||
.button = wl_pointer_button,
|
.button = wl_pointer_button,
|
||||||
|
.axis = wl_pointer_axis,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct wl_touch_listener touch_listener = {
|
static const struct wl_touch_listener touch_listener = {
|
||||||
@ -255,6 +259,13 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
|
||||||
|
uint32_t time, uint32_t axis, wl_fixed_t value) {
|
||||||
|
kbd_next_layer(&keyboard, NULL, (value >= 0));
|
||||||
|
drwsurf_flip(keyboard.surf);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
||||||
enum wl_seat_capability caps) {
|
enum wl_seat_capability caps) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user