diff --git a/src/bin/e_randr.c b/src/bin/e_randr.c index bdd46b4c1..21d215c1e 100644 --- a/src/bin/e_randr.c +++ b/src/bin/e_randr.c @@ -25,7 +25,7 @@ static Eina_Bool _init(void); static void _shutdown(void); -static void _screen_info_refresh(void); +static Eina_Bool _screen_info_refresh(void); static Eina_Bool _e_event_config_loaded_cb(void *data, int type, void *e); static void _try_restore_configuration(void); static void _event_listeners_add(void); @@ -47,16 +47,17 @@ e_randr_shutdown(void) return 1; } -EAPI void +EAPI Eina_Bool e_randr_screen_info_refresh(void) { - _screen_info_refresh(); + return _screen_info_refresh(); } static Eina_Bool _init(void) { - e_randr_screen_info_refresh(); + if (!e_randr_screen_info_refresh()) + return EINA_FALSE; _event_listeners_add(); _try_restore_configuration(); @@ -91,7 +92,7 @@ _shutdown(void) /** * @return EINA_TRUE if info could be refreshed, else EINA_FALSE */ -static void +static Eina_Bool _screen_info_refresh(void) { Ecore_X_Window *roots; @@ -112,12 +113,14 @@ _screen_info_refresh(void) // Value set/retrieval helper functions if (e_randr_screen_info.randr_version == ECORE_X_RANDR_1_1) { - _11_screen_info_refresh(); + return _11_screen_info_refresh(); } else if (e_randr_screen_info.randr_version >= ECORE_X_RANDR_1_2) { - _12_screen_info_refresh(); + return _12_screen_info_refresh(); } + + return EINA_FALSE; } static Eina_Bool diff --git a/src/bin/e_randr.h b/src/bin/e_randr.h index 1ba663c7f..d0158230e 100644 --- a/src/bin/e_randr.h +++ b/src/bin/e_randr.h @@ -181,7 +181,7 @@ struct _E_Randr_Serialized_Setup }; EINTERN Eina_Bool e_randr_init(void); -EAPI void e_randr_screen_info_refresh(void); +EAPI Eina_Bool e_randr_screen_info_refresh(void); EINTERN int e_randr_shutdown(void); EINTERN void e_randr_serialized_setup_free(E_Randr_Serialized_Setup *ss); EINTERN void e_randr_11_serialized_setup_free(E_Randr_Serialized_Setup_11 *ss_11); diff --git a/src/bin/e_randr_11.c b/src/bin/e_randr_11.c index 271db4622..0e9b4b8cd 100644 --- a/src/bin/e_randr_11.c +++ b/src/bin/e_randr_11.c @@ -93,11 +93,11 @@ _11_screen_info_free(E_Randr_Screen_Info_11 *screen_info) * ***************************************************************** */ -void +Eina_Bool _11_screen_info_refresh(void) { EINA_SAFETY_ON_TRUE_RETURN(E_RANDR_11_NO); _11_screen_info_free(e_randr_screen_info.rrvd_info.randr_info_11); - e_randr_screen_info.rrvd_info.randr_info_11 = _11_screen_info_new(); + return ((e_randr_screen_info.rrvd_info.randr_info_11 = _11_screen_info_new())); } diff --git a/src/bin/e_randr_12.c b/src/bin/e_randr_12.c index dfd63a8e6..75b33c403 100644 --- a/src/bin/e_randr_12.c +++ b/src/bin/e_randr_12.c @@ -300,15 +300,17 @@ _mode_geo_identical_find(Eina_List *modes, Ecore_X_Randr_Mode_Info *mode) * ***************************************************************** */ - void + Eina_Bool _12_screen_info_refresh(void) { EINA_SAFETY_ON_TRUE_RETURN(e_randr_screen_info.randr_version < ECORE_X_RANDR_1_2); if (e_randr_screen_info.rrvd_info.randr_info_12) _12_screen_info_free(e_randr_screen_info.rrvd_info.randr_info_12); - e_randr_screen_info.rrvd_info.randr_info_12 = _screen_info_12_new(); - _structs_init(); + if (!(e_randr_screen_info.rrvd_info.randr_info_12 = _screen_info_12_new()) || + !_structs_init()) + return EINA_FALSE; + _screen_primary_output_assign(NULL); } diff --git a/src/bin/e_randr_12_crtc.c b/src/bin/e_randr_12_crtc.c index 08d5a11b9..17de0079a 100644 --- a/src/bin/e_randr_12_crtc.c +++ b/src/bin/e_randr_12_crtc.c @@ -20,7 +20,10 @@ _crtc_outputs_refs_set(E_Randr_Crtc_Info *crtc_info) { output_info = _12_screen_info_output_info_get(outputs[noutputs]); if (!output_info) - fprintf(stderr, "E_RANDR: Could not find output struct for output %d.\n", outputs[noutputs]); + { + fprintf(stderr, "E_RANDR: Could not find output struct for output %d.\n", outputs[noutputs]); + continue; + } crtc_info->outputs = eina_list_append(crtc_info->outputs, output_info); } free(outputs); diff --git a/src/bin/e_randr_12_output.c b/src/bin/e_randr_12_output.c index 4494ce0ae..55a5938b5 100644 --- a/src/bin/e_randr_12_output.c +++ b/src/bin/e_randr_12_output.c @@ -200,7 +200,7 @@ Eina_List { EINA_LIST_FOREACH(outputs, output_iter, output_info) { - if (!output_info->monitor) + if (!output_info || !output_info->monitor) continue; if (!eina_list_data_find(output_info->monitor->modes, mode_info)) common_modes = eina_list_remove(common_modes, mode_info); diff --git a/src/bin/e_randr_private.h b/src/bin/e_randr_private.h index 43deb903c..894e431ca 100644 --- a/src/bin/e_randr_private.h +++ b/src/bin/e_randr_private.h @@ -25,14 +25,14 @@ // RandRR == 1.1 E_Randr_Screen_Info_11 *_11_screen_info_new(void); void _11_screen_info_free(E_Randr_Screen_Info_11 *screen_info_11); -void _11_screen_info_refresh(void); +Eina_Bool _11_screen_info_refresh(void); Eina_Bool _11_try_restore_configuration(void); void _11_store_configuration(E_Randr_Configuration_Store_Modifier modifier); // RandRR >= 1.2 E_Randr_Screen_Info_12 *_12_screen_info_new(void); void _12_screen_info_free(E_Randr_Screen_Info_12 *screen_info_12); -void _12_screen_info_refresh(void); +Eina_Bool _12_screen_info_refresh(void); void _12_policies_restore(void); void _12_event_listeners_add(void); void _12_event_listeners_remove(void);