|
|
|
@ -70,6 +70,9 @@ static int log_key = 0; |
|
|
|
|
/** set to log button events */ |
|
|
|
|
static int log_button = 0; |
|
|
|
|
|
|
|
|
|
/** set to log axis events */ |
|
|
|
|
static int log_axis = 0; |
|
|
|
|
|
|
|
|
|
/** set to log motion events */ |
|
|
|
|
static int log_motion = 0; |
|
|
|
|
|
|
|
|
@ -229,6 +232,29 @@ button_handler(struct widget *widget, struct input *input, uint32_t time, |
|
|
|
|
x, y); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief CALLBACK function, Wayland informs about axis event |
|
|
|
|
* \param widget widget |
|
|
|
|
* \param input input device that caused the axis event |
|
|
|
|
* \param time time the event happened |
|
|
|
|
* \param axis vertical or horizontal |
|
|
|
|
* \param value amount of scrolling |
|
|
|
|
* \param data user data associated to the widget |
|
|
|
|
*/ |
|
|
|
|
static void |
|
|
|
|
axis_handler(struct widget *widget, struct input *input, uint32_t time, |
|
|
|
|
uint32_t axis, wl_fixed_t value, void *data) |
|
|
|
|
{ |
|
|
|
|
if (!log_axis) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
printf("axis time: %d, axis: %s, value: %f\n", |
|
|
|
|
time, |
|
|
|
|
axis == WL_POINTER_AXIS_VERTICAL_SCROLL ? "vertical" : |
|
|
|
|
"horizontal", |
|
|
|
|
wl_fixed_to_double(value)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief CALLBACK function, Waylands informs about pointer motion |
|
|
|
|
* \param widget widget |
|
|
|
@ -317,6 +343,9 @@ eventdemo_create(struct display *d) |
|
|
|
|
/* Set the callback motion handler for the window */ |
|
|
|
|
widget_set_motion_handler(e->widget, motion_handler); |
|
|
|
|
|
|
|
|
|
/* Set the callback axis handler for the window */ |
|
|
|
|
widget_set_axis_handler(e->widget, axis_handler); |
|
|
|
|
|
|
|
|
|
/* Initial drawing of the window */ |
|
|
|
|
window_schedule_resize(e->window, width, height); |
|
|
|
|
|
|
|
|
@ -347,6 +376,7 @@ static const struct weston_option eventdemo_options[] = { |
|
|
|
|
{ WESTON_OPTION_BOOLEAN, "log-focus", '0', &log_focus }, |
|
|
|
|
{ WESTON_OPTION_BOOLEAN, "log-key", '0', &log_key }, |
|
|
|
|
{ WESTON_OPTION_BOOLEAN, "log-button", '0', &log_button }, |
|
|
|
|
{ WESTON_OPTION_BOOLEAN, "log-axis", '0', &log_axis }, |
|
|
|
|
{ WESTON_OPTION_BOOLEAN, "log-motion", '0', &log_motion }, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|