131 return NULL;
132 }
133
134
135 static double getDesktopScale(char *output_name) {
136 double result = -1;
137 if(output_name) {
138 void *value = get_schema_value("com.ubuntu.user-interface",
139 "scale-factor");
140 if (value) {
141 if(fp_g_variant_is_of_type(value, "a{si}")) {
142 int num = fp_g_variant_n_children(value);
143 int i = 0;
144 while (i < num) {
145 void *entry = fp_g_variant_get_child_value(value, i++);
146 if (entry) {
147 void *screen = fp_g_variant_get_child_value(entry, 0);
148 void *scale = fp_g_variant_get_child_value(entry, 1);
149 if (screen && scale) {
150 char *name = fp_g_variant_get_string(screen, NULL);
151 if (name && strcmp(name, output_name)) {
152 result = fp_g_variant_get_int32(scale) / 8.;
153 }
154 fp_g_variant_unref(screen);
155 fp_g_variant_unref(scale);
156 }
157 fp_g_variant_unref(entry);
158 }
159 if (result > 0) {
160 break;
161 }
162 }
163 }
164 fp_g_variant_unref(value);
165 }
166 if (result > 0) {
167 value = get_schema_value("com.canonical.Unity.Interface",
168 "text-scale-factor");
169 if (value && fp_g_variant_is_of_type(value, "d")) {
170 result *= fp_g_variant_get_double(value);
171 fp_g_variant_unref(value);
|
131 return NULL;
132 }
133
134
135 static double getDesktopScale(char *output_name) {
136 double result = -1;
137 if(output_name) {
138 void *value = get_schema_value("com.ubuntu.user-interface",
139 "scale-factor");
140 if (value) {
141 if(fp_g_variant_is_of_type(value, "a{si}")) {
142 int num = fp_g_variant_n_children(value);
143 int i = 0;
144 while (i < num) {
145 void *entry = fp_g_variant_get_child_value(value, i++);
146 if (entry) {
147 void *screen = fp_g_variant_get_child_value(entry, 0);
148 void *scale = fp_g_variant_get_child_value(entry, 1);
149 if (screen && scale) {
150 char *name = fp_g_variant_get_string(screen, NULL);
151 if (name && !strcmp(name, output_name)) {
152 result = fp_g_variant_get_int32(scale) / 8.;
153 }
154 fp_g_variant_unref(screen);
155 fp_g_variant_unref(scale);
156 }
157 fp_g_variant_unref(entry);
158 }
159 if (result > 0) {
160 break;
161 }
162 }
163 }
164 fp_g_variant_unref(value);
165 }
166 if (result > 0) {
167 value = get_schema_value("com.canonical.Unity.Interface",
168 "text-scale-factor");
169 if (value && fp_g_variant_is_of_type(value, "d")) {
170 result *= fp_g_variant_get_double(value);
171 fp_g_variant_unref(value);
|