summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-20 01:50:03 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-20 01:50:03 +0100
commitddc9ff72807cfc5274d80f72293b7307850704a2 (patch)
tree07db292f47d1575202d8865ff5da661610f14800 /src
parente8f5794b8162188f547c1a59edae365307d66ce5 (diff)
randr - add response timeout config value
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_randr2.c19
-rw-r--r--src/bin/e_randr2.h1
-rw-r--r--src/modules/conf_randr/e_int_config_randr2.c23
3 files changed, 41 insertions, 2 deletions
diff --git a/src/bin/e_randr2.c b/src/bin/e_randr2.c
index 643d399a1..44b22387a 100644
--- a/src/bin/e_randr2.c
+++ b/src/bin/e_randr2.c
@@ -1,6 +1,6 @@
1#include "e.h" 1#include "e.h"
2 2
3#define E_RANDR_CONFIG_VERSION 2 3#define E_RANDR_CONFIG_VERSION 3
4 4
5///////////////////////////////////////////////////////////////////////// 5/////////////////////////////////////////////////////////////////////////
6static Eina_Bool _screen_closed(E_Randr2_Screen *s); 6static Eina_Bool _screen_closed(E_Randr2_Screen *s);
@@ -83,6 +83,7 @@ e_randr2_init(void)
83#define D _e_randr2_cfg_edd 83#define D _e_randr2_cfg_edd
84 E_CONFIG_VAL(D, T, version, INT); 84 E_CONFIG_VAL(D, T, version, INT);
85 E_CONFIG_LIST(D, T, screens, _e_randr2_cfg_screen_edd); 85 E_CONFIG_LIST(D, T, screens, _e_randr2_cfg_screen_edd);
86 E_CONFIG_VAL(D, T, hotplug_response, DOUBLE);
86 E_CONFIG_VAL(D, T, restore, UCHAR); 87 E_CONFIG_VAL(D, T, restore, UCHAR);
87 E_CONFIG_VAL(D, T, ignore_hotplug_events, UCHAR); 88 E_CONFIG_VAL(D, T, ignore_hotplug_events, UCHAR);
88 E_CONFIG_VAL(D, T, ignore_acpi_events, UCHAR); 89 E_CONFIG_VAL(D, T, ignore_acpi_events, UCHAR);
@@ -349,6 +350,9 @@ _config_upgrade(E_Config_Randr2 *cfg)
349{ 350{
350 if (cfg->version < 2) 351 if (cfg->version < 2)
351 cfg->default_policy = E_RANDR2_POLICY_EXTEND; 352 cfg->default_policy = E_RANDR2_POLICY_EXTEND;
353 if (cfg->version < 3)
354 cfg->hotplug_response = 1.0;
355 cfg->version = E_RANDR_CONFIG_VERSION;
352} 356}
353 357
354static E_Config_Randr2 * 358static E_Config_Randr2 *
@@ -362,6 +366,10 @@ _config_load(void)
362 { 366 {
363 if (cfg->version < E_RANDR_CONFIG_VERSION) 367 if (cfg->version < E_RANDR_CONFIG_VERSION)
364 _config_upgrade(cfg); 368 _config_upgrade(cfg);
369 if (cfg->hotplug_response < 0.2)
370 cfg->hotplug_response = 0.2;
371 else if (cfg->hotplug_response > 9.0)
372 cfg->hotplug_response = 9.0;
365 printf("RRR: loaded existing config\n"); 373 printf("RRR: loaded existing config\n");
366 return cfg; 374 return cfg;
367 } 375 }
@@ -374,6 +382,7 @@ _config_load(void)
374 cfg->ignore_hotplug_events = 0; 382 cfg->ignore_hotplug_events = 0;
375 cfg->ignore_acpi_events = 0; 383 cfg->ignore_acpi_events = 0;
376 cfg->default_policy = E_RANDR2_POLICY_EXTEND; 384 cfg->default_policy = E_RANDR2_POLICY_EXTEND;
385 cfg->hotplug_response = 1.0;
377 printf("RRR: fresh config\n"); 386 printf("RRR: fresh config\n");
378 return cfg; 387 return cfg;
379} 388}
@@ -1403,7 +1412,13 @@ e_randr2_screen_refresh_queue(Eina_Bool lid_event)
1403 if (_screen_delay_timer) 1412 if (_screen_delay_timer)
1404 ecore_timer_loop_reset(_screen_delay_timer); 1413 ecore_timer_loop_reset(_screen_delay_timer);
1405 else 1414 else
1406 _screen_delay_timer = ecore_timer_loop_add(1.0, _cb_screen_change_delay, NULL); 1415 {
1416 double t = 1.0;
1417
1418 if ((e_randr2_cfg) && (e_randr2_cfg->hotplug_response > 0.2))
1419 t = e_randr2_cfg->hotplug_response;
1420 _screen_delay_timer = ecore_timer_loop_add(t, _cb_screen_change_delay, NULL);
1421 }
1407 event_screen |= !!lid_event; 1422 event_screen |= !!lid_event;
1408} 1423}
1409 1424
diff --git a/src/bin/e_randr2.h b/src/bin/e_randr2.h
index c693e631c..5abccf8e6 100644
--- a/src/bin/e_randr2.h
+++ b/src/bin/e_randr2.h
@@ -102,6 +102,7 @@ struct _E_Config_Randr2
102 unsigned char ignore_hotplug_events; 102 unsigned char ignore_hotplug_events;
103 unsigned char ignore_acpi_events; 103 unsigned char ignore_acpi_events;
104 E_Randr2_Policy default_policy; 104 E_Randr2_Policy default_policy;
105 double hotplug_response;
105}; 106};
106 107
107struct _E_Config_Randr2_Screen 108struct _E_Config_Randr2_Screen
diff --git a/src/modules/conf_randr/e_int_config_randr2.c b/src/modules/conf_randr/e_int_config_randr2.c
index 85e569c7a..f12b29920 100644
--- a/src/modules/conf_randr/e_int_config_randr2.c
+++ b/src/modules/conf_randr/e_int_config_randr2.c
@@ -33,6 +33,7 @@ struct _E_Config_Dialog_Data
33 int hotplug; 33 int hotplug;
34 int acpi; 34 int acpi;
35 int screen; 35 int screen;
36 double hotplug_response;
36 E_Randr2_Policy policy; 37 E_Randr2_Policy policy;
37}; 38};
38 39
@@ -105,6 +106,7 @@ _create_data(E_Config_Dialog *cfd EINA_UNUSED)
105 cfdata->hotplug = !e_randr2_cfg->ignore_hotplug_events; 106 cfdata->hotplug = !e_randr2_cfg->ignore_hotplug_events;
106 cfdata->acpi = !e_randr2_cfg->ignore_acpi_events; 107 cfdata->acpi = !e_randr2_cfg->ignore_acpi_events;
107 cfdata->policy = e_randr2_cfg->default_policy; 108 cfdata->policy = e_randr2_cfg->default_policy;
109 cfdata->hotplug_response = e_randr2_cfg->hotplug_response;
108 return cfdata; 110 return cfdata;
109} 111}
110 112
@@ -129,6 +131,14 @@ _free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
129} 131}
130 132
131static void 133static void
134_cb_hotplug_response_changed(void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
135{
136 E_Config_Dialog_Data *cfdata = data;
137 cfdata->hotplug_response = elm_slider_value_get(obj);
138 e_config_dialog_changed_set(cfdata->cfd, EINA_TRUE);
139}
140
141static void
132_cb_restore_changed(void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED) 142_cb_restore_changed(void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
133{ 143{
134 E_Config_Dialog_Data *cfdata = data; 144 E_Config_Dialog_Data *cfdata = data;
@@ -1104,6 +1114,18 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas EINA_UNUSED, E_Config_Dialog_Data
1104 evas_object_show(o); 1114 evas_object_show(o);
1105 bx2 = o; 1115 bx2 = o;
1106 1116
1117 o = elm_slider_add(win);
1118 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
1119 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
1120 elm_object_text_set(o, _("Response"));
1121 elm_slider_unit_format_set(o, "%1.1f sec");
1122 elm_slider_span_size_set(o, 88);
1123 elm_slider_min_max_set(o, 0.2, 9.0);
1124 elm_slider_value_set(o, cfdata->hotplug_response);
1125 elm_box_pack_end(bx2, o);
1126 evas_object_show(o);
1127 evas_object_smart_callback_add(o, "changed", _cb_hotplug_response_changed, cfdata);
1128
1107 o = elm_check_add(win); 1129 o = elm_check_add(win);
1108 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); 1130 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
1109 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 1131 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -1160,6 +1182,7 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
1160 e_randr2_cfg->ignore_hotplug_events = !cfdata->hotplug; 1182 e_randr2_cfg->ignore_hotplug_events = !cfdata->hotplug;
1161 e_randr2_cfg->ignore_acpi_events = !cfdata->acpi; 1183 e_randr2_cfg->ignore_acpi_events = !cfdata->acpi;
1162 e_randr2_cfg->default_policy = cfdata->policy; 1184 e_randr2_cfg->default_policy = cfdata->policy;
1185 e_randr2_cfg->hotplug_response = cfdata->hotplug_response;
1163 1186
1164 printf("APPLY....................\n"); 1187 printf("APPLY....................\n");
1165 EINA_LIST_FOREACH(cfdata->screens, l, cs2) 1188 EINA_LIST_FOREACH(cfdata->screens, l, cs2)