summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-07-22 10:56:02 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-07-22 10:56:02 +0100
commita4626f87fdc510f20ff16c017d81a8202b416f61 (patch)
treeaac4b9fb77d3ed52b034b58a98b42e51a191a90e
parenta5efea6b522d850eea5f37bfeaafc5ce9e9d288e (diff)
randr - allow custom names for screen (not output but model)HEADmaster
-rw-r--r--src/bin/e_randr2.c2
-rw-r--r--src/bin/e_randr2.h2
-rw-r--r--src/modules/conf_randr/e_int_config_randr2.c31
3 files changed, 33 insertions, 2 deletions
diff --git a/src/bin/e_randr2.c b/src/bin/e_randr2.c
index 5eef77e13..ae05a18ba 100644
--- a/src/bin/e_randr2.c
+++ b/src/bin/e_randr2.c
@@ -77,6 +77,7 @@ e_randr2_init(void)
77 E_CONFIG_VAL(D, T, rel_mode, UCHAR); 77 E_CONFIG_VAL(D, T, rel_mode, UCHAR);
78 E_CONFIG_VAL(D, T, enabled, UCHAR); 78 E_CONFIG_VAL(D, T, enabled, UCHAR);
79 E_CONFIG_VAL(D, T, ignore_disconnect, UCHAR); 79 E_CONFIG_VAL(D, T, ignore_disconnect, UCHAR);
80 E_CONFIG_VAL(D, T, custom_label_screen, STR);
80 E_CONFIG_VAL(D, T, profile, STR); 81 E_CONFIG_VAL(D, T, profile, STR);
81 E_CONFIG_VAL(D, T, scale_multiplier, DOUBLE); 82 E_CONFIG_VAL(D, T, scale_multiplier, DOUBLE);
82 83
@@ -411,6 +412,7 @@ _config_free(E_Config_Randr2 *cfg)
411 { 412 {
412 eina_stringshare_del(cs->id); 413 eina_stringshare_del(cs->id);
413 eina_stringshare_del(cs->rel_to); 414 eina_stringshare_del(cs->rel_to);
415 eina_stringshare_del(cs->custom_label_screen);
414 eina_stringshare_del(cs->profile); 416 eina_stringshare_del(cs->profile);
415 free(cs); 417 free(cs);
416 } 418 }
diff --git a/src/bin/e_randr2.h b/src/bin/e_randr2.h
index 5f9f0b371..70d27c092 100644
--- a/src/bin/e_randr2.h
+++ b/src/bin/e_randr2.h
@@ -120,6 +120,8 @@ struct _E_Config_Randr2_Screen
120 unsigned char enabled; 120 unsigned char enabled;
121 unsigned char ignore_disconnect; 121 unsigned char ignore_disconnect;
122 122
123 const char *custom_label_screen; // name of the screen device attached
124
123 const char *profile; 125 const char *profile;
124 double scale_multiplier; 126 double scale_multiplier;
125}; 127};
diff --git a/src/modules/conf_randr/e_int_config_randr2.c b/src/modules/conf_randr/e_int_config_randr2.c
index e33eefe4f..9f2163b41 100644
--- a/src/modules/conf_randr/e_int_config_randr2.c
+++ b/src/modules/conf_randr/e_int_config_randr2.c
@@ -120,6 +120,7 @@ _free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
120 { 120 {
121 eina_stringshare_del(cs->id); 121 eina_stringshare_del(cs->id);
122 eina_stringshare_del(cs->rel_to); 122 eina_stringshare_del(cs->rel_to);
123 eina_stringshare_del(cs->custom_label_screen);
123 eina_stringshare_del(cs->profile); 124 eina_stringshare_del(cs->profile);
124 free(cs); 125 free(cs);
125 } 126 }
@@ -364,11 +365,15 @@ _basic_screen_info_fill(E_Config_Dialog_Data *cfdata, E_Config_Randr2_Screen *cs
364 Elm_Object_Item *it, *it_sel; 365 Elm_Object_Item *it, *it_sel;
365 Elm_Widget_Item *iwt; 366 Elm_Widget_Item *iwt;
366 void *dt; 367 void *dt;
368 const char *info_screen = "";
367 369
368 if (!s) return; 370 if (!s) return;
369 // fill all the screen status info 371 // fill all the screen status info
372 info_screen = s->info.screen;
373 if ((cs->custom_label_screen) && (cs->custom_label_screen[0])) info_screen = cs->custom_label_screen;
374 printf("RRR: [%s] [%s]", s->info.name, info_screen);
370 elm_object_text_set(cfdata->name_obj, s->info.name); 375 elm_object_text_set(cfdata->name_obj, s->info.name);
371 elm_object_text_set(cfdata->screen_obj, s->info.screen); 376 elm_object_text_set(cfdata->screen_obj, info_screen);
372 elm_check_state_set(cfdata->lid_obj, s->info.is_lid); 377 elm_check_state_set(cfdata->lid_obj, s->info.is_lid);
373 elm_check_state_set(cfdata->backlight_obj, s->info.backlight); 378 elm_check_state_set(cfdata->backlight_obj, s->info.backlight);
374 snprintf(buf, sizeof(buf), "%imm x %imm", s->info.size.w, s->info.size.h); 379 snprintf(buf, sizeof(buf), "%imm x %imm", s->info.size.w, s->info.size.h);
@@ -761,6 +766,18 @@ _cb_enabled_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
761} 766}
762 767
763static void 768static void
769_cb_label_screen_edited(void *data, Evas_Object *obj, void *event EINA_UNUSED)
770{
771 E_Config_Dialog_Data *cfdata = data;
772 E_Config_Randr2_Screen *cs = _config_screen_find(cfdata);
773 const char *str = elm_object_text_get(obj);
774 if (!cs) return;
775 printf("RR: change screen [%s]\n", str);
776 eina_stringshare_replace(&(cs->custom_label_screen), str);
777 e_config_dialog_changed_set(cfdata->cfd, EINA_TRUE);
778}
779
780static void
764_cb_ignore_disconnect_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED) 781_cb_ignore_disconnect_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
765{ 782{
766 E_Config_Dialog_Data *cfdata = data; 783 E_Config_Dialog_Data *cfdata = data;
@@ -876,7 +893,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas EINA_UNUSED, E_Config_Dialog_Data
876 893
877 if (s->info.connected) 894 if (s->info.connected)
878 { 895 {
879 E_Config_Randr2_Screen *cs; 896 E_Config_Randr2_Screen *cs, *cs2;
880 897
881 cs = calloc(1, sizeof(E_Config_Randr2_Screen)); 898 cs = calloc(1, sizeof(E_Config_Randr2_Screen));
882 if (cs) 899 if (cs)
@@ -896,6 +913,12 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas EINA_UNUSED, E_Config_Dialog_Data
896 cs->ignore_disconnect = s->config.ignore_disconnect; 913 cs->ignore_disconnect = s->config.ignore_disconnect;
897 if (s->config.profile) 914 if (s->config.profile)
898 cs->profile = eina_stringshare_add(s->config.profile); 915 cs->profile = eina_stringshare_add(s->config.profile);
916 if (e_randr2_cfg)
917 {
918 cs2 = e_randr2_config_screen_find(s, e_randr2_cfg);
919 if ((cs2) && (cs2->custom_label_screen) && (cs2->custom_label_screen[0]))
920 cs->custom_label_screen = eina_stringshare_add(cs2->custom_label_screen);
921 }
899 cs->scale_multiplier = s->config.scale_multiplier; 922 cs->scale_multiplier = s->config.scale_multiplier;
900 cfdata->screens = eina_list_append(cfdata->screens, cs); 923 cfdata->screens = eina_list_append(cfdata->screens, cs);
901 it = elm_hoversel_item_add(o, s->info.name, 924 it = elm_hoversel_item_add(o, s->info.name,
@@ -956,6 +979,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas EINA_UNUSED, E_Config_Dialog_Data
956 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); 979 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
957 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); 980 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
958 elm_table_pack(tb, o, 0, 2, 1, 1); 981 elm_table_pack(tb, o, 0, 2, 1, 1);
982 evas_object_smart_callback_add(o, "changed,user", _cb_label_screen_edited, cfdata);
959 evas_object_show(o); 983 evas_object_show(o);
960 cfdata->screen_obj = o; 984 cfdata->screen_obj = o;
961 985
@@ -1233,6 +1257,9 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
1233 cs->rotation = cs2->rotation; 1257 cs->rotation = cs2->rotation;
1234 cs->priority = cs2->priority; 1258 cs->priority = cs2->priority;
1235 cs->rel_mode = cs2->rel_mode; 1259 cs->rel_mode = cs2->rel_mode;
1260 if (cs->custom_label_screen) eina_stringshare_del(cs->custom_label_screen);
1261 cs->custom_label_screen = NULL;
1262 if (cs2->custom_label_screen) cs->custom_label_screen = eina_stringshare_add(cs2->custom_label_screen);
1236 if (cs->profile) eina_stringshare_del(cs->profile); 1263 if (cs->profile) eina_stringshare_del(cs->profile);
1237 cs->profile = NULL; 1264 cs->profile = NULL;
1238 if (cs2->profile) cs->profile = eina_stringshare_add(cs2->profile); 1265 if (cs2->profile) cs->profile = eina_stringshare_add(cs2->profile);