@ -35,6 +35,7 @@
# include <stdio.h>
# include <stdio.h>
# include <stdlib.h>
# include <stdlib.h>
# include <stdbool.h>
# include <cairo.h>
# include <cairo.h>
@ -93,6 +94,8 @@ struct eventdemo {
struct display * display ;
struct display * display ;
int x , y , w , h ;
int x , y , w , h ;
bool print_pointer_frame ;
} ;
} ;
/**
/**
@ -223,11 +226,14 @@ static void
button_handler ( struct widget * widget , struct input * input , uint32_t time ,
button_handler ( struct widget * widget , struct input * input , uint32_t time ,
uint32_t button , enum wl_pointer_button_state state , void * data )
uint32_t button , enum wl_pointer_button_state state , void * data )
{
{
struct eventdemo * e = data ;
int32_t x , y ;
int32_t x , y ;
if ( ! log_button )
if ( ! log_button )
return ;
return ;
e - > print_pointer_frame = true ;
input_get_position ( input , & x , & y ) ;
input_get_position ( input , & x , & y ) ;
printf ( " button time: %d, button: %d, state: %s, x: %d, y: %d \n " ,
printf ( " button time: %d, button: %d, state: %s, x: %d, y: %d \n " ,
time , button ,
time , button ,
@ -249,9 +255,13 @@ static void
axis_handler ( struct widget * widget , struct input * input , uint32_t time ,
axis_handler ( struct widget * widget , struct input * input , uint32_t time ,
uint32_t axis , wl_fixed_t value , void * data )
uint32_t axis , wl_fixed_t value , void * data )
{
{
struct eventdemo * e = data ;
if ( ! log_axis )
if ( ! log_axis )
return ;
return ;
e - > print_pointer_frame = true ;
printf ( " axis time: %d, axis: %s, value: %f \n " ,
printf ( " axis time: %d, axis: %s, value: %f \n " ,
time ,
time ,
axis = = WL_POINTER_AXIS_VERTICAL_SCROLL ? " vertical " :
axis = = WL_POINTER_AXIS_VERTICAL_SCROLL ? " vertical " :
@ -262,7 +272,13 @@ axis_handler(struct widget *widget, struct input *input, uint32_t time,
static void
static void
pointer_frame_handler ( struct widget * widget , struct input * input , void * data )
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 " ) ;
printf ( " pointer frame \n " ) ;
e - > print_pointer_frame = false ;
}
}
static void
static void
@ -270,6 +286,9 @@ axis_source_handler(struct widget *widget, struct input *input,
uint32_t source , void * data )
uint32_t source , void * data )
{
{
const char * axis_source ;
const char * axis_source ;
struct eventdemo * e = data ;
e - > print_pointer_frame = true ;
switch ( source ) {
switch ( source ) {
case WL_POINTER_AXIS_SOURCE_WHEEL :
case WL_POINTER_AXIS_SOURCE_WHEEL :
@ -294,6 +313,9 @@ axis_stop_handler(struct widget *widget, struct input *input,
uint32_t time , uint32_t axis ,
uint32_t time , uint32_t axis ,
void * data )
void * data )
{
{
struct eventdemo * e = data ;
e - > print_pointer_frame = true ;
printf ( " axis stop time: %d, axis: %s \n " ,
printf ( " axis stop time: %d, axis: %s \n " ,
time ,
time ,
axis = = WL_POINTER_AXIS_VERTICAL_SCROLL ? " vertical " :
axis = = WL_POINTER_AXIS_VERTICAL_SCROLL ? " vertical " :
@ -304,6 +326,9 @@ static void
axis_discrete_handler ( struct widget * widget , struct input * input ,
axis_discrete_handler ( struct widget * widget , struct input * input ,
uint32_t axis , int32_t discrete , void * data )
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 ) ;
printf ( " axis discrete axis: %d value: %d \n " , axis , discrete ) ;
}
}
@ -328,6 +353,7 @@ motion_handler(struct widget *widget, struct input *input, uint32_t time,
if ( log_motion ) {
if ( log_motion ) {
printf ( " motion time: %d, x: %f, y: %f \n " , time , x , y ) ;
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 )
if ( x > e - > x & & x < e - > x + e - > w )