1 #include "e_randr_private.h"
4 #define ECORE_X_RANDR_1_1 ((1 << 16) | 1)
5 #define ECORE_X_RANDR_1_2 ((1 << 16) | 2)
6 #define ECORE_X_RANDR_1_3 ((1 << 16) | 3)
8 /**********************************************************************
10 * Storage/Restorage of setups
12 **********************************************************************
15 E_Randr_Serialized_Setup *
16 _new_serialized_setup(void)
18 return E_NEW(E_Randr_Serialized_Setup, 1);
21 EINTERN E_Randr_Serialized_Setup *
22 e_randr_serialized_setup_new(void)
24 return _new_serialized_setup();
28 e_randr_store_configuration(E_Randr_Configuration_Store_Modifier modifier)
30 if (!e_config->randr_serialized_setup)
31 e_config->randr_serialized_setup = _new_serialized_setup();
33 fprintf(stderr, "E_RANDR: Configuration shall be stored using the following modifier:%s\n%s%s%s%s",
34 ((!modifier) ? "NONE" : ""),
35 ((modifier & E_RANDR_CONFIGURATION_STORE_POLICIES) ? "\tPOLICIES\n" : ""),
36 ((modifier & E_RANDR_CONFIGURATION_STORE_RESOLUTIONS) ? "\tRESOLUTIONS\n" : ""),
37 ((modifier & E_RANDR_CONFIGURATION_STORE_ARRANGEMENT) ? "\tARRANGEMENTS\n" : ""),
38 ((modifier & E_RANDR_CONFIGURATION_STORE_ORIENTATIONS) ? "\tORIENTATIONS\n" : ""));
40 if (e_randr_screen_info.randr_version == ECORE_X_RANDR_1_1)
42 _11_store_configuration(modifier);
44 else if (e_randr_screen_info.randr_version >= ECORE_X_RANDR_1_2)
46 _12_store_configuration(modifier);
48 e_config_save_queue();
52 _try_restore_configuration(void)
54 EINA_SAFETY_ON_NULL_RETURN_VAL(e_config, EINA_FALSE);
55 if (!e_config->randr_serialized_setup) return EINA_FALSE;
57 if ((e_randr_screen_info.randr_version == ECORE_X_RANDR_1_1) ||
58 ((e_randr_screen_info.randr_version >= ECORE_X_RANDR_1_1) && e_config->randr_serialized_setup->serialized_setup_11 && !e_config->randr_serialized_setup->serialized_setups_12)) // either be 1.1 or maybe we have stored a resolution using the old conf_display dialog (which uses randr 1.1)
59 return _11_try_restore_configuration();
60 else if (e_randr_screen_info.randr_version >= ECORE_X_RANDR_1_2)
61 return _12_try_restore_configuration();
66 EINTERN Eina_Bool e_randr_try_restore_configuration(void)
68 return _try_restore_configuration();
71 EINTERN void e_randr_serialized_setup_free(E_Randr_Serialized_Setup *ss)
73 E_Randr_Serialized_Setup_12 *serialized_setup_12 = NULL;
74 E_Randr_Serialized_Output_Policy *serialized_output_policy = NULL;
76 EINA_SAFETY_ON_NULL_RETURN(ss);
78 e_randr_11_serialized_setup_free(ss->serialized_setup_11);
79 if (ss->serialized_setups_12)
81 EINA_LIST_FREE(ss->serialized_setups_12, serialized_setup_12)
83 e_randr_12_serialized_setup_free(serialized_setup_12);
86 EINA_LIST_FREE(ss->outputs_policies, serialized_output_policy)
88 e_randr_12_serialized_output_policy_free(serialized_output_policy);