@ -127,6 +127,9 @@ static Eina_Bool _e_border_cb_grab_replay(void *data,
void * event ) ;
static void _e_border_cb_drag_finished ( E_Drag * drag ,
int dropped ) ;
static Eina_Bool _e_border_cb_desk_window_profile_change ( void * data ,
int ev_type ,
void * ev ) ;
static void _e_border_eval ( E_Border * bd ) ;
static void _e_border_eval0 ( E_Border * bd ) ;
@ -339,6 +342,8 @@ e_border_init(void)
_e_border_cb_config_icon_theme , NULL ) ;
E_LIST_HANDLER_APPEND ( handlers , E_EVENT_CONFIG_MODE_CHANGED ,
_e_border_cb_config_mode , NULL ) ;
E_LIST_HANDLER_APPEND ( handlers , E_EVENT_DESK_WINDOW_PROFILE_CHANGE ,
_e_border_cb_desk_window_profile_change , NULL ) ;
if ( ! borders_hash ) borders_hash = eina_hash_string_superfast_new ( NULL ) ;
@ -662,6 +667,9 @@ e_border_new(E_Container *con,
video_parent = EINA_TRUE ;
else if ( atoms [ i ] = = ECORE_X_ATOM_E_VIDEO_POSITION )
video_position = EINA_TRUE ;
/* loop to check for window profile list atom */
else if ( atoms [ i ] = = ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED )
bd - > client . e . fetch . profile = 1 ;
}
if ( video_position & & video_parent )
{
@ -934,6 +942,18 @@ e_border_desk_set(E_Border *bd,
E_OBJECT_CHECK ( desk ) ;
E_OBJECT_TYPE_CHECK ( desk , E_DESK_TYPE ) ;
if ( bd - > desk = = desk ) return ;
if ( ( e_config - > use_desktop_window_profile ) & &
( bd - > client . e . state . profile . use ) )
{
if ( bd - > client . e . state . profile . wait_for_done ) return ;
if ( strcmp ( bd - > client . e . state . profile . name , desk - > window_profile ) ! = 0 )
{
ecore_x_e_window_profile_change_request_send ( bd - > client . win ,
desk - > window_profile ) ;
bd - > client . e . state . profile . wait_for_done = 1 ;
return ;
}
}
ecore_x_window_shadow_tree_flush ( ) ;
if ( bd - > fullscreen )
{
@ -4812,6 +4832,34 @@ e_border_resize_limit(E_Border *bd,
static void
_e_border_free ( E_Border * bd )
{
if ( bd - > client . e . state . profile . use )
{
if ( bd - > client . e . state . profile . available_list )
{
int i ;
for ( i = 0 ; i < bd - > client . e . state . profile . num ; i + + )
{
if ( bd - > client . e . state . profile . available_list [ i ] )
{
eina_stringshare_del ( bd - > client . e . state . profile . available_list [ i ] ) ;
bd - > client . e . state . profile . available_list [ i ] = NULL ;
}
}
E_FREE ( bd - > client . e . state . profile . available_list ) ;
bd - > client . e . state . profile . available_list = NULL ;
}
bd - > client . e . state . profile . num = 0 ;
if ( bd - > client . e . state . profile . name )
{
eina_stringshare_del ( bd - > client . e . state . profile . name ) ;
bd - > client . e . state . profile . name = NULL ;
}
bd - > client . e . state . profile . wait_for_done = 0 ;
bd - > client . e . state . profile . use = 0 ;
}
if ( bd - > client . e . state . video_parent & & bd - > client . e . state . video_parent_border )
{
bd - > client . e . state . video_parent_border - > client . e . state . video_child =
@ -5826,6 +5874,16 @@ _e_border_cb_window_property(void *data __UNUSED__,
bd - > client . netwm . fetch . state = 1 ;
bd - > changed = 1 ;
}
else if ( e - > atom = = ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED )
{
bd - > client . e . fetch . profile = 1 ;
bd - > changed = 1 ;
}
else if ( e - > atom = = ECORE_X_ATOM_E_WINDOW_PROFILE_AVAILABLE_LIST )
{
bd - > client . e . fetch . profile = 1 ;
bd - > changed = 1 ;
}
return ECORE_CALLBACK_PASS_ON ;
}
@ -6053,17 +6111,54 @@ _e_border_cb_window_focus_out(void *data __UNUSED__,
static Eina_Bool
_e_border_cb_client_message ( void * data __UNUSED__ ,
int ev_type __UNUSED__ ,
void * ev __UNUSED__ )
void * ev )
{
/*
E_Border * bd ;
Ecore_X_Event_Client_Message * e ;
E_Border * bd ;
Ecore_X_Event_Client_Message * e ;
char * profile = NULL ;
e = ev ;
bd = e_border_find_by_client_window ( e - > win ) ;
if ( ! bd ) return 1 ;
*/
return 1 ;
e = ( Ecore_X_Event_Client_Message * ) ev ;
bd = e_border_find_by_client_window ( e - > win ) ;
if ( ! bd ) return ECORE_CALLBACK_PASS_ON ;
if ( e - > message_type = = ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE )
{
if ( bd - > client . e . state . profile . use )
{
profile = ecore_x_atom_name_get ( e - > data . l [ 1 ] ) ;
ecore_x_e_window_profile_change_request_send ( bd - > client . win ,
profile ) ;
bd - > client . e . state . profile . wait_for_done = 1 ;
}
}
else if ( e - > message_type = = ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_DONE )
{
if ( ( bd - > client . e . state . profile . use ) & &
( bd - > client . e . state . profile . wait_for_done ) )
{
E_Container * con = bd - > zone - > container ;
E_Desk * desk = NULL ;
profile = ecore_x_atom_name_get ( e - > data . l [ 1 ] ) ;
if ( profile )
{
if ( bd - > client . e . state . profile . name )
eina_stringshare_del ( bd - > client . e . state . profile . name ) ;
bd - > client . e . state . profile . name = eina_stringshare_add ( profile ) ;
}
bd - > client . e . state . profile . wait_for_done = 0 ;
desk = e_container_desk_window_profile_get ( con , profile ) ;
if ( ( desk ) & & ( bd - > desk ! = desk ) )
e_border_desk_set ( bd , desk ) ;
}
}
if ( profile )
free ( profile ) ;
return ECORE_CALLBACK_PASS_ON ;
}
static Eina_Bool
@ -6966,6 +7061,27 @@ _e_border_cb_drag_finished(E_Drag *drag,
drag_border = NULL ;
}
static Eina_Bool
_e_border_cb_desk_window_profile_change ( void * data __UNUSED__ ,
int ev_type __UNUSED__ ,
void * ev )
{
E_Event_Desk_Window_Profile_Change * e ;
Eina_List * l = NULL ;
E_Border * bd ;
e = ( E_Event_Desk_Window_Profile_Change * ) ev ;
EINA_LIST_FOREACH ( borders , l , bd )
{
if ( ! e_object_is_del ( E_OBJECT ( bd ) ) )
{
bd - > client . e . fetch . profile = 1 ;
bd - > changed = 1 ;
}
}
return ECORE_CALLBACK_PASS_ON ;
}
static Eina_Bool
_e_border_post_move_resize_job ( void * data )
{
@ -7060,6 +7176,7 @@ _e_border_eval0(E_Border *bd)
{
int change_urgent = 0 ;
int rem_change = 0 ;
Eina_Bool need_desk_set = EINA_FALSE ;
if ( e_object_is_del ( E_OBJECT ( bd ) ) )
{
@ -7188,6 +7305,69 @@ _e_border_eval0(E_Border *bd)
bd - > client . e . fetch . state = 0 ;
rem_change = 1 ;
}
if ( bd - > client . e . fetch . profile )
{
const char * * list = NULL ;
int n , i , res ;
unsigned int use ;
if ( bd - > client . e . state . profile . name )
{
eina_stringshare_del ( bd - > client . e . state . profile . name ) ;
bd - > client . e . state . profile . name = NULL ;
}
if ( bd - > client . e . state . profile . available_list )
{
for ( i = 0 ; i < bd - > client . e . state . profile . num ; i + + )
{
if ( bd - > client . e . state . profile . available_list [ i ] )
{
eina_stringshare_del ( bd - > client . e . state . profile . available_list [ i ] ) ;
bd - > client . e . state . profile . available_list [ i ] = NULL ;
}
}
E_FREE ( bd - > client . e . state . profile . available_list ) ;
bd - > client . e . state . profile . available_list = NULL ;
}
bd - > client . e . state . profile . num = 0 ;
res = ecore_x_window_prop_card32_get ( bd - > client . win ,
ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED ,
& use ,
1 ) ;
if ( ( res = = 1 ) & & ( use = = 1 ) )
{
Ecore_X_Atom val ;
res = ecore_x_window_prop_atom_get ( bd - > client . win ,
ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE ,
& val , 1 ) ;
if ( res = = 1 )
{
char * name = ecore_x_atom_name_get ( val ) ;
if ( name )
{
bd - > client . e . state . profile . name = eina_stringshare_add ( name ) ;
free ( name ) ;
}
}
if ( ecore_x_e_window_available_profiles_get ( bd - > client . win , & list , & n ) )
{
bd - > client . e . state . profile . available_list = E_NEW ( const char * , n ) ;
for ( i = 0 ; i < n ; i + + )
bd - > client . e . state . profile . available_list [ i ] = eina_stringshare_add ( list [ i ] ) ;
bd - > client . e . state . profile . num = n ;
}
need_desk_set = EINA_TRUE ;
bd - > client . e . state . profile . use = 1 ;
if ( list )
free ( list ) ;
}
bd - > client . e . fetch . profile = 0 ;
}
if ( bd - > client . netwm . fetch . type )
{
e_hints_window_type_get ( bd ) ;
@ -7813,6 +7993,55 @@ _e_border_eval0(E_Border *bd)
bd - > client . netwm . update . state = 0 ;
}
if ( ( e_config - > use_desktop_window_profile ) & & ( need_desk_set ) )
{
if ( ! ( bd - > client . e . state . profile . name ) & &
( bd - > client . e . state . profile . num > = 1 ) )
{
const char * p = NULL ;
int i ;
for ( i = 0 ; i < bd - > client . e . state . profile . num ; i + + )
{
if ( ! bd - > client . e . state . profile . available_list [ i ] )
continue ;
p = bd - > client . e . state . profile . available_list [ i ] ;
if ( strcmp ( bd - > desk - > window_profile , p ) = = 0 )
{
bd - > client . e . state . profile . name = eina_stringshare_add ( bd - > desk - > window_profile ) ;
break ;
}
}
if ( ! bd - > client . e . state . profile . name )
{
E_Container * con = bd - > zone - > container ;
E_Desk * desk = NULL ;
for ( i = 0 ; i < bd - > client . e . state . profile . num ; i + + )
{
if ( ! bd - > client . e . state . profile . available_list [ i ] )
continue ;
p = bd - > client . e . state . profile . available_list [ i ] ;
desk = e_container_desk_window_profile_get ( con , p ) ;
if ( ( desk ) & & ( bd - > desk ! = desk ) )
{
bd - > client . e . state . profile . name = eina_stringshare_add ( p ) ;
break ;
}
}
}
}
if ( ! bd - > client . e . state . profile . name )
{
bd - > client . e . state . profile . name = eina_stringshare_add ( bd - > desk - > window_profile ) ;
}
ecore_x_e_window_profile_change_request_send ( bd - > client . win ,
bd - > client . e . state . profile . name ) ;
bd - > client . e . state . profile . wait_for_done = 1 ;
}
if ( bd - > new_client )
{
E_Event_Border_Add * ev ;