@ -43,10 +43,7 @@ get_presentation(struct client *client)
{
{
struct global * g ;
struct global * g ;
struct global * global_pres = NULL ;
struct global * global_pres = NULL ;
static struct wp_presentation * pres ;
struct wp_presentation * pres ;
if ( pres )
return pres ;
wl_list_for_each ( g , & client - > global_list , link ) {
wl_list_for_each ( g , & client - > global_list , link ) {
if ( strcmp ( g - > interface , wp_presentation_interface . name ) )
if ( strcmp ( g - > interface , wp_presentation_interface . name ) )
@ -137,13 +134,15 @@ static const struct wp_presentation_feedback_listener feedback_listener = {
} ;
} ;
static struct feedback *
static struct feedback *
feedback_create ( struct client * client , struct wl_surface * surface )
feedback_create ( struct client * client ,
struct wl_surface * surface ,
struct wp_presentation * pres )
{
{
struct feedback * fb ;
struct feedback * fb ;
fb = xzalloc ( sizeof * fb ) ;
fb = xzalloc ( sizeof * fb ) ;
fb - > client = client ;
fb - > client = client ;
fb - > obj = wp_presentation_feedback ( get_ presentation ( client ) , surface ) ;
fb - > obj = wp_presentation_feedback ( pres , surface ) ;
wp_presentation_feedback_add_listener ( fb - > obj , & feedback_listener , fb ) ;
wp_presentation_feedback_add_listener ( fb - > obj , & feedback_listener , fb ) ;
return fb ;
return fb ;
@ -215,13 +214,15 @@ TEST(test_presentation_feedback_simple)
{
{
struct client * client ;
struct client * client ;
struct feedback * fb ;
struct feedback * fb ;
struct wp_presentation * pres ;
client = create_client_and_test_surface ( 100 , 50 , 123 , 77 ) ;
client = create_client_and_test_surface ( 100 , 50 , 123 , 77 ) ;
assert ( client ) ;
assert ( client ) ;
pres = get_presentation ( client ) ;
wl_surface_attach ( client - > surface - > wl_surface ,
wl_surface_attach ( client - > surface - > wl_surface ,
client - > surface - > buffer - > proxy , 0 , 0 ) ;
client - > surface - > buffer - > proxy , 0 , 0 ) ;
fb = feedback_create ( client , client - > surface - > wl_surface ) ;
fb = feedback_create ( client , client - > surface - > wl_surface , pres ) ;
wl_surface_damage ( client - > surface - > wl_surface , 0 , 0 , 100 , 100 ) ;
wl_surface_damage ( client - > surface - > wl_surface , 0 , 0 , 100 , 100 ) ;
wl_surface_commit ( client - > surface - > wl_surface ) ;
wl_surface_commit ( client - > surface - > wl_surface ) ;