@ -206,6 +206,9 @@ weston_surface_create(struct weston_compositor *compositor,
surface - > buffer_destroy_listener . func = surface_handle_buffer_destroy ;
surface - > buffer_destroy_listener . func = surface_handle_buffer_destroy ;
wl_list_init ( & surface - > geometry . transformation_list ) ;
wl_list_init ( & surface - > geometry . transformation_list ) ;
wl_list_insert ( & surface - > geometry . transformation_list ,
& surface - > transform . position . link ) ;
weston_matrix_init ( & surface - > transform . position . matrix ) ;
surface - > geometry . dirty = 1 ;
surface - > geometry . dirty = 1 ;
return surface ;
return surface ;
@ -239,13 +242,20 @@ weston_surface_update_transform(struct weston_surface *surface)
surface - > geometry . dirty = 0 ;
surface - > geometry . dirty = 0 ;
if ( wl_list_empty ( & surface - > geometry . transformation_list ) ) {
/* transform.position is always in transformation_list */
if ( surface - > geometry . transformation_list . next = =
& surface - > transform . position . link & &
surface - > geometry . transformation_list . prev = =
& surface - > transform . position . link ) {
surface - > transform . enabled = 0 ;
surface - > transform . enabled = 0 ;
return ;
return ;
}
}
surface - > transform . enabled = 1 ;
surface - > transform . enabled = 1 ;
surface - > transform . position . matrix . d [ 12 ] = surface - > x ;
surface - > transform . position . matrix . d [ 13 ] = surface - > y ;
weston_matrix_init ( matrix ) ;
weston_matrix_init ( matrix ) ;
wl_list_for_each ( tform , & surface - > geometry . transformation_list , link )
wl_list_for_each ( tform , & surface - > geometry . transformation_list , link )
weston_matrix_multiply ( matrix , & tform - > matrix ) ;
weston_matrix_multiply ( matrix , & tform - > matrix ) ;
@ -267,9 +277,6 @@ weston_surface_to_global(struct weston_surface *surface,
if ( surface - > transform . enabled ) {
if ( surface - > transform . enabled ) {
struct weston_vector v = { { sx , sy , 0.0f , 1.0f } } ;
struct weston_vector v = { { sx , sy , 0.0f , 1.0f } } ;
v . f [ 0 ] + = surface - > x ;
v . f [ 1 ] + = surface - > y ;
weston_matrix_transform ( & surface - > transform . matrix , & v ) ;
weston_matrix_transform ( & surface - > transform . matrix , & v ) ;
if ( fabsf ( v . f [ 3 ] ) < 1e-6 ) {
if ( fabsf ( v . f [ 3 ] ) < 1e-6 ) {
@ -307,8 +314,8 @@ surface_from_global_float(struct weston_surface *surface,
return ;
return ;
}
}
* sx = v . f [ 0 ] / v . f [ 3 ] - surface - > x ;
* sx = v . f [ 0 ] / v . f [ 3 ] ;
* sy = v . f [ 1 ] / v . f [ 3 ] - surface - > y ;
* sy = v . f [ 1 ] / v . f [ 3 ] ;
} else {
} else {
* sx = x - surface - > x ;
* sx = x - surface - > x ;
* sy = y - surface - > y ;
* sy = y - surface - > y ;
@ -394,6 +401,7 @@ weston_surface_configure(struct weston_surface *surface,
surface - > y = y ;
surface - > y = y ;
surface - > width = width ;
surface - > width = width ;
surface - > height = height ;
surface - > height = height ;
surface - > geometry . dirty = 1 ;
weston_surface_assign_output ( surface ) ;
weston_surface_assign_output ( surface ) ;
weston_surface_damage ( surface ) ;
weston_surface_damage ( surface ) ;
@ -1231,6 +1239,7 @@ notify_motion(struct wl_input_device *device, uint32_t time, int x, int y)
wd - > sprite - > x = device - > x - wd - > hotspot_x ;
wd - > sprite - > x = device - > x - wd - > hotspot_x ;
wd - > sprite - > y = device - > y - wd - > hotspot_y ;
wd - > sprite - > y = device - > y - wd - > hotspot_y ;
wd - > sprite - > geometry . dirty = 1 ;
weston_surface_damage ( wd - > sprite ) ;
weston_surface_damage ( wd - > sprite ) ;
}
}
@ -1585,6 +1594,7 @@ input_device_attach(struct wl_client *client,
device - > sprite - > height = buffer - > height ;
device - > sprite - > height = buffer - > height ;
device - > sprite - > x = device - > input_device . x - device - > hotspot_x ;
device - > sprite - > x = device - > input_device . x - device - > hotspot_x ;
device - > sprite - > y = device - > input_device . y - device - > hotspot_y ;
device - > sprite - > y = device - > input_device . y - device - > hotspot_y ;
device - > sprite - > geometry . dirty = 1 ;
weston_surface_damage ( device - > sprite ) ;
weston_surface_damage ( device - > sprite ) ;
}
}