#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <cairo.h>
struct display *display;
int x, y, w, h;
+
+ bool print_pointer_frame;
};
/**
button_handler(struct widget *widget, struct input *input, uint32_t time,
uint32_t button, enum wl_pointer_button_state state, void *data)
{
+ struct eventdemo *e = data;
int32_t x, y;
if (!log_button)
return;
+ e->print_pointer_frame = true;
+
input_get_position(input, &x, &y);
printf("button time: %d, button: %d, state: %s, x: %d, y: %d\n",
time, button,
axis_handler(struct widget *widget, struct input *input, uint32_t time,
uint32_t axis, wl_fixed_t value, void *data)
{
+ struct eventdemo *e = data;
+
if (!log_axis)
return;
+ e->print_pointer_frame = true;
+
printf("axis time: %d, axis: %s, value: %f\n",
time,
axis == WL_POINTER_AXIS_VERTICAL_SCROLL ? "vertical" :
static void
pointer_frame_handler(struct widget *widget, struct input *input, void *data)
{
+ struct eventdemo *e = data;
+
+ if (!e->print_pointer_frame)
+ return;
+
printf("pointer frame\n");
+ e->print_pointer_frame = false;
}
static void
uint32_t source, void *data)
{
const char *axis_source;
+ struct eventdemo *e = data;
+
+ e->print_pointer_frame = true;
switch (source) {
case WL_POINTER_AXIS_SOURCE_WHEEL:
uint32_t time, uint32_t axis,
void *data)
{
+ struct eventdemo *e = data;
+
+ e->print_pointer_frame = true;
printf("axis stop time: %d, axis: %s\n",
time,
axis == WL_POINTER_AXIS_VERTICAL_SCROLL ? "vertical" :
axis_discrete_handler(struct widget *widget, struct input *input,
uint32_t axis, int32_t discrete, void *data)
{
+ struct eventdemo *e = data;
+
+ e->print_pointer_frame = true;
printf("axis discrete axis: %d value: %d\n", axis, discrete);
}
if (log_motion) {
printf("motion time: %d, x: %f, y: %f\n", time, x, y);
+ e->print_pointer_frame = true;
}
if (x > e->x && x < e->x + e->w)