summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/e_randr.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/src/bin/e_randr.c b/src/bin/e_randr.c
index a434f7130..b0f37f75f 100644
--- a/src/bin/e_randr.c
+++ b/src/bin/e_randr.c
@@ -44,37 +44,37 @@
44 44
45static Eina_Bool _e_randr_init (void); 45static Eina_Bool _e_randr_init (void);
46static void _e_randr_shutdown (void); 46static void _e_randr_shutdown (void);
47static inline void _e_randr_event_listeners_add (void); 47static void _e_randr_event_listeners_add (void);
48static inline void _e_randr_event_listeners_remove (void); 48static void _e_randr_event_listeners_remove (void);
49static Eina_Bool _e_randr_event_cb (void *data, int type, void *e); 49static Eina_Bool _e_randr_event_cb (void *data, int type, void *e);
50static E_Randr_Screen_Info * _e_randr_screen_info_new (void); 50static E_Randr_Screen_Info * _e_randr_screen_info_new (void);
51static void _e_randr_screen_info_free (E_Randr_Screen_Info *screen_info); 51static void _e_randr_screen_info_free (E_Randr_Screen_Info *screen_info);
52static E_Randr_Screen_Info_11 * _e_randr_screen_info_11_new (void); 52static E_Randr_Screen_Info_11 * _e_randr_screen_info_11_new (void);
53static const Eina_Bool _e_randr_screen_info_11_set (void); 53static Eina_Bool _e_randr_screen_info_11_set (void);
54static void _e_randr_screen_info_11_free (E_Randr_Screen_Info_11 *screen_info_11); 54static void _e_randr_screen_info_11_free (E_Randr_Screen_Info_11 *screen_info_11);
55static E_Randr_Screen_Info_12 * _e_randr_screen_info_12_new (void); 55static E_Randr_Screen_Info_12 * _e_randr_screen_info_12_new (void);
56static const Eina_Bool _e_randr_screen_info_12_set (E_Randr_Screen_Info_12 *screen_info_12); 56static Eina_Bool _e_randr_screen_info_12_set (E_Randr_Screen_Info_12 *screen_info_12);
57static void _e_randr_screen_info_12_free (E_Randr_Screen_Info_12 *screen_info_12); 57static void _e_randr_screen_info_12_free (E_Randr_Screen_Info_12 *screen_info_12);
58static E_Randr_Output_Info * _e_randr_output_info_new (int nrequested); 58static E_Randr_Output_Info * _e_randr_output_info_new (int nrequested);
59static void _e_randr_output_info_free (E_Randr_Output_Info *output_info); 59static void _e_randr_output_info_free (E_Randr_Output_Info *output_info);
60static E_Randr_Crtc_Info * _e_randr_crtc_info_new (int nrequested); 60static E_Randr_Crtc_Info * _e_randr_crtc_info_new (int nrequested);
61static void _e_randr_crtc_info_free (E_Randr_Crtc_Info *crtc_info); 61static void _e_randr_crtc_info_free (E_Randr_Crtc_Info *crtc_info);
62static inline Eina_Bool _e_randr_screen_outputs_init (void); 62static Eina_Bool _e_randr_screen_outputs_init (void);
63static inline Eina_Bool _e_randr_screen_crtcs_init (void); 63static Eina_Bool _e_randr_screen_crtcs_init (void);
64static inline Eina_Bool _e_randr_output_modes_add (E_Randr_Output_Info *output_info); 64static Eina_Bool _e_randr_output_modes_add (E_Randr_Output_Info *output_info);
65static inline void _e_randr_notify_crtc_mode_change (E_Randr_Crtc_Info *crtc_info); 65static void _e_randr_notify_crtc_mode_change (E_Randr_Crtc_Info *crtc_info);
66static inline void _e_randr_notify_output_change (E_Randr_Output_Info *output_info); 66static void _e_randr_notify_output_change (E_Randr_Output_Info *output_info);
67static inline Ecore_X_Randr_Mode_Info * _e_randr_mode_info_get (Ecore_X_Randr_Mode mode); 67static Ecore_X_Randr_Mode_Info * _e_randr_mode_info_get (Ecore_X_Randr_Mode mode);
68static inline E_Randr_Crtc_Info * _e_randr_crtc_info_get (Ecore_X_Randr_Crtc crtc); 68static E_Randr_Crtc_Info * _e_randr_crtc_info_get (Ecore_X_Randr_Crtc crtc);
69static inline E_Randr_Output_Info * _e_randr_output_info_get (Ecore_X_Randr_Output output); 69static E_Randr_Output_Info * _e_randr_output_info_get (Ecore_X_Randr_Output output);
70static void _e_randr_output_info_set (E_Randr_Output_Info *output_info); 70static void _e_randr_output_info_set (E_Randr_Output_Info *output_info);
71static const inline Eina_Bool _e_randr_outputs_connected (Eina_List *outputs_info); 71static Eina_Bool _e_randr_outputs_connected (Eina_List *outputs_info);
72static void _e_randr_crtc_info_set (E_Randr_Crtc_Info *crtc_info); 72static void _e_randr_crtc_info_set (E_Randr_Crtc_Info *crtc_info);
73static const inline 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); 73static 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);
74static const inline Eina_Bool _e_randr_outputs_connected (Eina_List *outputs_info); 74static Eina_Bool _e_randr_outputs_connected (Eina_List *outputs_info);
75static inline Ecore_X_Randr_Output * _e_randr_outputs_to_array (Eina_List *outputs_info); 75static Ecore_X_Randr_Output * _e_randr_outputs_to_array (Eina_List *outputs_info);
76static int _e_randr_config_find_suiting_config_11 (E_Randr_Screen_Restore_Info_11** restore_info); 76static int _e_randr_config_find_suiting_config_11 (E_Randr_Screen_Restore_Info_11** restore_info);
77static inline E_Randr_Screen_Restore_Info_12 * _e_randr_config_find_suiting_config_12 (void); 77static E_Randr_Screen_Restore_Info_12 * _e_randr_config_find_suiting_config_12 (void);
78static Eina_Bool _e_randr_config_enable_11 (int size_index, Ecore_X_Randr_Refresh_Rate refresh_rate, Ecore_X_Randr_Orientation orientation); 78static Eina_Bool _e_randr_config_enable_11 (int size_index, Ecore_X_Randr_Refresh_Rate refresh_rate, Ecore_X_Randr_Orientation orientation);
79static Eina_Bool _e_randr_config_enable_12 (const E_Randr_Screen_Restore_Info_12 *restore_info); 79static Eina_Bool _e_randr_config_enable_12 (const E_Randr_Screen_Restore_Info_12 *restore_info);
80static Eina_Bool _e_randr_try_enable_output (E_Randr_Output_Info *output_info, Eina_Bool force); 80static Eina_Bool _e_randr_try_enable_output (E_Randr_Output_Info *output_info, Eina_Bool force);
@@ -86,14 +86,14 @@ static int _outputs_size_sort_cb
86static int _modes_size_sort_cb (const void *d1, const void *d2); 86static int _modes_size_sort_cb (const void *d1, const void *d2);
87static Eina_List * _e_randr_outputs_common_modes_get (Eina_List *outputs, Ecore_X_Randr_Mode_Info *max_size_mode); 87static Eina_List * _e_randr_outputs_common_modes_get (Eina_List *outputs, Ecore_X_Randr_Mode_Info *max_size_mode);
88static Ecore_X_Randr_Mode_Info * _e_randr_outputs_common_mode_max_get (Eina_List *outputs, Ecore_X_Randr_Mode_Info *max_size_mode); 88static Ecore_X_Randr_Mode_Info * _e_randr_outputs_common_mode_max_get (Eina_List *outputs, Ecore_X_Randr_Mode_Info *max_size_mode);
89static inline Ecore_X_Randr_Mode_Info * _e_randr_mode_geo_identical_find (Eina_List *modes, Ecore_X_Randr_Mode_Info *mode); 89static Ecore_X_Randr_Mode_Info * _e_randr_mode_geo_identical_find (Eina_List *modes, Ecore_X_Randr_Mode_Info *mode);
90static inline Eina_Bool _e_randr_crtc_mode_intersects_crtcs (E_Randr_Crtc_Info *crtc_info, Ecore_X_Randr_Mode_Info *mode); 90static Eina_Bool _e_randr_crtc_mode_intersects_crtcs (E_Randr_Crtc_Info *crtc_info, Ecore_X_Randr_Mode_Info *mode);
91static inline Eina_Bool _e_randr_crtc_outputs_mode_max_set (E_Randr_Crtc_Info *crtc_info); 91static Eina_Bool _e_randr_crtc_outputs_mode_max_set (E_Randr_Crtc_Info *crtc_info);
92static Eina_Bool _e_randr_crtcs_clone_crtc_removed (E_Randr_Crtc_Info *former_clone); 92static Eina_Bool _e_randr_crtcs_clone_crtc_removed (E_Randr_Crtc_Info *former_clone);
93static void _e_randr_screen_primary_output_assign (E_Randr_Output_Info *removed); 93static void _e_randr_screen_primary_output_assign (E_Randr_Output_Info *removed);
94static void _e_randr_output_info_hw_info_set (E_Randr_Output_Info *output_info); 94static void _e_randr_output_info_hw_info_set (E_Randr_Output_Info *output_info);
95static void _e_randr_output_hw_info_free (E_Randr_Output_Info *output_info); 95static void _e_randr_output_hw_info_free (E_Randr_Output_Info *output_info);
96static const inline Eina_Bool _e_randr_outputs_are_clones (E_Randr_Output_Info *output_info, Eina_List *outputs); 96static Eina_Bool _e_randr_outputs_are_clones (E_Randr_Output_Info *output_info, Eina_List *outputs);
97 97
98E_Randr_Screen_Info * e_randr_screen_info = NULL; 98E_Randr_Screen_Info * e_randr_screen_info = NULL;
99static Eina_List * _e_randr_event_handlers = NULL; 99static Eina_List * _e_randr_event_handlers = NULL;
@@ -192,7 +192,7 @@ _e_randr_screen_info_new(void)
192/** 192/**
193 * @param screen_info the screen info to free. 193 * @param screen_info the screen info to free.
194 */ 194 */
195 static inline void 195static void
196_e_randr_screen_info_free(E_Randr_Screen_Info *screen_info) 196_e_randr_screen_info_free(E_Randr_Screen_Info *screen_info)
197{ 197{
198 if (!screen_info || !(screen_info->rrvd_info.randr_info_11)) return; 198 if (!screen_info || !(screen_info->rrvd_info.randr_info_11)) return;
@@ -281,7 +281,7 @@ _e_randr_screen_info_12_new(void)
281 return ret; 281 return ret;
282} 282}
283 283
284 static const Eina_Bool 284 static Eina_Bool
285_e_randr_screen_info_12_set(E_Randr_Screen_Info_12 *screen_info) 285_e_randr_screen_info_12_set(E_Randr_Screen_Info_12 *screen_info)
286{ 286{
287 E_RANDR_NO_12_RET(EINA_FALSE); 287 E_RANDR_NO_12_RET(EINA_FALSE);
@@ -292,7 +292,7 @@ _e_randr_screen_info_12_set(E_Randr_Screen_Info_12 *screen_info)
292 return EINA_TRUE; 292 return EINA_TRUE;
293} 293}
294 294
295 static const Eina_Bool 295 static Eina_Bool
296_e_randr_screen_info_11_set(void) 296_e_randr_screen_info_11_set(void)
297{ 297{
298 E_RANDR_NO_11_RET(EINA_FALSE); 298 E_RANDR_NO_11_RET(EINA_FALSE);
@@ -424,7 +424,7 @@ _e_randr_crtc_info_free(E_Randr_Crtc_Info *crtc_info)
424 * @return E_Randr_Output_Info element, or it could not be 424 * @return E_Randr_Output_Info element, or it could not be
425 * created, NULL 425 * created, NULL
426 */ 426 */
427 static inline E_Randr_Output_Info * 427static E_Randr_Output_Info *
428_e_randr_output_info_new(int nrequested) 428_e_randr_output_info_new(int nrequested)
429{ 429{
430 E_Randr_Output_Info *ret = NULL; 430 E_Randr_Output_Info *ret = NULL;
@@ -524,7 +524,7 @@ _e_randr_crtc_info_set(E_Randr_Crtc_Info *crtc_info)
524 * looks up modes supported by an output and adds them - if they are not already 524 * looks up modes supported by an output and adds them - if they are not already
525 * known by - to the screen's information struct ant the output_info itself 525 * known by - to the screen's information struct ant the output_info itself
526 */ 526 */
527 static inline Eina_Bool 527static Eina_Bool
528_e_randr_output_modes_add(E_Randr_Output_Info *output_info) 528_e_randr_output_modes_add(E_Randr_Output_Info *output_info)
529{ 529{
530 Ecore_X_Randr_Mode *modes; 530 Ecore_X_Randr_Mode *modes;
@@ -540,7 +540,7 @@ _e_randr_output_modes_add(E_Randr_Output_Info *output_info)
540 added_yet = EINA_FALSE; 540 added_yet = EINA_FALSE;
541 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->modes, iter, mode_info) 541 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->modes, iter, mode_info)
542 { 542 {
543 if (mode_info->xid == modes[nmodes]) 543 if (mode_info && mode_info->xid == modes[nmodes])
544 { 544 {
545 added_yet = EINA_TRUE; 545 added_yet = EINA_TRUE;
546 break; 546 break;
@@ -560,7 +560,7 @@ _e_randr_output_modes_add(E_Randr_Output_Info *output_info)
560 return EINA_TRUE; 560 return EINA_TRUE;
561} 561}
562 562
563 static inline Eina_Bool 563static Eina_Bool
564_e_randr_screen_crtcs_init(void) 564_e_randr_screen_crtcs_init(void)
565{ 565{
566 Ecore_X_Randr_Crtc *crtcs = NULL; 566 Ecore_X_Randr_Crtc *crtcs = NULL;
@@ -595,9 +595,7 @@ ecore_x_randr_screen_crtcs_init_fail_free_crtcs:
595 return EINA_FALSE; 595 return EINA_FALSE;
596} 596}
597 597
598 598static Eina_Bool
599
600 static inline Eina_Bool
601_e_randr_screen_outputs_init(void) 599_e_randr_screen_outputs_init(void)
602{ 600{
603 Ecore_X_Randr_Output *outputs; 601 Ecore_X_Randr_Output *outputs;
@@ -631,7 +629,7 @@ _e_randr_screen_outputs_init_fail_free_outputs:
631 return EINA_FALSE; 629 return EINA_FALSE;
632} 630}
633 631
634 static inline Ecore_X_Randr_Mode_Info* 632static Ecore_X_Randr_Mode_Info*
635_e_randr_mode_info_get(Ecore_X_Randr_Mode mode) 633_e_randr_mode_info_get(Ecore_X_Randr_Mode mode)
636{ 634{
637 Eina_List *iter; 635 Eina_List *iter;
@@ -640,12 +638,12 @@ _e_randr_mode_info_get(Ecore_X_Randr_Mode mode)
640 E_RANDR_NO_MODE_RET(mode, NULL); 638 E_RANDR_NO_MODE_RET(mode, NULL);
641 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->modes, iter, mode_info) 639 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->modes, iter, mode_info)
642 { 640 {
643 if (mode_info->xid == mode) return mode_info; 641 if (mode_info && mode_info->xid == mode) return mode_info;
644 } 642 }
645 return NULL; 643 return NULL;
646} 644}
647 645
648 static inline E_Randr_Output_Info* 646static E_Randr_Output_Info*
649_e_randr_output_info_get(Ecore_X_Randr_Output output) 647_e_randr_output_info_get(Ecore_X_Randr_Output output)
650{ 648{
651 Eina_List *iter; 649 Eina_List *iter;
@@ -654,12 +652,12 @@ _e_randr_output_info_get(Ecore_X_Randr_Output output)
654 E_RANDR_NO_OUTPUTS_RET(NULL); 652 E_RANDR_NO_OUTPUTS_RET(NULL);
655 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->outputs, iter, output_info) 653 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->outputs, iter, output_info)
656 { 654 {
657 if (output_info->xid == output) return output_info; 655 if (output_info && output_info->xid == output) return output_info;
658 } 656 }
659 return NULL; 657 return NULL;
660} 658}
661 659
662 static inline E_Randr_Crtc_Info* 660static E_Randr_Crtc_Info*
663_e_randr_crtc_info_get(Ecore_X_Randr_Crtc crtc) 661_e_randr_crtc_info_get(Ecore_X_Randr_Crtc crtc)
664{ 662{
665 Eina_List *iter; 663 Eina_List *iter;
@@ -668,7 +666,7 @@ _e_randr_crtc_info_get(Ecore_X_Randr_Crtc crtc)
668 E_RANDR_NO_CRTCS_RET(NULL); 666 E_RANDR_NO_CRTCS_RET(NULL);
669 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->crtcs, iter, crtc_info) 667 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->crtcs, iter, crtc_info)
670 { 668 {
671 if (crtc_info->xid == crtc) return crtc_info; 669 if (crtc_info && crtc_info->xid == crtc) return crtc_info;
672 } 670 }
673 return NULL; 671 return NULL;
674} 672}
@@ -819,9 +817,10 @@ _e_randr_event_cb(void *data, int type, void *ev)
819 //let's try to get a proper config for the new setup and crop the 817 //let's try to get a proper config for the new setup and crop the
820 //screen afterwards. 818 //screen afterwards.
821 if((restore_info = _e_randr_config_find_suiting_config_12())) 819 if((restore_info = _e_randr_config_find_suiting_config_12()))
822 //in case we didn't have, init it anyway... 820 {
823 //_e_randr_config_enable_12(restore_info); 821 //in case we didn't have, init it anyway...
824 ; 822 //_e_randr_config_enable_12(restore_info);
823 }
825 } 824 }
826 _e_randr_notify_output_change(output_info); 825 _e_randr_notify_output_change(output_info);
827 _e_randr_output_hw_info_free(output_info); 826 _e_randr_output_hw_info_free(output_info);
@@ -844,7 +843,7 @@ _e_randr_event_cb(void *data, int type, void *ev)
844 return ECORE_CALLBACK_RENEW; 843 return ECORE_CALLBACK_RENEW;
845} 844}
846 845
847 static inline void 846static void
848_e_randr_event_listeners_add(void) 847_e_randr_event_listeners_add(void)
849{ 848{
850 if (E_RANDR_NO_12) return; 849 if (E_RANDR_NO_12) return;
@@ -854,7 +853,7 @@ _e_randr_event_listeners_add(void)
854 _e_randr_event_handlers= eina_list_append(_e_randr_event_handlers, ecore_event_handler_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, _e_randr_event_cb, NULL)); 853 _e_randr_event_handlers= eina_list_append(_e_randr_event_handlers, ecore_event_handler_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, _e_randr_event_cb, NULL));
855} 854}
856 855
857 static inline void 856static void
858_e_randr_event_listeners_remove(void) 857_e_randr_event_listeners_remove(void)
859{ 858{
860 Ecore_Event_Handler *_event_handler = NULL; 859 Ecore_Event_Handler *_event_handler = NULL;
@@ -862,7 +861,7 @@ _e_randr_event_listeners_remove(void)
862 ecore_event_handler_del(_event_handler); 861 ecore_event_handler_del(_event_handler);
863} 862}
864 863
865 static inline void 864static void
866_e_randr_notify_crtc_mode_change(E_Randr_Crtc_Info *crtc_info) 865_e_randr_notify_crtc_mode_change(E_Randr_Crtc_Info *crtc_info)
867{ 866{
868// E_Notification *n; 867// E_Notification *n;
@@ -877,7 +876,7 @@ _e_randr_notify_crtc_mode_change(E_Randr_Crtc_Info *crtc_info)
877// e_notification_unref(n); 876// e_notification_unref(n);
878 } 877 }
879} 878}
880 static inline void 879static void
881_e_randr_notify_output_change(E_Randr_Output_Info *output_info) 880_e_randr_notify_output_change(E_Randr_Output_Info *output_info)
882{ 881{
883// E_Notification *n; 882// E_Notification *n;
@@ -905,7 +904,7 @@ _e_randr_notify_output_change(E_Randr_Output_Info *output_info)
905 * instead of trying to fill gaps like tetris. Though this could be done by 904 * instead of trying to fill gaps like tetris. Though this could be done by
906 * simply implementing another policy. 905 * simply implementing another policy.
907 */ 906 */
908 static const inline E_Randr_Crtc_Info* 907static const E_Randr_Crtc_Info*
909_e_randr_policy_crtc_get(E_Randr_Crtc_Info *but, E_Randr_Crtc_Info *hint, Ecore_X_Randr_Output_Policy policy) 908_e_randr_policy_crtc_get(E_Randr_Crtc_Info *but, E_Randr_Crtc_Info *hint, Ecore_X_Randr_Output_Policy policy)
910{ 909{
911 Eina_List *iter; 910 Eina_List *iter;
@@ -929,7 +928,7 @@ _e_randr_policy_crtc_get(E_Randr_Crtc_Info *but, E_Randr_Crtc_Info *hint, Ecore_
929 case ECORE_X_RANDR_OUTPUT_POLICY_ABOVE: 928 case ECORE_X_RANDR_OUTPUT_POLICY_ABOVE:
930 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->crtcs, iter, crtc_info) 929 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->crtcs, iter, crtc_info)
931 { 930 {
932 if ((crtc_info != but) && (crtc_info->geometry.y <= ret->geometry.y)) 931 if (crtc_info && (crtc_info != but) && (crtc_info->geometry.y <= ret->geometry.y))
933 { 932 {
934 ret = crtc_info; 933 ret = crtc_info;
935 } 934 }
@@ -938,7 +937,7 @@ _e_randr_policy_crtc_get(E_Randr_Crtc_Info *but, E_Randr_Crtc_Info *hint, Ecore_
938 case ECORE_X_RANDR_OUTPUT_POLICY_RIGHT: 937 case ECORE_X_RANDR_OUTPUT_POLICY_RIGHT:
939 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->crtcs, iter, crtc_info) 938 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->crtcs, iter, crtc_info)
940 { 939 {
941 if ((crtc_info != but) && ((crtc_info->geometry.x + crtc_info->geometry.w) >= (ret->geometry.x + ret->geometry.w))) 940 if (crtc_info && (crtc_info != but) && ((crtc_info->geometry.x + crtc_info->geometry.w) >= (ret->geometry.x + ret->geometry.w)))
942 { 941 {
943 ret = crtc_info; 942 ret = crtc_info;
944 } 943 }
@@ -948,7 +947,7 @@ _e_randr_policy_crtc_get(E_Randr_Crtc_Info *but, E_Randr_Crtc_Info *hint, Ecore_
948 case ECORE_X_RANDR_OUTPUT_POLICY_BELOW: 947 case ECORE_X_RANDR_OUTPUT_POLICY_BELOW:
949 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->crtcs, iter, crtc_info) 948 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->crtcs, iter, crtc_info)
950 { 949 {
951 if ((crtc_info != but) && ((crtc_info->geometry.y + crtc_info->geometry.h) >= (ret->geometry.y + ret->geometry.h))) 950 if (crtc_info && (crtc_info != but) && ((crtc_info->geometry.y + crtc_info->geometry.h) >= (ret->geometry.y + ret->geometry.h)))
952 { 951 {
953 ret = crtc_info; 952 ret = crtc_info;
954 } 953 }
@@ -958,7 +957,7 @@ _e_randr_policy_crtc_get(E_Randr_Crtc_Info *but, E_Randr_Crtc_Info *hint, Ecore_
958 case ECORE_X_RANDR_OUTPUT_POLICY_LEFT: 957 case ECORE_X_RANDR_OUTPUT_POLICY_LEFT:
959 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->crtcs, iter, crtc_info) 958 EINA_LIST_FOREACH(e_randr_screen_info->rrvd_info.randr_info_12->crtcs, iter, crtc_info)
960 { 959 {
961 if ((crtc_info != but) && (crtc_info->geometry.x <= ret->geometry.x)) 960 if (crtc_info && (crtc_info != but) && (crtc_info->geometry.x <= ret->geometry.x))
962 { 961 {
963 ret = crtc_info; 962 ret = crtc_info;
964 } 963 }
@@ -975,7 +974,7 @@ _e_randr_policy_crtc_get(E_Randr_Crtc_Info *but, E_Randr_Crtc_Info *hint, Ecore_
975 return ret; 974 return ret;
976} 975}
977 976
978 static const inline Eina_Bool 977static Eina_Bool
979_e_randr_outputs_connected(Eina_List *outputs_info) 978_e_randr_outputs_connected(Eina_List *outputs_info)
980{ 979{
981 Eina_List *iter; 980 Eina_List *iter;
@@ -1030,7 +1029,7 @@ _e_randr_config_enable_12(const E_Randr_Screen_Restore_Info_12* restore_info)
1030 return EINA_FALSE; 1029 return EINA_FALSE;
1031} 1030}
1032 1031
1033 static inline int 1032static int
1034_e_randr_config_find_suiting_config_11(E_Randr_Screen_Restore_Info_11 **restore_info) 1033_e_randr_config_find_suiting_config_11(E_Randr_Screen_Restore_Info_11 **restore_info)
1035{ 1034{
1036 E_RANDR_NO_11_RET(Ecore_X_Randr_None); 1035 E_RANDR_NO_11_RET(Ecore_X_Randr_None);
@@ -1044,6 +1043,7 @@ _e_randr_config_find_suiting_config_11(E_Randr_Screen_Restore_Info_11 **restore_
1044 1043
1045 EINA_LIST_FOREACH(e_config->screen_info, cfg_screen_restore_info_iter, screen_restore_info) 1044 EINA_LIST_FOREACH(e_config->screen_info, cfg_screen_restore_info_iter, screen_restore_info)
1046 { 1045 {
1046 if (!screen_restore_info) continue ;
1047 if (screen_restore_info->randr_version != ECORE_X_RANDR_1_1) continue; 1047 if (screen_restore_info->randr_version != ECORE_X_RANDR_1_1) continue;
1048 restore_info_11 = screen_restore_info->rrvd_restore_info.restore_info_11; 1048 restore_info_11 = screen_restore_info->rrvd_restore_info.restore_info_11;
1049 if((sizes = ecore_x_randr_screen_primary_output_sizes_get(e_randr_screen_info->root, &nsizes))) 1049 if((sizes = ecore_x_randr_screen_primary_output_sizes_get(e_randr_screen_info->root, &nsizes)))
@@ -1076,7 +1076,7 @@ _e_randr_config_find_suiting_config_11(E_Randr_Screen_Restore_Info_11 **restore_
1076/** 1076/**
1077 * @Brief find configuration with the most hardware currently available 1077 * @Brief find configuration with the most hardware currently available
1078 */ 1078 */
1079 static inline E_Randr_Screen_Restore_Info_12 * 1079static E_Randr_Screen_Restore_Info_12 *
1080_e_randr_config_find_suiting_config_12(void) 1080_e_randr_config_find_suiting_config_12(void)
1081{ 1081{
1082 //TODO: write geometry based loading 1082 //TODO: write geometry based loading
@@ -1111,7 +1111,7 @@ _e_randr_config_find_suiting_config_12(void)
1111} 1111}
1112 1112
1113 1113
1114 static inline Ecore_X_Randr_Output * 1114static Ecore_X_Randr_Output *
1115_e_randr_outputs_to_array(Eina_List *outputs_info) 1115_e_randr_outputs_to_array(Eina_List *outputs_info)
1116{ 1116{
1117 Ecore_X_Randr_Output *ret = NULL; 1117 Ecore_X_Randr_Output *ret = NULL;
@@ -1121,7 +1121,7 @@ _e_randr_outputs_to_array(Eina_List *outputs_info)
1121 1121
1122 if (!outputs_info || !(ret = malloc(sizeof(Ecore_X_Randr_Output) * eina_list_count(outputs_info)))) return NULL; 1122 if (!outputs_info || !(ret = malloc(sizeof(Ecore_X_Randr_Output) * eina_list_count(outputs_info)))) return NULL;
1123 EINA_LIST_FOREACH(outputs_info, output_iter, output_info) 1123 EINA_LIST_FOREACH(outputs_info, output_iter, output_info)
1124 ret[i++] = output_info->xid; 1124 ret[i++] = output_info ? output_info->xid : NULL;
1125 return ret; 1125 return ret;
1126} 1126}
1127 1127
@@ -1150,7 +1150,7 @@ _e_randr_try_enable_output(E_Randr_Output_Info *output_info, Eina_Bool force)
1150 */ 1150 */
1151 EINA_LIST_FOREACH(output_info->possible_crtcs, iter, crtc_info) 1151 EINA_LIST_FOREACH(output_info->possible_crtcs, iter, crtc_info)
1152 { 1152 {
1153 if (!crtc_info->current_mode || force) 1153 if (crtc_info && (!crtc_info->current_mode || force))
1154 { 1154 {
1155 usable_crtc = crtc_info; 1155 usable_crtc = crtc_info;
1156 break; 1156 break;
@@ -1469,7 +1469,7 @@ _modes_size_sort_cb(const void *d1, const void *d2)
1469 * returns a mode within a given list of modes that is gemetrically identical. 1469 * returns a mode within a given list of modes that is gemetrically identical.
1470 * If none is found, NULL is returned. 1470 * If none is found, NULL is returned.
1471 */ 1471 */
1472 static inline Ecore_X_Randr_Mode_Info * 1472static Ecore_X_Randr_Mode_Info *
1473_e_randr_mode_geo_identical_find(Eina_List *modes, Ecore_X_Randr_Mode_Info *mode) 1473_e_randr_mode_geo_identical_find(Eina_List *modes, Ecore_X_Randr_Mode_Info *mode)
1474{ 1474{
1475 Eina_List *iter; 1475 Eina_List *iter;
@@ -1487,7 +1487,7 @@ _e_randr_mode_geo_identical_find(Eina_List *modes, Ecore_X_Randr_Mode_Info *mode
1487 * reconfigures a CRTC enabling the highest resolution amongst its outputs, 1487 * reconfigures a CRTC enabling the highest resolution amongst its outputs,
1488 * without touching any other CRTC currently activated 1488 * without touching any other CRTC currently activated
1489 */ 1489 */
1490 static inline Eina_Bool 1490static Eina_Bool
1491_e_randr_crtc_outputs_mode_max_set(E_Randr_Crtc_Info *crtc_info) 1491_e_randr_crtc_outputs_mode_max_set(E_Randr_Crtc_Info *crtc_info)
1492{ 1492{
1493 Ecore_X_Randr_Mode_Info *mode_info; 1493 Ecore_X_Randr_Mode_Info *mode_info;
@@ -1523,7 +1523,7 @@ _e_randr_crtc_outputs_mode_max_set(E_Randr_Crtc_Info *crtc_info)
1523 * returns EINA_TRUE if given CRTC would intersect with other CRTCs if set to 1523 * returns EINA_TRUE if given CRTC would intersect with other CRTCs if set to
1524 * given mode 1524 * given mode
1525 */ 1525 */
1526 static inline Eina_Bool 1526static Eina_Bool
1527_e_randr_crtc_mode_intersects_crtcs(E_Randr_Crtc_Info *crtc_info, Ecore_X_Randr_Mode_Info *mode) 1527_e_randr_crtc_mode_intersects_crtcs(E_Randr_Crtc_Info *crtc_info, Ecore_X_Randr_Mode_Info *mode)
1528{ 1528{
1529 Eina_List *iter; 1529 Eina_List *iter;
@@ -1732,7 +1732,7 @@ _e_randr_output_hw_info_free(E_Randr_Output_Info *output_info)
1732/* 1732/*
1733 * checks whether a given output is a common clone of the given list's outputs 1733 * checks whether a given output is a common clone of the given list's outputs
1734 */ 1734 */
1735 static const inline Eina_Bool 1735static Eina_Bool
1736_e_randr_outputs_are_clones(E_Randr_Output_Info *output_info, Eina_List *outputs) 1736_e_randr_outputs_are_clones(E_Randr_Output_Info *output_info, Eina_List *outputs)
1737{ 1737{
1738 E_Randr_Output_Info *output; 1738 E_Randr_Output_Info *output;