mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Return NULL when empty property.
This commit is contained in:
parent
fa7ceaf580
commit
881ca572df
2 changed files with 13 additions and 8 deletions
|
@ -89,12 +89,15 @@ char* window_get_text_prop ( xcb_window_t w, xcb_atom_t atom )
|
|||
xcb_get_property_cookie_t c = xcb_get_property ( xcb->connection, 0, w, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, UINT_MAX );
|
||||
xcb_get_property_reply_t *r = xcb_get_property_reply ( xcb->connection, c, NULL );
|
||||
if ( r ) {
|
||||
if ( xcb_get_property_value_length ( r ) > 0 ) {
|
||||
char *str = g_malloc ( xcb_get_property_value_length ( r ) + 1 );
|
||||
memcpy ( str, xcb_get_property_value ( r ), xcb_get_property_value_length ( r ) );
|
||||
str[xcb_get_property_value_length ( r )] = '\0';
|
||||
free ( r );
|
||||
return str;
|
||||
}
|
||||
free ( r );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -333,11 +333,13 @@ static void __config_parse_xresource_options_dynamic ( XrmDatabase xDB )
|
|||
void config_parse_xresource_options_dynamic ( xcb_stuff *xcb )
|
||||
{
|
||||
char *name = window_get_text_prop ( xcb_stuff_get_root_window ( xcb ), XCB_ATOM_RESOURCE_MANAGER );
|
||||
if ( name ) {
|
||||
XrmDatabase xDB = XrmGetStringDatabase ( name );
|
||||
__config_parse_xresource_options_dynamic ( xDB );
|
||||
XrmDestroyDatabase ( xDB );
|
||||
g_free ( name );
|
||||
}
|
||||
}
|
||||
void config_parse_xresource_options_dynamic_file ( const char *filename )
|
||||
{
|
||||
if ( !filename ) {
|
||||
|
|
Loading…
Reference in a new issue