More cleanup of the randr code ... don't include headers that are
already included via e.h. Do not need to do eina/ecore init or shutdown...handled by E already. SVN revision: 51205
This commit is contained in:
parent
ccfe4ba8d8
commit
db5ec3e8c1
|
@ -38,77 +38,76 @@
|
|||
#define E_RANDR_NO_CRTC_OUTPUT(crtc, output) (!e_randr_screen_info || (e_randr_screen_info->randr_version < ECORE_X_RANDR_1_2) || !e_randr_screen_info->rrvd_info.randr_info_12 || !e_randr_screen_info->rrvd_info.randr_info_12->crtcs || !crtc || !e_randr_screen_info->rrvd_info.randr_info_12->outputs || !output)
|
||||
#define E_RANDR_NO_CRTC_OUTPUT_MODE(crtc, output, mode) (!e_randr_screen_info || (e_randr_screen_info->randr_version < ECORE_X_RANDR_1_2) || !e_randr_screen_info->rrvd_info.randr_info_12 || !e_randr_screen_info->rrvd_info.randr_info_12->crtcs || !crtc || !e_randr_screen_info->rrvd_info.randr_info_12->outputs || !output || !e_randr_screen_info->rrvd_info.randr_info_12->modes || !mode)
|
||||
|
||||
static Eina_Bool _e_randr_init(void);
|
||||
static void _e_randr_shutdown(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);
|
||||
static E_Randr_Screen_Info *_e_randr_screen_info_new(void);
|
||||
static void _e_randr_screen_info_free(E_Randr_Screen_Info *screen_info);
|
||||
static E_Randr_Screen_Info_11 *_e_randr_screen_info_11_new(void);
|
||||
static Eina_Bool _e_randr_screen_info_11_set(void);
|
||||
static void _e_randr_screen_info_11_free(E_Randr_Screen_Info_11 *screen_info_11);
|
||||
static E_Randr_Screen_Info_12 *_e_randr_screen_info_12_new(void);
|
||||
static Eina_Bool _e_randr_screen_info_12_set(E_Randr_Screen_Info_12 *screen_info_12);
|
||||
static void _e_randr_screen_info_12_free(E_Randr_Screen_Info_12 *screen_info_12);
|
||||
static E_Randr_Output_Info *_e_randr_output_info_new(int nrequested);
|
||||
static void _e_randr_output_info_free(E_Randr_Output_Info *output_info);
|
||||
static E_Randr_Crtc_Info *_e_randr_crtc_info_new(int nrequested);
|
||||
static void _e_randr_crtc_info_free(E_Randr_Crtc_Info *crtc_info);
|
||||
static Eina_Bool _e_randr_screen_outputs_init(void);
|
||||
static Eina_Bool _e_randr_screen_crtcs_init(void);
|
||||
static Eina_Bool _e_randr_output_modes_add(E_Randr_Output_Info *output_info);
|
||||
static void _e_randr_notify_crtc_mode_change(E_Randr_Crtc_Info *crtc_info);
|
||||
static void _e_randr_notify_output_change(E_Randr_Output_Info *output_info);
|
||||
static Ecore_X_Randr_Mode_Info *_e_randr_mode_info_get(Ecore_X_Randr_Mode mode);
|
||||
static E_Randr_Crtc_Info *_e_randr_crtc_info_get(Ecore_X_Randr_Crtc crtc);
|
||||
static E_Randr_Output_Info *_e_randr_output_info_get(Ecore_X_Randr_Output output);
|
||||
static void _e_randr_output_info_set(E_Randr_Output_Info *output_info);
|
||||
static Eina_Bool _e_randr_outputs_connected(Eina_List *outputs_info);
|
||||
static void _e_randr_crtc_info_set(E_Randr_Crtc_Info *crtc_info);
|
||||
static const E_Randr_Crtc_Info *_e_randr_policy_crtc_get(E_Randr_Crtc_Info* but, E_Randr_Crtc_Info *hint, Ecore_X_Randr_Output_Policy policy);
|
||||
static Eina_Bool _e_randr_outputs_connected(Eina_List *outputs_info);
|
||||
static Ecore_X_Randr_Output *_e_randr_outputs_to_array(Eina_List *outputs_info);
|
||||
static int _e_randr_config_find_suiting_config_11(E_Randr_Screen_Restore_Info_11** restore_info);
|
||||
static E_Randr_Screen_Restore_Info_12 * _e_randr_config_find_suiting_config_12(void);
|
||||
static Eina_Bool _e_randr_config_enable_11(int size_index, Ecore_X_Randr_Refresh_Rate refresh_rate, Ecore_X_Randr_Orientation orientation);
|
||||
static Eina_Bool _e_randr_config_enable_12(const E_Randr_Screen_Restore_Info_12 *restore_info);
|
||||
static Eina_Bool _e_randr_try_enable_output(E_Randr_Output_Info *output_info, Eina_Bool force);
|
||||
static void _e_randr_crtcs_possible_output_update(E_Randr_Output_Info *output_info);
|
||||
static void _e_randr_crtc_outputs_refs_update(E_Randr_Crtc_Info *crtc_info);
|
||||
static Eina_Bool _e_randr_crtc_move_policy(E_Randr_Crtc_Info *new_crtc);
|
||||
static int _crtcs_size_sort_cb(const void *d1, const void *d2);
|
||||
static int _outputs_size_sort_cb(const void *d1, const void *d2);
|
||||
static int _modes_size_sort_cb(const void *d1, const void *d2);
|
||||
static Eina_List *_e_randr_outputs_common_modes_get(Eina_List *outputs, Ecore_X_Randr_Mode_Info *max_size_mode);
|
||||
static Ecore_X_Randr_Mode_Info *_e_randr_outputs_common_mode_max_get(Eina_List *outputs, Ecore_X_Randr_Mode_Info *max_size_mode);
|
||||
static Ecore_X_Randr_Mode_Info *_e_randr_mode_geo_identical_find(Eina_List *modes, Ecore_X_Randr_Mode_Info *mode);
|
||||
static Eina_Bool _e_randr_crtc_mode_intersects_crtcs(E_Randr_Crtc_Info *crtc_info, Ecore_X_Randr_Mode_Info *mode);
|
||||
static Eina_Bool _e_randr_crtc_outputs_mode_max_set(E_Randr_Crtc_Info *crtc_info);
|
||||
static Eina_Bool _e_randr_crtcs_clone_crtc_removed(E_Randr_Crtc_Info *former_clone);
|
||||
static void _e_randr_screen_primary_output_assign(E_Randr_Output_Info *removed);
|
||||
static void _e_randr_output_info_hw_info_set(E_Randr_Output_Info *output_info);
|
||||
static void _e_randr_output_hw_info_free(E_Randr_Output_Info *output_info);
|
||||
static Eina_Bool _e_randr_outputs_are_clones(E_Randr_Output_Info *output_info, Eina_List *outputs);
|
||||
|
||||
static Eina_Bool _e_randr_init (void);
|
||||
static void _e_randr_shutdown (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);
|
||||
static E_Randr_Screen_Info * _e_randr_screen_info_new (void);
|
||||
static void _e_randr_screen_info_free (E_Randr_Screen_Info *screen_info);
|
||||
static E_Randr_Screen_Info_11 * _e_randr_screen_info_11_new (void);
|
||||
static Eina_Bool _e_randr_screen_info_11_set (void);
|
||||
static void _e_randr_screen_info_11_free (E_Randr_Screen_Info_11 *screen_info_11);
|
||||
static E_Randr_Screen_Info_12 * _e_randr_screen_info_12_new (void);
|
||||
static Eina_Bool _e_randr_screen_info_12_set (E_Randr_Screen_Info_12 *screen_info_12);
|
||||
static void _e_randr_screen_info_12_free (E_Randr_Screen_Info_12 *screen_info_12);
|
||||
static E_Randr_Output_Info * _e_randr_output_info_new (int nrequested);
|
||||
static void _e_randr_output_info_free (E_Randr_Output_Info *output_info);
|
||||
static E_Randr_Crtc_Info * _e_randr_crtc_info_new (int nrequested);
|
||||
static void _e_randr_crtc_info_free (E_Randr_Crtc_Info *crtc_info);
|
||||
static Eina_Bool _e_randr_screen_outputs_init (void);
|
||||
static Eina_Bool _e_randr_screen_crtcs_init (void);
|
||||
static Eina_Bool _e_randr_output_modes_add (E_Randr_Output_Info *output_info);
|
||||
static void _e_randr_notify_crtc_mode_change (E_Randr_Crtc_Info *crtc_info);
|
||||
static void _e_randr_notify_output_change (E_Randr_Output_Info *output_info);
|
||||
static Ecore_X_Randr_Mode_Info * _e_randr_mode_info_get (Ecore_X_Randr_Mode mode);
|
||||
static E_Randr_Crtc_Info * _e_randr_crtc_info_get (Ecore_X_Randr_Crtc crtc);
|
||||
static E_Randr_Output_Info * _e_randr_output_info_get (Ecore_X_Randr_Output output);
|
||||
static void _e_randr_output_info_set (E_Randr_Output_Info *output_info);
|
||||
static Eina_Bool _e_randr_outputs_connected (Eina_List *outputs_info);
|
||||
static void _e_randr_crtc_info_set (E_Randr_Crtc_Info *crtc_info);
|
||||
static const E_Randr_Crtc_Info * _e_randr_policy_crtc_get (E_Randr_Crtc_Info* but, E_Randr_Crtc_Info *hint, Ecore_X_Randr_Output_Policy policy);
|
||||
static Eina_Bool _e_randr_outputs_connected (Eina_List *outputs_info);
|
||||
static Ecore_X_Randr_Output * _e_randr_outputs_to_array (Eina_List *outputs_info);
|
||||
static int _e_randr_config_find_suiting_config_11 (E_Randr_Screen_Restore_Info_11** restore_info);
|
||||
static E_Randr_Screen_Restore_Info_12 * _e_randr_config_find_suiting_config_12 (void);
|
||||
static Eina_Bool _e_randr_config_enable_11 (int size_index, Ecore_X_Randr_Refresh_Rate refresh_rate, Ecore_X_Randr_Orientation orientation);
|
||||
static Eina_Bool _e_randr_config_enable_12 (const E_Randr_Screen_Restore_Info_12 *restore_info);
|
||||
static Eina_Bool _e_randr_try_enable_output (E_Randr_Output_Info *output_info, Eina_Bool force);
|
||||
static void _e_randr_crtcs_possible_output_update (E_Randr_Output_Info *output_info);
|
||||
static void _e_randr_crtc_outputs_refs_update (E_Randr_Crtc_Info *crtc_info);
|
||||
static Eina_Bool _e_randr_crtc_move_policy (E_Randr_Crtc_Info *new_crtc);
|
||||
static int _crtcs_size_sort_cb (const void *d1, const void *d2);
|
||||
static int _outputs_size_sort_cb (const void *d1, const void *d2);
|
||||
static int _modes_size_sort_cb (const void *d1, const void *d2);
|
||||
static Eina_List * _e_randr_outputs_common_modes_get (Eina_List *outputs, Ecore_X_Randr_Mode_Info *max_size_mode);
|
||||
static Ecore_X_Randr_Mode_Info * _e_randr_outputs_common_mode_max_get (Eina_List *outputs, Ecore_X_Randr_Mode_Info *max_size_mode);
|
||||
static Ecore_X_Randr_Mode_Info * _e_randr_mode_geo_identical_find (Eina_List *modes, Ecore_X_Randr_Mode_Info *mode);
|
||||
static Eina_Bool _e_randr_crtc_mode_intersects_crtcs (E_Randr_Crtc_Info *crtc_info, Ecore_X_Randr_Mode_Info *mode);
|
||||
static Eina_Bool _e_randr_crtc_outputs_mode_max_set (E_Randr_Crtc_Info *crtc_info);
|
||||
static Eina_Bool _e_randr_crtcs_clone_crtc_removed (E_Randr_Crtc_Info *former_clone);
|
||||
static void _e_randr_screen_primary_output_assign (E_Randr_Output_Info *removed);
|
||||
static void _e_randr_output_info_hw_info_set (E_Randr_Output_Info *output_info);
|
||||
static void _e_randr_output_hw_info_free (E_Randr_Output_Info *output_info);
|
||||
static Eina_Bool _e_randr_outputs_are_clones (E_Randr_Output_Info *output_info, Eina_List *outputs);
|
||||
E_Randr_Screen_Info *e_randr_screen_info = NULL;
|
||||
static Eina_List *_e_randr_event_handlers = NULL;
|
||||
|
||||
E_Randr_Screen_Info * e_randr_screen_info = NULL;
|
||||
static Eina_List * _e_randr_event_handlers = NULL;
|
||||
|
||||
EAPI Eina_Bool
|
||||
EAPI Eina_Bool
|
||||
e_randr_init(void)
|
||||
{
|
||||
return _e_randr_init();
|
||||
}
|
||||
|
||||
EAPI int
|
||||
EAPI int
|
||||
e_randr_shutdown(void)
|
||||
{
|
||||
_e_randr_shutdown();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
static Eina_Bool
|
||||
_e_randr_init(void)
|
||||
{
|
||||
int n;
|
||||
|
@ -120,26 +119,29 @@ _e_randr_init(void)
|
|||
root = roots[0];
|
||||
free(roots);
|
||||
|
||||
if (!eina_init()) return EINA_FALSE;
|
||||
if (!ecore_init()) goto ecore_x_randr_init_fail_eina_shutdown;
|
||||
if (!ecore_x_randr_query() || !(e_randr_screen_info = _e_randr_screen_info_new()))
|
||||
goto ecore_x_randr_init_fail_free_screen;
|
||||
|
||||
if (!ecore_x_randr_query() || !(e_randr_screen_info = _e_randr_screen_info_new())) goto ecore_x_randr_init_fail_ecore_shutdown;
|
||||
|
||||
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_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_ecore_shutdown;
|
||||
if (!(e_randr_screen_info->rrvd_info.randr_info_11 = _e_randr_screen_info_11_new()))
|
||||
goto ecore_x_randr_init_fail_free_screen;
|
||||
_e_randr_screen_info_11_set();
|
||||
//_e_randr_config_find_and_enable();
|
||||
return EINA_TRUE;
|
||||
}
|
||||
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_ecore_shutdown;
|
||||
if (!(e_randr_screen_info->rrvd_info.randr_info_12 = _e_randr_screen_info_12_new()))
|
||||
goto ecore_x_randr_init_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())
|
||||
goto ecore_x_randr_init_fail_free_screen;
|
||||
if (!_e_randr_screen_crtcs_init())
|
||||
goto ecore_x_randr_init_fail_free_screen;
|
||||
_e_randr_screen_primary_output_assign(NULL);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -147,21 +149,16 @@ _e_randr_init(void)
|
|||
//FILO free stack in case we fail to allocate something/can't get hold of
|
||||
//necessary information
|
||||
ecore_x_randr_init_fail_free_screen:
|
||||
if (e_randr_screen_info)
|
||||
_e_randr_screen_info_free(e_randr_screen_info);
|
||||
ecore_x_randr_init_fail_ecore_shutdown:
|
||||
ecore_shutdown();
|
||||
ecore_x_randr_init_fail_eina_shutdown:
|
||||
eina_shutdown();
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
_e_randr_shutdown(void)
|
||||
{
|
||||
_e_randr_screen_info_free(e_randr_screen_info);
|
||||
ecore_shutdown();
|
||||
eina_shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -169,11 +166,12 @@ _e_randr_shutdown(void)
|
|||
* @return Instance of E_Randr_Screen_Info or if memory couldn't be
|
||||
* allocated NULL.
|
||||
*/
|
||||
static E_Randr_Screen_Info *
|
||||
static E_Randr_Screen_Info *
|
||||
_e_randr_screen_info_new(void)
|
||||
{
|
||||
E_Randr_Screen_Info *ret = NULL;
|
||||
E_Randr_Screen_Info default_info = {
|
||||
E_Randr_Screen_Info default_info =
|
||||
{
|
||||
.root = Ecore_X_Randr_Unset,
|
||||
.randr_version = Ecore_X_Randr_None,
|
||||
.rrvd_info.randr_info_11 = NULL
|
||||
|
@ -192,7 +190,7 @@ _e_randr_screen_info_new(void)
|
|||
static void
|
||||
_e_randr_screen_info_free(E_Randr_Screen_Info *screen_info)
|
||||
{
|
||||
if (!screen_info || !(screen_info->rrvd_info.randr_info_11)) return;
|
||||
if ((!screen_info) || !(screen_info->rrvd_info.randr_info_11)) return;
|
||||
switch (e_randr_screen_info->randr_version)
|
||||
{
|
||||
case ECORE_X_RANDR_1_1:
|
||||
|
@ -211,11 +209,12 @@ _e_randr_screen_info_free(E_Randr_Screen_Info *screen_info)
|
|||
* @return array of E_Randr_Screen_Info_11 elements, or in case not all could
|
||||
* be created or parameter 'nrequested'==0, NULL
|
||||
*/
|
||||
static E_Randr_Screen_Info_11 *
|
||||
static E_Randr_Screen_Info_11 *
|
||||
_e_randr_screen_info_11_new(void)
|
||||
{
|
||||
E_Randr_Screen_Info_11 *ret = NULL;
|
||||
static const E_Randr_Screen_Info_11 default_info = {
|
||||
static const E_Randr_Screen_Info_11 default_info =
|
||||
{
|
||||
.sizes = NULL,
|
||||
.csize_index = Ecore_X_Randr_Unset,
|
||||
.corientation = Ecore_X_Randr_Unset,
|
||||
|
@ -234,10 +233,11 @@ _e_randr_screen_info_11_new(void)
|
|||
/**
|
||||
* @param screen_info the screen info to be freed.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
_e_randr_screen_info_11_free(E_Randr_Screen_Info_11 *screen_info)
|
||||
{
|
||||
if (!screen_info || (e_randr_screen_info->randr_version < ECORE_X_RANDR_1_1)) return;
|
||||
if (!screen_info || (e_randr_screen_info->randr_version < ECORE_X_RANDR_1_1))
|
||||
return;
|
||||
|
||||
if (screen_info->sizes)
|
||||
{
|
||||
|
@ -257,11 +257,12 @@ _e_randr_screen_info_11_free(E_Randr_Screen_Info_11 *screen_info)
|
|||
* @return array of E_Randr_Screen_Info_12 elements, or in case not all could
|
||||
* be created or parameter 'nrequested'==0, NULL
|
||||
*/
|
||||
static E_Randr_Screen_Info_12 *
|
||||
static E_Randr_Screen_Info_12 *
|
||||
_e_randr_screen_info_12_new(void)
|
||||
{
|
||||
E_Randr_Screen_Info_12 *ret = NULL;
|
||||
static const E_Randr_Screen_Info_12 default_info = {
|
||||
static const E_Randr_Screen_Info_12 default_info =
|
||||
{
|
||||
.min_size = {Ecore_X_Randr_Unset, Ecore_X_Randr_Unset},
|
||||
.max_size = {Ecore_X_Randr_Unset, Ecore_X_Randr_Unset},
|
||||
.current_size = {Ecore_X_Randr_Unset, Ecore_X_Randr_Unset},
|
||||
|
@ -278,18 +279,25 @@ _e_randr_screen_info_12_new(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
static Eina_Bool
|
||||
_e_randr_screen_info_12_set(E_Randr_Screen_Info_12 *screen_info)
|
||||
{
|
||||
E_RANDR_NO_12_RET(EINA_FALSE);
|
||||
|
||||
ecore_x_randr_screen_size_range_get(e_randr_screen_info->root, &screen_info->min_size.width, &screen_info->min_size.height, &screen_info->max_size.width , &screen_info->max_size.height);
|
||||
ecore_x_randr_screen_current_size_get(e_randr_screen_info->root, &screen_info->current_size.width , &screen_info->current_size.height , NULL, NULL);
|
||||
ecore_x_randr_screen_size_range_get(e_randr_screen_info->root,
|
||||
&screen_info->min_size.width,
|
||||
&screen_info->min_size.height,
|
||||
&screen_info->max_size.width ,
|
||||
&screen_info->max_size.height);
|
||||
ecore_x_randr_screen_current_size_get(e_randr_screen_info->root,
|
||||
&screen_info->current_size.width ,
|
||||
&screen_info->current_size.height ,
|
||||
NULL, NULL);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
static Eina_Bool
|
||||
_e_randr_screen_info_11_set(void)
|
||||
{
|
||||
E_RANDR_NO_11_RET(EINA_FALSE);
|
||||
|
@ -300,7 +308,8 @@ _e_randr_screen_info_11_set(void)
|
|||
Eina_List *rates_list;
|
||||
int i, nsizes, nrates;
|
||||
|
||||
if (!(sizes = ecore_x_randr_screen_primary_output_sizes_get(e_randr_screen_info->root, &nsizes))) return EINA_FALSE;
|
||||
if (!(sizes = ecore_x_randr_screen_primary_output_sizes_get(e_randr_screen_info->root, &nsizes)))
|
||||
return EINA_FALSE;
|
||||
for (i = 0; i < nsizes; i++)
|
||||
if (!(screen_info_11->sizes = eina_list_append(screen_info_11->sizes, &sizes[i]))) goto _e_randr_screen_info_11_fill_fail_sizes;
|
||||
ecore_x_randr_screen_primary_output_current_size_get(e_randr_screen_info->root, NULL, NULL, NULL, NULL, &(screen_info_11->csize_index));
|
||||
|
@ -331,7 +340,7 @@ _e_randr_screen_info_11_fill_fail_sizes:
|
|||
/**
|
||||
* @param screen_info the screen info to be freed.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
_e_randr_screen_info_12_free(E_Randr_Screen_Info_12 *screen_info)
|
||||
{
|
||||
Ecore_X_Randr_Mode_Info *mode_info;
|
||||
|
@ -373,11 +382,12 @@ _e_randr_screen_info_12_free(E_Randr_Screen_Info_12 *screen_info)
|
|||
* @return array of E_Randr_Crtc_Info elements, or in case not all could
|
||||
* be created or parameter 'nrequested'==0, NULL
|
||||
*/
|
||||
static E_Randr_Crtc_Info *
|
||||
static E_Randr_Crtc_Info *
|
||||
_e_randr_crtc_info_new(int nrequested)
|
||||
{
|
||||
E_Randr_Crtc_Info *ret = NULL;
|
||||
static E_Randr_Crtc_Info default_info = {
|
||||
static E_Randr_Crtc_Info default_info =
|
||||
{
|
||||
.xid = Ecore_X_Randr_Unset,
|
||||
.geometry = {Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, Ecore_X_Randr_Unset},
|
||||
.panning = {Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, Ecore_X_Randr_Unset},
|
||||
|
@ -404,7 +414,7 @@ _e_randr_crtc_info_new(int nrequested)
|
|||
/**
|
||||
* @param crtc_info the crtc info to be freed.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
_e_randr_crtc_info_free(E_Randr_Crtc_Info *crtc_info)
|
||||
{
|
||||
if (!crtc_info) return;
|
||||
|
@ -425,7 +435,8 @@ static E_Randr_Output_Info *
|
|||
_e_randr_output_info_new(int nrequested)
|
||||
{
|
||||
E_Randr_Output_Info *ret = NULL;
|
||||
static E_Randr_Output_Info default_info = {
|
||||
static E_Randr_Output_Info default_info =
|
||||
{
|
||||
.xid = Ecore_X_Randr_Unset,
|
||||
.name = NULL,
|
||||
.crtc = NULL,
|
||||
|
@ -460,13 +471,13 @@ _e_randr_output_info_new(int nrequested)
|
|||
* removes all traces of an output within the data.
|
||||
* @param output_info the output info to be freed.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
_e_randr_output_info_free(E_Randr_Output_Info *output_info)
|
||||
{
|
||||
Eina_List *iter;
|
||||
E_Randr_Crtc_Info *crtc_info;
|
||||
if (!output_info) return;
|
||||
|
||||
if (!output_info) return;
|
||||
if (output_info->name)
|
||||
{
|
||||
free(output_info->name);
|
||||
|
@ -480,7 +491,7 @@ _e_randr_output_info_free(E_Randr_Output_Info *output_info)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
_e_randr_output_info_set(E_Randr_Output_Info *output_info)
|
||||
{
|
||||
if (E_RANDR_NO_12 || !output_info) return;
|
||||
|
@ -498,7 +509,7 @@ _e_randr_output_info_set(E_Randr_Output_Info *output_info)
|
|||
* - connection status
|
||||
* - orientation
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
_e_randr_crtc_info_set(E_Randr_Crtc_Info *crtc_info)
|
||||
{
|
||||
Ecore_X_Randr_Mode mode = 0;
|
||||
|
@ -562,8 +573,8 @@ _e_randr_screen_crtcs_init(void)
|
|||
{
|
||||
Ecore_X_Randr_Crtc *crtcs = NULL;
|
||||
E_Randr_Crtc_Info *crtcs_info = NULL, *crtc = NULL;
|
||||
|
||||
int i, ncrtcs;
|
||||
|
||||
if (E_RANDR_NO_12 || !(crtcs = ecore_x_randr_crtcs_get(e_randr_screen_info->root, &ncrtcs))) return EINA_FALSE;
|
||||
|
||||
if (!(crtcs_info = _e_randr_crtc_info_new(ncrtcs))) goto ecore_x_randr_screen_crtcs_init_fail_free_crtcs;
|
||||
|
@ -668,7 +679,7 @@ _e_randr_crtc_info_get(Ecore_X_Randr_Crtc crtc)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
static Eina_Bool
|
||||
_e_randr_event_cb(void *data, int type, void *ev)
|
||||
{
|
||||
E_Randr_Crtc_Info *crtc_info;
|
||||
|
@ -767,7 +778,6 @@ _e_randr_event_cb(void *data, int type, void *ev)
|
|||
output_info->connection_status = event->connection;
|
||||
output_info->subpixel_order = event->subpixel_order;
|
||||
|
||||
|
||||
if(event->connection == ECORE_X_RANDR_CONNECTION_STATUS_CONNECTED)
|
||||
{
|
||||
if (event->crtc)
|
||||
|
@ -861,37 +871,37 @@ _e_randr_event_listeners_remove(void)
|
|||
static void
|
||||
_e_randr_notify_crtc_mode_change(E_Randr_Crtc_Info *crtc_info)
|
||||
{
|
||||
// E_Notification *n;
|
||||
// char buff[200];
|
||||
|
||||
// E_Notification *n;
|
||||
// char buff[200];
|
||||
//
|
||||
if (crtc_info->current_mode)
|
||||
{
|
||||
// snprintf(buff, 200, "New resolution is %dx%d. Click here for further information.", crtc_info->current_mode->width, crtc_info->current_mode->height);
|
||||
// n = e_notification_full_new("RandRR", crtc_info->xid, NULL, "Resolution changed", buff, -1);
|
||||
// //n = e_notification_full_new("RandRR", id, icon, function, body, timeout);
|
||||
// e_notification_send(n, NULL, NULL);
|
||||
// e_notification_unref(n);
|
||||
// snprintf(buff, 200, "New resolution is %dx%d. Click here for further information.", crtc_info->current_mode->width, crtc_info->current_mode->height);
|
||||
// n = e_notification_full_new("RandRR", crtc_info->xid, NULL, "Resolution changed", buff, -1);
|
||||
// //n = e_notification_full_new("RandRR", id, icon, function, body, timeout);
|
||||
// e_notification_send(n, NULL, NULL);
|
||||
// e_notification_unref(n);
|
||||
}
|
||||
}
|
||||
static void
|
||||
_e_randr_notify_output_change(E_Randr_Output_Info *output_info)
|
||||
{
|
||||
// E_Notification *n;
|
||||
// char buff[100];
|
||||
// E_Notification *n;
|
||||
// char buff[100];
|
||||
if (output_info->connection_status == ECORE_X_RANDR_CONNECTION_STATUS_CONNECTED)
|
||||
{
|
||||
// snprintf(buff, 100, "Output %s connected", output_info->name);
|
||||
// n = e_notification_full_new("RandRR", output_info->xid, NULL, buff, "Click here for further information.", -1);
|
||||
// snprintf(buff, 100, "Output %s connected", output_info->name);
|
||||
// n = e_notification_full_new("RandRR", output_info->xid, NULL, buff, "Click here for further information.", -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// snprintf(buff, 100, "Output %s disconnected", output_info->name);
|
||||
// n = e_notification_full_new("RandRR", output_info->xid, NULL, buff, "Click here to adjust screen setup.", -1);
|
||||
// snprintf(buff, 100, "Output %s disconnected", output_info->name);
|
||||
// n = e_notification_full_new("RandRR", output_info->xid, NULL, buff, "Click here to adjust screen setup.", -1);
|
||||
}
|
||||
|
||||
// //n = e_notification_full_new("RandRR", id, icon, function, body, timeout);
|
||||
// e_notification_send(n, NULL, NULL);
|
||||
// e_notification_unref(n);
|
||||
// //n = e_notification_full_new("RandRR", id, icon, function, body, timeout);
|
||||
// e_notification_send(n, NULL, NULL);
|
||||
// e_notification_unref(n);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -981,7 +991,7 @@ _e_randr_outputs_connected(Eina_List *outputs_info)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
static Eina_Bool
|
||||
_e_randr_config_enable_11(int size_index, Ecore_X_Randr_Refresh_Rate refresh_rate, Ecore_X_Randr_Orientation orientation)
|
||||
{
|
||||
E_Randr_Screen_Info_11 *current_info_11;
|
||||
|
@ -1002,7 +1012,7 @@ _e_randr_config_enable_11(int size_index, Ecore_X_Randr_Refresh_Rate refresh_rat
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
static Eina_Bool
|
||||
_e_randr_config_enable_12(const E_Randr_Screen_Restore_Info_12* restore_info)
|
||||
{
|
||||
/*
|
||||
|
@ -1107,7 +1117,6 @@ _e_randr_config_find_suiting_config_12(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static Ecore_X_Randr_Output *
|
||||
_e_randr_outputs_to_array(Eina_List *outputs_info)
|
||||
{
|
||||
|
@ -1129,7 +1138,7 @@ _e_randr_outputs_to_array(Eina_List *outputs_info)
|
|||
* - try to share the output of a CRTC with other outputs already using it
|
||||
* (clone).
|
||||
*/
|
||||
static Eina_Bool
|
||||
static Eina_Bool
|
||||
_e_randr_try_enable_output(E_Randr_Output_Info *output_info, Eina_Bool force)
|
||||
{
|
||||
if (!output_info) return EINA_FALSE;
|
||||
|
@ -1274,7 +1283,7 @@ _e_randr_try_enable_output(E_Randr_Output_Info *output_info, Eina_Bool force)
|
|||
/*
|
||||
* updates all crtcs information regarding a new output
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
_e_randr_crtcs_possible_output_update(E_Randr_Output_Info *output_info)
|
||||
{
|
||||
Eina_List *iter;
|
||||
|
@ -1305,7 +1314,7 @@ _e_randr_crtcs_possible_output_update(E_Randr_Output_Info *output_info)
|
|||
/*
|
||||
* setup a crtc's current (possible) outputs references
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
_e_randr_crtc_outputs_refs_update(E_Randr_Crtc_Info *crtc_info)
|
||||
{
|
||||
Ecore_X_Randr_Output *outputs;
|
||||
|
@ -1341,7 +1350,7 @@ _e_randr_crtc_outputs_refs_update(E_Randr_Crtc_Info *crtc_info)
|
|||
* which means that e.g. when a crtc should be placed at a position < 0, all
|
||||
* other crtcs are accordingly moved instead, so the result is the same.
|
||||
*/
|
||||
static Eina_Bool
|
||||
static Eina_Bool
|
||||
_e_randr_crtc_move_policy(E_Randr_Crtc_Info *new_crtc)
|
||||
{
|
||||
const E_Randr_Crtc_Info *crtc_rel;
|
||||
|
@ -1392,7 +1401,7 @@ _e_randr_crtc_move_policy(E_Randr_Crtc_Info *new_crtc)
|
|||
* returns the highest resolution mode common ammongst the given outputs,
|
||||
* optionally limited by max_size_mode. If none is found, NULL is returned.
|
||||
*/
|
||||
static Ecore_X_Randr_Mode_Info *
|
||||
static Ecore_X_Randr_Mode_Info *
|
||||
_e_randr_outputs_common_mode_max_get(Eina_List *outputs, Ecore_X_Randr_Mode_Info *max_size_mode)
|
||||
{
|
||||
Eina_List *all_modes = NULL, *iter, *output_iter, *right;
|
||||
|
@ -1438,7 +1447,7 @@ _e_randr_outputs_common_mode_max_get(Eina_List *outputs, Ecore_X_Randr_Mode_Info
|
|||
return mode_info;
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
_crtcs_size_sort_cb(const void *d1, const void *d2)
|
||||
{
|
||||
E_Randr_Crtc_Info *crtc1 = ((E_Randr_Crtc_Info*)d1), *crtc2 = ((E_Randr_Crtc_Info*)d2);
|
||||
|
@ -1446,7 +1455,7 @@ _crtcs_size_sort_cb(const void *d1, const void *d2)
|
|||
return ((crtc1->geometry.w * crtc1->geometry.h) - (crtc2->geometry.w * crtc2->geometry.h));
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
_outputs_size_sort_cb(const void *d1, const void *d2)
|
||||
{
|
||||
E_Randr_Output_Info *output1 = ((E_Randr_Output_Info*)d1), *output2 = ((E_Randr_Output_Info*)d2);
|
||||
|
@ -1454,7 +1463,7 @@ _outputs_size_sort_cb(const void *d1, const void *d2)
|
|||
return (output1 && output1->crtc && output1->crtc->current_mode && output2 && output2->crtc && output2->crtc->current_mode) ? ((output1->crtc->current_mode->width * output1->crtc->current_mode->height) - (output2->crtc->current_mode->width * output2->crtc->current_mode->height)) : 0;
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
_modes_size_sort_cb(const void *d1, const void *d2)
|
||||
{
|
||||
Ecore_X_Randr_Mode_Info *mode1 = ((Ecore_X_Randr_Mode_Info*)d1), *mode2 = ((Ecore_X_Randr_Mode_Info*)d2);
|
||||
|
@ -1539,7 +1548,7 @@ _e_randr_crtc_mode_intersects_crtcs(E_Randr_Crtc_Info *crtc_info, Ecore_X_Randr_
|
|||
* returns a list of modes common ammongst the given outputs,
|
||||
* optionally limited by max_size_mode. If none are found, NULL is returned.
|
||||
*/
|
||||
static Eina_List *
|
||||
static Eina_List *
|
||||
_e_randr_outputs_common_modes_get(Eina_List *outputs, Ecore_X_Randr_Mode_Info *max_size_mode)
|
||||
{
|
||||
Eina_List *common_modes = NULL, *iter, *output_iter, *right;
|
||||
|
@ -1590,7 +1599,7 @@ _e_randr_outputs_common_modes_get(Eina_List *outputs, Ecore_X_Randr_Mode_Info *m
|
|||
/*
|
||||
* reconfigure all CRTCs that had a given CRTC as a clone
|
||||
*/
|
||||
static Eina_Bool
|
||||
static Eina_Bool
|
||||
_e_randr_crtcs_clone_crtc_removed(E_Randr_Crtc_Info *former_clone)
|
||||
{
|
||||
Eina_List *iter;
|
||||
|
@ -1611,7 +1620,7 @@ _e_randr_crtcs_clone_crtc_removed(E_Randr_Crtc_Info *former_clone)
|
|||
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
_e_randr_screen_primary_output_assign(E_Randr_Output_Info *removed)
|
||||
{
|
||||
Eina_List *iter;
|
||||
|
@ -1634,7 +1643,7 @@ _e_randr_screen_primary_output_assign(E_Randr_Output_Info *removed)
|
|||
e_randr_screen_info->rrvd_info.randr_info_12->primary_output = primary_output;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
_e_randr_output_info_hw_info_set(E_Randr_Output_Info *output_info)
|
||||
{
|
||||
Ecore_X_Randr_Output *outputs;
|
||||
|
@ -1677,7 +1686,7 @@ _e_randr_output_info_hw_info_set(E_Randr_Output_Info *output_info)
|
|||
* removes all traces of an output within the data.
|
||||
* @param output_info the output info to be freed.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
_e_randr_output_hw_info_free(E_Randr_Output_Info *output_info)
|
||||
{
|
||||
E_Randr_Crtc_Info *crtc_info;
|
||||
|
@ -1734,8 +1743,8 @@ _e_randr_outputs_are_clones(E_Randr_Output_Info *output_info, Eina_List *outputs
|
|||
{
|
||||
E_Randr_Output_Info *output;
|
||||
Eina_List *iter;
|
||||
if (!outputs || !output_info)
|
||||
return EINA_FALSE;
|
||||
|
||||
if (!outputs || !output_info) return EINA_FALSE;
|
||||
|
||||
EINA_LIST_FOREACH(output_info->clones, iter, output)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue