mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-01-18 17:52:30 +00:00
[client] wayland: fix discrete mouse scroll speed
This commit is contained in:
@@ -32,6 +32,9 @@
|
|||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
|
|
||||||
|
const double WL_SCROLL_STEP = 15.0;
|
||||||
|
const double WL_HALF_SCROLL_STEP = WL_SCROLL_STEP / 2.0;
|
||||||
|
|
||||||
// Mouse-handling listeners.
|
// Mouse-handling listeners.
|
||||||
|
|
||||||
static void pointerMotionHandler(void * data, struct wl_pointer * pointer,
|
static void pointerMotionHandler(void * data, struct wl_pointer * pointer,
|
||||||
@@ -91,12 +94,25 @@ static void pointerAxisHandler(void * data, struct wl_pointer * pointer,
|
|||||||
if (axis != WL_POINTER_AXIS_VERTICAL_SCROLL)
|
if (axis != WL_POINTER_AXIS_VERTICAL_SCROLL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int button = value > 0 ?
|
double delta = wl_fixed_to_double(value);
|
||||||
5 /* SPICE_MOUSE_BUTTON_DOWN */ :
|
|
||||||
4 /* SPICE_MOUSE_BUTTON_UP */;
|
wlWm.scrollState += delta;
|
||||||
app_handleButtonPress(button);
|
|
||||||
app_handleButtonRelease(button);
|
while (wlWm.scrollState > WL_HALF_SCROLL_STEP)
|
||||||
app_handleWheelMotion(wl_fixed_to_double(value) / 15.0);
|
{
|
||||||
|
app_handleButtonPress(5 /* SPICE_MOUSE_BUTTON_DOWN */);
|
||||||
|
app_handleButtonRelease(5 /* SPICE_MOUSE_BUTTON_DOWN */);
|
||||||
|
wlWm.scrollState -= WL_SCROLL_STEP;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (wlWm.scrollState < -WL_HALF_SCROLL_STEP)
|
||||||
|
{
|
||||||
|
app_handleButtonPress(4 /* SPICE_MOUSE_BUTTON_UP */);
|
||||||
|
app_handleButtonRelease(4 /* SPICE_MOUSE_BUTTON_UP */);
|
||||||
|
wlWm.scrollState += WL_SCROLL_STEP;
|
||||||
|
}
|
||||||
|
|
||||||
|
app_handleWheelMotion(delta / WL_SCROLL_STEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mapWaylandToSpiceButton(uint32_t button)
|
static int mapWaylandToSpiceButton(uint32_t button)
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ struct WaylandDSState
|
|||||||
bool configured;
|
bool configured;
|
||||||
bool warpSupport;
|
bool warpSupport;
|
||||||
double cursorX, cursorY;
|
double cursorX, cursorY;
|
||||||
|
double scrollState;
|
||||||
|
|
||||||
#if defined(ENABLE_EGL) || defined(ENABLE_OPENGL)
|
#if defined(ENABLE_EGL) || defined(ENABLE_OPENGL)
|
||||||
struct wl_egl_window * eglWindow;
|
struct wl_egl_window * eglWindow;
|
||||||
|
|||||||
Reference in New Issue
Block a user