forked from enlightenment/enlightenment
Introduce refetching of all RandRR info.
SVN revision: 66287
This commit is contained in:
parent
ecdd149227
commit
f5bf360e9a
|
@ -57,6 +57,7 @@
|
|||
|
||||
static Eina_Bool _e_randr_init(void);
|
||||
static void _e_randr_shutdown(void);
|
||||
static Eina_Bool _e_randr_screen_info_refresh(void);
|
||||
static void _e_randr_event_listeners_add(void);
|
||||
static void _e_randr_event_listeners_remove(void);
|
||||
static Eina_Bool _e_randr_event_cb(void *data, int type, void *e);
|
||||
|
@ -122,13 +123,36 @@ e_randr_shutdown(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
e_randr_screen_info_refresh(void)
|
||||
{
|
||||
return _e_randr_screen_info_refresh();
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_randr_init(void)
|
||||
{
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(e_randr_screen_info_refresh(), EINA_FALSE);
|
||||
_e_randr_event_listeners_add();
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_randr_shutdown(void)
|
||||
{
|
||||
_e_randr_screen_info_free(e_randr_screen_info);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_randr_screen_info_refresh(void)
|
||||
{
|
||||
int n;
|
||||
Ecore_X_Window *roots;
|
||||
Ecore_X_Window root;
|
||||
|
||||
if (e_randr_screen_info)
|
||||
_e_randr_screen_info_free(e_randr_screen_info);
|
||||
|
||||
if (!(roots = ecore_x_window_root_list(&n))) return EINA_FALSE;
|
||||
/* first (and only) root window */
|
||||
root = roots[0];
|
||||
|
@ -136,46 +160,36 @@ _e_randr_init(void)
|
|||
|
||||
if ((!ecore_x_randr_query()) ||
|
||||
!(e_randr_screen_info = _e_randr_screen_info_new()))
|
||||
goto ecore_x_randr_init_fail_free_screen;
|
||||
goto e_randr_screen_info_refresh_fail_free_screen;
|
||||
|
||||
if ((e_randr_screen_info->randr_version = ecore_x_randr_version_get()))
|
||||
e_randr_screen_info->root = root;
|
||||
if (e_randr_screen_info->randr_version == ECORE_X_RANDR_1_1)
|
||||
{
|
||||
if (!(e_randr_screen_info->rrvd_info.randr_info_11 = _e_randr_screen_info_11_new()))
|
||||
goto ecore_x_randr_init_fail_free_screen;
|
||||
goto e_randr_screen_info_refresh_fail_free_screen;
|
||||
_e_randr_screen_info_11_set();
|
||||
}
|
||||
else if (e_randr_screen_info->randr_version >= ECORE_X_RANDR_1_2)
|
||||
{
|
||||
if (!(e_randr_screen_info->rrvd_info.randr_info_12 = _e_randr_screen_info_12_new()))
|
||||
goto ecore_x_randr_init_fail_free_screen;
|
||||
goto e_randr_screen_info_refresh_fail_free_screen;
|
||||
_e_randr_screen_info_12_set(e_randr_screen_info->rrvd_info.randr_info_12);
|
||||
_e_randr_event_listeners_add();
|
||||
if (!_e_randr_screen_outputs_init())
|
||||
goto ecore_x_randr_init_fail_free_screen;
|
||||
if (!_e_randr_screen_crtcs_init())
|
||||
goto ecore_x_randr_init_fail_free_screen;
|
||||
if (!_e_randr_screen_outputs_init()
|
||||
|| !_e_randr_screen_crtcs_init())
|
||||
goto e_randr_screen_info_refresh_fail_free_screen;
|
||||
_e_randr_screen_primary_output_assign(NULL);
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
|
||||
//FILO free stack in case we fail to allocate something/can't get hold of
|
||||
//necessary information
|
||||
ecore_x_randr_init_fail_free_screen:
|
||||
e_randr_screen_info_refresh_fail_free_screen:
|
||||
if (e_randr_screen_info)
|
||||
_e_randr_screen_info_free(e_randr_screen_info);
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_randr_shutdown(void)
|
||||
{
|
||||
_e_randr_screen_info_free(e_randr_screen_info);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nrequeste
|
||||
* @return Instance of E_Randr_Screen_Info or if memory couldn't be
|
||||
|
|
|
@ -183,6 +183,7 @@ struct _E_Randr_Serialized_Setup
|
|||
};
|
||||
|
||||
EINTERN Eina_Bool e_randr_init(void);
|
||||
EAPI Eina_Bool e_randr_screen_info_refresh(void);
|
||||
EINTERN int e_randr_shutdown(void);
|
||||
|
||||
EAPI extern E_Randr_Screen_Info *e_randr_screen_info;
|
||||
|
|
Loading…
Reference in New Issue