Improve init so it fails if the drivers dont really support RandRR.

SVN revision: 68238
This commit is contained in:
Leif Middelschulte 2012-02-21 23:53:00 +00:00
parent b8f3d41c08
commit 466b3c91c6
7 changed files with 25 additions and 17 deletions

View File

@ -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

View File

@ -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);

View File

@ -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()));
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);