mirror of https://github.com/FreeRDP/FreeRDP
Added wayland discrete axis events for mouse wheel
the discrete axis event gives changes in steps just like the xfreerdp version uses. This way scrolling can be implemented consistent with the behaviour of xfreerdp
This commit is contained in:
parent
522c0cb3ad
commit
25ab8c8b9c
|
@ -137,9 +137,9 @@ BOOL wlf_handle_pointer_axis(freerdp* instance, const UwacPointerAxisEvent* ev)
|
|||
{
|
||||
rdpInput* input;
|
||||
UINT16 flags = 0;
|
||||
int direction;
|
||||
uint32_t step;
|
||||
int32_t direction;
|
||||
uint32_t x, y;
|
||||
uint32_t i;
|
||||
|
||||
if (!instance || !ev || !instance->input)
|
||||
return FALSE;
|
||||
|
@ -152,7 +152,7 @@ BOOL wlf_handle_pointer_axis(freerdp* instance, const UwacPointerAxisEvent* ev)
|
|||
|
||||
input = instance->input;
|
||||
|
||||
direction = wl_fixed_to_int(ev->value);
|
||||
direction = ev->value;
|
||||
switch (ev->axis)
|
||||
{
|
||||
case WL_POINTER_AXIS_VERTICAL_SCROLL:
|
||||
|
@ -176,17 +176,14 @@ BOOL wlf_handle_pointer_axis(freerdp* instance, const UwacPointerAxisEvent* ev)
|
|||
* positive: 0 ... 0xFF -> slow ... fast
|
||||
* negative: 0 ... 0xFF -> fast ... slow
|
||||
*/
|
||||
step = abs(direction);
|
||||
if (step > 0xFF)
|
||||
step = 0xFF;
|
||||
for (i = 0; i < abs(direction); i++)
|
||||
{
|
||||
const uint32_t cflags = flags | 0x78;
|
||||
if (!freerdp_input_send_mouse_event(input, cflags, (UINT16)x, (UINT16)y))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Negative rotation, so count down steps from top */
|
||||
if (flags & PTR_FLAGS_WHEEL_NEGATIVE)
|
||||
step = 0xFF - step;
|
||||
|
||||
flags |= step;
|
||||
|
||||
return freerdp_input_send_mouse_event(input, flags, (UINT16)x, (UINT16)y);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL wlf_handle_key(freerdp* instance, const UwacKeyEvent* ev)
|
||||
|
|
|
@ -356,6 +356,9 @@ static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display)
|
|||
break;
|
||||
|
||||
case UWAC_EVENT_POINTER_AXIS:
|
||||
break;
|
||||
|
||||
case UWAC_EVENT_POINTER_AXIS_DISCRETE:
|
||||
if (!wlf_handle_pointer_axis(instance, &event.mouse_axis))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@ enum
|
|||
UWAC_EVENT_CLIPBOARD_SELECT,
|
||||
UWAC_EVENT_CLIPBOARD_OFFER,
|
||||
UWAC_EVENT_OUTPUT_GEOMETRY,
|
||||
UWAC_EVENT_POINTER_AXIS_DISCRETE
|
||||
};
|
||||
|
||||
/** @brief window states */
|
||||
|
|
|
@ -862,6 +862,24 @@ static void pointer_axis_discrete(void* data, struct wl_pointer* wl_pointer, uin
|
|||
int32_t discrete)
|
||||
{
|
||||
/*UwacSeat *seat = data;*/
|
||||
UwacPointerAxisEvent* event;
|
||||
UwacSeat* seat = data;
|
||||
UwacWindow* window = seat->pointer_focus;
|
||||
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
event =
|
||||
(UwacPointerAxisEvent*)UwacDisplayNewEvent(seat->display, UWAC_EVENT_POINTER_AXIS_DISCRETE);
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
event->seat = seat;
|
||||
event->window = window;
|
||||
event->x = seat->sx;
|
||||
event->y = seat->sy;
|
||||
event->axis = axis;
|
||||
event->value = discrete;
|
||||
}
|
||||
|
||||
static const struct wl_pointer_listener pointer_listener = {
|
||||
|
|
Loading…
Reference in New Issue