@ -193,23 +193,27 @@ static void
xserver_map_shell_surface ( struct weston_wm_window * window ,
struct weston_surface * surface ) ;
static int __attribute__ ( ( format ( printf , 1 , 2 ) ) )
wm_log ( const char * fmt , . . . )
static bool
wm_debug_is_enabled ( struct weston_wm * wm )
{
# ifdef WM_DEBUG
int l ;
va_list argp ;
return weston_debug_scope_is_enabled ( wm - > server - > wm_debug ) ;
}
va_start ( argp , fmt ) ;
l = weston_vlog ( fmt , argp ) ;
va_end ( argp ) ;
static void __attribute__ ( ( format ( printf , 2 , 3 ) ) )
wm_printf ( struct weston_wm * wm , const char * fmt , . . . )
{
va_list ap ;
char timestr [ 128 ] ;
return l ;
# else
return 0 ;
# endif
}
if ( wm_debug_is_enabled ( wm ) )
weston_debug_scope_printf ( wm - > server - > wm_debug , " %s " ,
weston_debug_scope_timestamp ( wm - > server - > wm_debug ,
timestr , sizeof timestr ) ) ;
va_start ( ap , fmt ) ;
weston_debug_scope_vprintf ( wm - > server - > wm_debug , fmt , ap ) ;
va_end ( ap ) ;
}
static void
weston_output_weak_ref_init ( struct weston_output_weak_ref * ref )
{
@ -717,7 +721,7 @@ weston_wm_handle_configure_request(struct weston_wm *wm, xcb_generic_event_t *ev
uint32_t mask , values [ 16 ] ;
int x , y , width , height , i = 0 ;
wm_log ( " XCB_CONFIGURE_REQUEST (window %d) %d,%d @ %dx%d \n " ,
wm_printf ( wm , " XCB_CONFIGURE_REQUEST (window %d) %d,%d @ %dx%d \n " ,
configure_request - > window ,
configure_request - > x , configure_request - > y ,
configure_request - > width , configure_request - > height ) ;
@ -786,7 +790,7 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
wm - > server - > compositor - > xwayland_interface ;
struct weston_wm_window * window ;
wm_log ( " XCB_CONFIGURE_NOTIFY (window %d) %d,%d @ %dx%d%s \n " ,
wm_printf ( wm , " XCB_CONFIGURE_NOTIFY (window %d) %d,%d @ %dx%d%s \n " ,
configure_notify - > window ,
configure_notify - > x , configure_notify - > y ,
configure_notify - > width , configure_notify - > height ,
@ -839,7 +843,7 @@ weston_wm_create_surface(struct wl_listener *listener, void *data)
if ( wl_resource_get_client ( surface - > resource ) ! = wm - > server - > client )
return ;
wm_log ( " XWM: create weston_surface %p \n " , surface ) ;
wm_printf ( wm , " XWM: create weston_surface %p \n " , surface ) ;
wl_list_for_each ( window , & wm - > unpaired_window_list , link )
if ( window - > surface_id = =
@ -1096,7 +1100,7 @@ weston_wm_handle_map_request(struct weston_wm *wm, xcb_generic_event_t *event)
struct weston_output * output ;
if ( our_resource ( wm , map_request - > window ) ) {
wm_log ( " XCB_MAP_REQUEST (window %d, ours) \n " ,
wm_printf ( wm , " XCB_MAP_REQUEST (window %d, ours) \n " ,
map_request - > window ) ;
return ;
}
@ -1126,7 +1130,7 @@ weston_wm_handle_map_request(struct weston_wm *wm, xcb_generic_event_t *event)
weston_wm_window_create_frame ( window ) ; /* sets frame_id */
assert ( window - > frame_id ! = XCB_WINDOW_NONE ) ;
wm_log ( " XCB_MAP_REQUEST (window %d, %p, frame %d, %dx%d @ %d,%d) \n " ,
wm_printf ( wm , " XCB_MAP_REQUEST (window %d, %p, frame %d, %dx%d @ %d,%d) \n " ,
window - > id , window , window - > frame_id ,
window - > width , window - > height ,
window - > map_request_x , window - > map_request_y ) ;
@ -1157,12 +1161,12 @@ weston_wm_handle_map_notify(struct weston_wm *wm, xcb_generic_event_t *event)
xcb_map_notify_event_t * map_notify = ( xcb_map_notify_event_t * ) event ;
if ( our_resource ( wm , map_notify - > window ) ) {
wm_log ( " XCB_MAP_NOTIFY (window %d, ours) \n " ,
wm_printf ( wm , " XCB_MAP_NOTIFY (window %d, ours) \n " ,
map_notify - > window ) ;
return ;
}
wm_log ( " XCB_MAP_NOTIFY (window %d%s) \n " , map_notify - > window ,
wm_printf ( wm , " XCB_MAP_NOTIFY (window %d%s) \n " , map_notify - > window ,
map_notify - > override_redirect ? " , override " : " " ) ;
}
@ -1173,7 +1177,7 @@ weston_wm_handle_unmap_notify(struct weston_wm *wm, xcb_generic_event_t *event)
( xcb_unmap_notify_event_t * ) event ;
struct weston_wm_window * window ;
wm_log ( " XCB_UNMAP_NOTIFY (window %d, event %d%s) \n " ,
wm_printf ( wm , " XCB_UNMAP_NOTIFY (window %d, event %d%s) \n " ,
unmap_notify - > window ,
unmap_notify - > event ,
our_resource ( wm , unmap_notify - > window ) ? " , ours " : " " ) ;
@ -1216,7 +1220,7 @@ weston_wm_window_draw_decoration(struct weston_wm_window *window)
cairo_t * cr ;
int width , height ;
wm_log ( " XWM: draw decoration, win %d \n " , window - > id ) ;
wm_printf ( window - > wm , " XWM: draw decoration, win %d \n " , window - > id ) ;
weston_wm_window_get_frame_size ( window , & width , & height ) ;
@ -1279,7 +1283,7 @@ weston_wm_window_set_pending_state(struct weston_wm_window *window)
input_h = height ;
}
wm_log ( " XWM: win %d geometry: %d,%d %dx%d \n " ,
wm_printf ( window - > wm , " XWM: win %d geometry: %d,%d %dx%d \n " ,
window - > id , input_x , input_y , input_w , input_h ) ;
pixman_region32_fini ( & window - > surface - > pending . input ) ;
@ -1347,7 +1351,7 @@ weston_wm_window_schedule_repaint(struct weston_wm_window *window)
if ( window - > repaint_source )
return ;
wm_log ( " XWM: schedule repaint, win %d \n " , window - > id ) ;
wm_printf ( wm , " XWM: schedule repaint, win %d \n " , window - > id ) ;
window - > repaint_source =
wl_event_loop_add_idle ( wm - > server - > loop ,
@ -1360,18 +1364,24 @@ weston_wm_handle_property_notify(struct weston_wm *wm, xcb_generic_event_t *even
xcb_property_notify_event_t * property_notify =
( xcb_property_notify_event_t * ) event ;
struct weston_wm_window * window ;
FILE * fp ;
FILE * fp = NULL ;
char * logstr ;
size_t logsize ;
char timestr [ 128 ] ;
if ( ! wm_lookup_window ( wm , property_notify - > window , & window ) )
return ;
window - > properties_dirty = 1 ;
if ( wm_debug_is_enabled ( wm ) )
fp = open_memstream ( & logstr , & logsize ) ;
if ( fp ) {
fprintf ( fp , " XCB_PROPERTY_NOTIFY: window %d, " , property_notify - > window ) ;
fprintf ( fp , " %s XCB_PROPERTY_NOTIFY: window %d, " ,
weston_debug_scope_timestamp ( wm - > server - > wm_debug ,
timestr , sizeof timestr ) ,
property_notify - > window ) ;
if ( property_notify - > state = = XCB_PROPERTY_DELETE )
fprintf ( fp , " deleted %s \n " ,
get_atom_name ( wm - > conn , property_notify - > atom ) ) ;
@ -1380,7 +1390,8 @@ weston_wm_handle_property_notify(struct weston_wm *wm, xcb_generic_event_t *even
property_notify - > atom ) ;
if ( fclose ( fp ) = = 0 )
wm_log ( " %s " , logstr ) ;
weston_debug_scope_write ( wm - > server - > wm_debug ,
logstr , logsize ) ;
free ( logstr ) ;
} else {
/* read_and_dump_property() is a X11 roundtrip.
@ -1406,7 +1417,7 @@ weston_wm_window_create(struct weston_wm *wm,
window = zalloc ( sizeof * window ) ;
if ( window = = NULL ) {
wm_log ( " failed to allocate window \n " ) ;
wm_printf ( wm , " failed to allocate window \n " ) ;
return ;
}
@ -1479,7 +1490,7 @@ weston_wm_handle_create_notify(struct weston_wm *wm, xcb_generic_event_t *event)
xcb_create_notify_event_t * create_notify =
( xcb_create_notify_event_t * ) event ;
wm_log ( " XCB_CREATE_NOTIFY (window %d, at (%d, %d), width %d, height %d%s%s) \n " ,
wm_printf ( wm , " XCB_CREATE_NOTIFY (window %d, at (%d, %d), width %d, height %d%s%s) \n " ,
create_notify - > window ,
create_notify - > x , create_notify - > y ,
create_notify - > width , create_notify - > height ,
@ -1502,7 +1513,7 @@ weston_wm_handle_destroy_notify(struct weston_wm *wm, xcb_generic_event_t *event
( xcb_destroy_notify_event_t * ) event ;
struct weston_wm_window * window ;
wm_log ( " XCB_DESTROY_NOTIFY, win %d, event %d%s \n " ,
wm_printf ( wm , " XCB_DESTROY_NOTIFY, win %d, event %d%s \n " ,
destroy_notify - > window ,
destroy_notify - > event ,
our_resource ( wm , destroy_notify - > window ) ? " , ours " : " " ) ;
@ -1523,7 +1534,7 @@ weston_wm_handle_reparent_notify(struct weston_wm *wm, xcb_generic_event_t *even
( xcb_reparent_notify_event_t * ) event ;
struct weston_wm_window * window ;
wm_log ( " XCB_REPARENT_NOTIFY (window %d, parent %d, event %d%s) \n " ,
wm_printf ( wm , " XCB_REPARENT_NOTIFY (window %d, parent %d, event %d%s) \n " ,
reparent_notify - > window ,
reparent_notify - > parent ,
reparent_notify - > event ,
@ -1734,7 +1745,7 @@ surface_destroy(struct wl_listener *listener, void *data)
container_of ( listener ,
struct weston_wm_window , surface_destroy_listener ) ;
wm_log ( " surface for xid %d destroyed \n " , window - > id ) ;
wm_printf ( window - > wm , " surface for xid %d destroyed \n " , window - > id ) ;
/* This should have been freed by the shell.
* Don ' t try to use it later . */
@ -1750,7 +1761,8 @@ weston_wm_window_handle_surface_id(struct weston_wm_window *window,
struct wl_resource * resource ;
if ( window - > surface_id ! = 0 ) {
wm_log ( " already have surface id for window %d \n " , window - > id ) ;
wm_printf ( wm , " already have surface id for window %d \n " ,
window - > id ) ;
return ;
}
@ -1782,7 +1794,7 @@ weston_wm_handle_client_message(struct weston_wm *wm,
( xcb_client_message_event_t * ) event ;
struct weston_wm_window * window ;
wm_log ( " XCB_CLIENT_MESSAGE (%s %d %d %d %d %d win %d) \n " ,
wm_printf ( wm , " XCB_CLIENT_MESSAGE (%s %d %d %d %d %d win %d) \n " ,
get_atom_name ( wm - > conn , client_message - > type ) ,
client_message - > data . data32 [ 0 ] ,
client_message - > data . data32 [ 1 ] ,
@ -2007,7 +2019,7 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event)
uint32_t button_id ;
uint32_t double_click = 0 ;
wm_log ( " XCB_BUTTON_%s (detail %d) \n " ,
wm_printf ( wm , " XCB_BUTTON_%s (detail %d) \n " ,
button - > response_type = = XCB_BUTTON_PRESS ?
" PRESS " : " RELEASE " , button - > detail ) ;
@ -2221,7 +2233,7 @@ weston_wm_handle_event(int fd, uint32_t mask, void *data)
weston_wm_handle_destroy_notify ( wm , event ) ;
break ;
case XCB_MAPPING_NOTIFY :
wm_log ( " XCB_MAPPING_NOTIFY \n " ) ;
wm_printf ( wm , " XCB_MAPPING_NOTIFY \n " ) ;
break ;
case XCB_PROPERTY_NOTIFY :
weston_wm_handle_property_notify ( wm , event ) ;
@ -2837,7 +2849,7 @@ xserver_map_shell_surface(struct weston_wm_window *window,
window - > surface ,
& shell_client ) ;
wm_log ( " XWM: map shell surface, win %d, weston_surface %p, xwayland surface %p \n " ,
wm_printf ( wm , " XWM: map shell surface, win %d, weston_surface %p, xwayland surface %p \n " ,
window - > id , window - > surface , window - > shsurf ) ;
if ( window - > name )