forked from speedie/spmenu
Fix scrolling on Wayland, apparently you cannot use Linux kernel keycodes
This commit is contained in:
parent
ea48ea69ed
commit
5129856857
|
@ -208,7 +208,6 @@ void keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, uint32_t forma
|
|||
}
|
||||
|
||||
void buttonpress_wl(uint32_t button, double ex, double ey) {
|
||||
struct item *item;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int w;
|
||||
|
@ -217,6 +216,7 @@ void buttonpress_wl(uint32_t button, double ex, double ey) {
|
|||
int item_num = 0;
|
||||
int yp = 0;
|
||||
unsigned int i, click;
|
||||
struct item *item;
|
||||
|
||||
if (ex == 0 && ey == 0) {
|
||||
return; // While it is possible to click at this position, usually it means we're outside the window area.
|
||||
|
@ -240,7 +240,7 @@ void buttonpress_wl(uint32_t button, double ex, double ey) {
|
|||
if (!hidemode) modew = pango_mode ? TEXTWM(tx.modetext) : TEXTW(tx.modetext);
|
||||
if (!hidecaps) capsw = pango_caps ? TEXTWM(tx.capstext) : TEXTW(tx.capstext);
|
||||
|
||||
if (!strcmp(tx.capstext, ""))
|
||||
if (!strcmp(tx.capstext, ""))
|
||||
capsw = 0;
|
||||
|
||||
if ((hideprompt && hideinput && hidemode && hidematchcount && hidecaps) && lines) {
|
||||
|
@ -346,6 +346,21 @@ void pointer_motion_handler(void *data, struct wl_pointer *pointer, uint32_t tim
|
|||
mouse_y = wl_fixed_to_int(y);
|
||||
}
|
||||
|
||||
void pointer_axis_handler(void *data, struct wl_pointer *pointer, uint32_t time, uint32_t axis, wl_fixed_t value) {
|
||||
mouse_scroll = 1;
|
||||
|
||||
if (value > 0) {
|
||||
mouse_scroll_direction = 0;
|
||||
} else {
|
||||
mouse_scroll_direction = 1;
|
||||
}
|
||||
|
||||
buttonpress_wl(mouse_scroll_direction, mouse_x, mouse_y);
|
||||
|
||||
mouse_scroll = 0;
|
||||
mouse_scroll_direction = -1;
|
||||
}
|
||||
|
||||
void pointer_button_handler(void *data, struct wl_pointer *pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state) {
|
||||
if (state != WL_POINTER_BUTTON_STATE_PRESSED) {
|
||||
return; // We don't want a release event to count as a click, only the initial press.
|
||||
|
|
|
@ -65,8 +65,8 @@ static WlMouse wl_cbuttons[256];
|
|||
#define WL_Forward 0x115
|
||||
#define WL_Back 0x116
|
||||
#define WL_Task 0x117
|
||||
#define WL_Up 0x151
|
||||
#define WL_Down 0x150
|
||||
#define WL_Up 1
|
||||
#define WL_Down 0
|
||||
|
||||
static WlKey wlhkeys[1] = { { -1, WL_CtrlAlt, XKB_KEY_Delete, quit, {0} } };
|
||||
|
||||
|
@ -111,9 +111,10 @@ static int output_physical_width = 0;
|
|||
static int output_physical_height = 0;
|
||||
static int output_width = 0;
|
||||
static int output_height = 0;
|
||||
|
||||
static int mouse_x = 0;
|
||||
static int mouse_y = 0;
|
||||
static int mouse_scroll = 0;
|
||||
static int mouse_scroll_direction = 0;
|
||||
|
||||
static void zero();
|
||||
static void resizeclient_wl(struct state *state);
|
||||
|
@ -134,6 +135,7 @@ static void keyboard_repeat_info(void *data, struct wl_keyboard *wl_keyboard, in
|
|||
static void keypress_wl(struct state *state, enum wl_keyboard_key_state key_state, xkb_keysym_t sym);
|
||||
static void pointer_button_handler(void *data, struct wl_pointer *pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state);
|
||||
static void pointer_motion_handler(void *data, struct wl_pointer *pointer, uint32_t time, wl_fixed_t x, wl_fixed_t y);
|
||||
static void pointer_axis_handler(void *data, struct wl_pointer *pointer, uint32_t time, uint32_t axis, wl_fixed_t value);
|
||||
static void buttonpress_wl(uint32_t button, double ex, double ey);
|
||||
static int is_correct_modifier(struct state *state, char *modifier);
|
||||
static int roundtrip(struct state *state);
|
||||
|
@ -188,7 +190,7 @@ static const struct wl_pointer_listener pointer_listener = {
|
|||
.leave = zero,
|
||||
.motion = pointer_motion_handler,
|
||||
.button = pointer_button_handler,
|
||||
.axis = zero,
|
||||
.axis = pointer_axis_handler,
|
||||
};
|
||||
|
||||
struct wl_output_listener output_listener = {
|
||||
|
|
Loading…
Reference in a new issue