Hi,

There is a TODO item about problems with shelf configs and dual head. The problem is that shelf config does not have a permanent id.

This patch fixes this, but it also makes the id of gadcons an int, which will ruin the current gadcon setup. Not a big problem for users to fix.

If noone objects, I will commit.

Sebastian
Index: TODO
===================================================================
RCS file: /cvs/e/e17/apps/e/TODO,v
retrieving revision 1.554
diff -u -r1.554 TODO
--- TODO	13 Aug 2007 00:21:00 -0000	1.554
+++ TODO	16 Sep 2007 13:44:37 -0000
@@ -23,9 +23,6 @@
   trap on the region the shelf would normally be in. also need a way to lock
   the gadcon and thus gadcon asks shelf to lock in (stay visible) for things
   like popping up menus, popups etc.
-* shelves seem to get confused with their contents if you have 3 shelves over
-  2 screens/zones - when you go back to 1 screen form 2, one of the shelves
-  gts the contents from the now non-existant shelf.
 * gkrellm options to "dont show in pager or taskber" only work if gkrellem is
   moved to one monitor and back again - doesn't seem to work on e boot/start
   if it is started at e start time
@@ -33,8 +30,6 @@
   instead of in a straight line
 * exebuf on other zones doesn't allow mouse to work properly (only
   zone/screen 0 works properly)
-* Need global unique identifier for gadcons, so that their config will move
-  with them from one shelf to another.
 ]]]
 
 [[[
Index: src/bin/e_config.c
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_config.c,v
retrieving revision 1.271
diff -u -r1.271 e_config.c
--- src/bin/e_config.c	16 Sep 2007 00:02:52 -0000	1.271
+++ src/bin/e_config.c	16 Sep 2007 13:44:40 -0000
@@ -107,7 +107,7 @@
 #define T E_Config_Gadcon
 #define D _e_config_gadcon_edd
    E_CONFIG_VAL(D, T, name, STR);
-   E_CONFIG_VAL(D, T, id, STR);
+   E_CONFIG_VAL(D, T, id, INT);
    E_CONFIG_LIST(D, T, clients, _e_config_gadcon_client_edd);
 
    _e_config_shelf_desk_edd = E_CONFIG_DD_NEW("E_Config_Shelf_Desk", E_Config_Shelf_Desk);
@@ -124,6 +124,7 @@
 #define T E_Config_Shelf
 #define D _e_config_shelf_edd
    E_CONFIG_VAL(D, T, name, STR);
+   E_CONFIG_VAL(D, T, id, INT);
    E_CONFIG_VAL(D, T, container, INT);
    E_CONFIG_VAL(D, T, zone, INT);
    E_CONFIG_VAL(D, T, layer, INT);
@@ -1231,10 +1232,12 @@
    e_config->gadcons = NULL;
      {
 	E_Config_Shelf *cf_es;
+	int             id = 0;
 	
 #define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size, _overlap, _autohide, _autohide_show_action, _hide_timeout, _hide_duration, _desk_show_mode, _desk_list) \
    cf_es = E_NEW(E_Config_Shelf, 1); \
    cf_es->name = evas_stringshare_add(_name); \
+   cf_es->id = ++id; \
    cf_es->container = _con; \
    cf_es->zone = _zone; \
    cf_es->popup = _pop; \
@@ -1252,20 +1255,9 @@
    cf_es->desk_show_mode = _desk_show_mode; \
    cf_es->desk_list = evas_list_append(cf_es->desk_list, cf_es); \
    e_config->shelves = evas_list_append(e_config->shelves, cf_es)
-	/* shelves for 4 zones on head 0 by default */
 	CFG_SHELF("shelf", 0, 0,
 		  1, 200, E_GADCON_ORIENT_BOTTOM,
 		  1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
-	CFG_SHELF("shelf", 0, 1,
-		  1, 200, E_GADCON_ORIENT_BOTTOM,
-		  1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
-	CFG_SHELF("shelf", 0, 2,
-		  1, 200, E_GADCON_ORIENT_BOTTOM,
-		  1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
-	CFG_SHELF("shelf", 0, 3,
-		  1, 200, E_GADCON_ORIENT_BOTTOM,
-		  1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
-	/* shelves for heada 1, 2, and 3 by default */
 	CFG_SHELF("shelf", 1, 0,
 		  1, 200, E_GADCON_ORIENT_BOTTOM,
 		  1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
@@ -1346,16 +1338,17 @@
    e_config->desklock_custom_desklock_cmd = NULL;     
    IFCFGEND;
 
-   IFCFG(0x0107); /* the version # where this value(s) was introduced */
+   IFCFG(0x0121);
      {
-	E_Config_Gadcon *cf_gc;
+	E_Config_Gadcon        *cf_gc;
 	E_Config_Gadcon_Client *cf_gcc;
+	int                     id = 0;
 
 	e_config->gadcons = NULL;
-#define CFG_GADCON(_name, _id) \
+#define CFG_GADCON(_name) \
    cf_gc = E_NEW(E_Config_Gadcon, 1);\
    cf_gc->name = evas_stringshare_add(_name); \
-   cf_gc->id = evas_stringshare_add(_id); \
+   cf_gc->id = ++id; \
    e_config->gadcons = evas_list_append(e_config->gadcons, cf_gc)
 #define CFG_GADCON_CLIENT(_name, _res, _size, _pos, _style, _autoscr, _resizable) \
    cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); \
@@ -1373,7 +1366,7 @@
    cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc)
 
 	/* the default shelf on the default head/zone */
-	CFG_GADCON("shelf", "0");
+	CFG_GADCON("shelf");
 	CFG_GADCON_CLIENT("start", 800, 32,
 			  0, NULL, 0, 0);
 	CFG_GADCON_CLIENT("pager", 800, 120,
@@ -1391,19 +1384,19 @@
 	CFG_GADCON_CLIENT("clock", 800, 32,
 			  800 - 32, NULL, 0, 0);
 	/* additional shelves for up to 3 more heads by default */
-	CFG_GADCON("shelf", "1");
+	CFG_GADCON("shelf");
 	CFG_GADCON_CLIENT("pager", 800, 120,
 			  0, NULL, 0, 0);
 	CFG_GADCON_CLIENT("ibox", 800, 32,
 			  800 - 32, NULL, 0, 0);
 	
-	CFG_GADCON("shelf", "2");
+	CFG_GADCON("shelf");
 	CFG_GADCON_CLIENT("pager", 800, 120,
 			  0, NULL, 0, 0);
 	CFG_GADCON_CLIENT("ibox", 800, 32,
 			  800 - 32, NULL, 0, 0);
 	
-	CFG_GADCON("shelf", "3");
+	CFG_GADCON("shelf");
 	CFG_GADCON_CLIENT("pager", 800, 120,
 			  0, NULL, 0, 0);
 	CFG_GADCON_CLIENT("ibox", 800, 32,
Index: src/bin/e_config.h
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_config.h,v
retrieving revision 1.162
diff -u -r1.162 e_config.h
--- src/bin/e_config.h	4 Sep 2007 23:59:01 -0000	1.162
+++ src/bin/e_config.h	16 Sep 2007 13:44:40 -0000
@@ -55,7 +55,7 @@
 /* increment this whenever a new set of config values are added but the users
  * config doesn't need to be wiped - simply new values need to be put in
  */
-#define E_CONFIG_FILE_GENERATION 0x0120
+#define E_CONFIG_FILE_GENERATION 0x0121
 #define E_CONFIG_FILE_VERSION    ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
 
 #define E_EVAS_ENGINE_DEFAULT      0
@@ -378,7 +378,7 @@
 struct _E_Config_Gadcon
 {
    const char *name;
-   const char *id;
+   int         id;
    Evas_List  *clients;
 };
 
@@ -400,6 +400,7 @@
 struct _E_Config_Shelf
 {
    const char   *name;
+   int           id;
    int           container, zone;
    int           layer;
    unsigned char popup;
Index: src/bin/e_gadcon.c
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_gadcon.c,v
retrieving revision 1.82
diff -u -r1.82 e_gadcon.c
--- src/bin/e_gadcon.c	16 Sep 2007 00:24:42 -0000	1.82
+++ src/bin/e_gadcon.c	16 Sep 2007 13:44:43 -0000
@@ -237,7 +237,7 @@
 }
 
 EAPI E_Gadcon *
-e_gadcon_swallowed_new(const char *name, const char *id, Evas_Object *obj, char *swallow_name)
+e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, char *swallow_name)
 {
    E_Gadcon    *gc;
    Evas_List   *l;
@@ -248,7 +248,7 @@
    if (!gc) return NULL;
  
    gc->name = evas_stringshare_add(name);
-   gc->id = evas_stringshare_add(id);
+   gc->id = id;
    gc->layout_policy = E_GADCON_LAYOUT_POLICY_PANEL;
    
    gc->edje.o_parent = obj;
@@ -282,7 +282,7 @@
 
 	cf_gc = l->data;
 	if ((!strcmp(cf_gc->name, gc->name)) &&
-	    (!strcmp(cf_gc->id, gc->id)))
+	    (cf_gc->id == gc->id))
 	  {
 	     gc->cf = cf_gc;
 	     break;
@@ -292,7 +292,7 @@
      {
 	gc->cf = E_NEW(E_Config_Gadcon, 1);
 	gc->cf->name = evas_stringshare_add(gc->name);
-	gc->cf->id = evas_stringshare_add(gc->id);
+	gc->cf->id = gc->id;
 	e_config->gadcons = evas_list_append(e_config->gadcons, gc->cf);
 	e_config_save_queue();
      }
@@ -1332,7 +1332,6 @@
    gadcons = evas_list_remove(gadcons, gc);
    if (gc->o_container) evas_object_del(gc->o_container);
    evas_stringshare_del(gc->name);
-   evas_stringshare_del(gc->id);
    evas_stringshare_del(gc->edje.swallow_name);
    if (gc->config_dialog) e_object_del(E_OBJECT(gc->config_dialog));
    if (gc->drop_handler) e_drop_handler_del(gc->drop_handler);
Index: src/bin/e_gadcon.h
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_gadcon.h,v
retrieving revision 1.40
diff -u -r1.40 e_gadcon.h
--- src/bin/e_gadcon.h	16 Sep 2007 00:02:52 -0000	1.40
+++ src/bin/e_gadcon.h	16 Sep 2007 13:44:43 -0000
@@ -50,7 +50,7 @@
    E_Object             e_obj_inherit;
 
    const char          *name;
-   const char          *id;
+   int                  id;
    
    E_Gadcon_Layout_Policy layout_policy;
    
@@ -171,7 +171,7 @@
 EAPI void             e_gadcon_provider_register(const E_Gadcon_Client_Class *cc);
 EAPI void             e_gadcon_provider_unregister(const E_Gadcon_Client_Class *cc);
 EAPI Evas_List       *e_gadcon_provider_list(void);
-EAPI E_Gadcon        *e_gadcon_swallowed_new(const char *name, const char *id, Evas_Object *obj, char *swallow_name);
+EAPI E_Gadcon        *e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, char *swallow_name);
 EAPI void             e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
 EAPI void             e_gadcon_min_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data);
 EAPI void             e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data);
Index: src/bin/e_int_shelf_config.c
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_shelf_config.c,v
retrieving revision 1.32
diff -u -r1.32 e_int_shelf_config.c
--- src/bin/e_int_shelf_config.c	14 Sep 2007 23:28:58 -0000	1.32
+++ src/bin/e_int_shelf_config.c	16 Sep 2007 13:44:44 -0000
@@ -224,7 +224,6 @@
 _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
    E_Zone *zone;
-   int id;
 
    switch (cfdata->mode)
      {
@@ -276,13 +275,13 @@
    cfdata->size = cfdata->basic_size;
    
    zone = cfdata->es->zone;
-   id = cfdata->es->id;
    cfdata->es->config_dialog = NULL;
    e_object_del(E_OBJECT(cfdata->es));
    cfdata->es = e_shelf_zone_new(zone, cfdata->escfg->name, 
 				 cfdata->escfg->style,
 				 cfdata->escfg->popup,
-				 cfdata->escfg->layer, id);
+				 cfdata->escfg->layer,
+				 cfdata->escfg->id);
    cfdata->es->cfg = cfdata->escfg;
    cfdata->es->fit_along = cfdata->escfg->fit_along;
    cfdata->es->fit_size = cfdata->escfg->fit_size;
@@ -300,7 +299,7 @@
 _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) 
 {
    E_Zone *zone;
-   int id, idx;
+   int idx;
    int restart = 0;
 
    /* Only change style is we need to */
@@ -430,14 +429,14 @@
    if (restart) 
      {
 	zone = cfdata->es->zone;
-	id = cfdata->es->id;
 	cfdata->es->config_dialog = NULL;
 	e_object_del(E_OBJECT(cfdata->es));
 	
 	cfdata->es = e_shelf_zone_new(zone, cfdata->escfg->name, 
 				      cfdata->escfg->style,
 				      cfdata->escfg->popup,
-				      cfdata->escfg->layer, id);
+				      cfdata->escfg->layer,
+				      cfdata->escfg->id);
 	cfdata->es->cfg = cfdata->escfg;
 	cfdata->es->fit_along = cfdata->escfg->fit_along;
 	cfdata->es->fit_size = cfdata->escfg->fit_size;
Index: src/bin/e_shelf.c
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_shelf.c,v
retrieving revision 1.70
diff -u -r1.70 e_shelf.c
--- src/bin/e_shelf.c	4 Sep 2007 23:59:01 -0000	1.70
+++ src/bin/e_shelf.c	16 Sep 2007 13:44:44 -0000
@@ -54,6 +54,7 @@
 e_shelf_config_init(void)
 {
    Evas_List *l;
+   int id = 0;
 
    while (shelves)
      {
@@ -69,13 +70,15 @@
 	E_Zone *zone;
 	
 	cf_es = l->data;
+	if (cf_es->id <= 0) cf_es->id = id + 1;
 	zone = e_util_container_zone_number_get(cf_es->container, cf_es->zone);
+	id = cf_es->id;
 	if (zone)
 	  {
 	     E_Shelf *es;
-	     
+
 	     es = e_shelf_zone_new(zone, cf_es->name, cf_es->style,
-				   cf_es->popup, cf_es->layer, -1);
+				   cf_es->popup, cf_es->layer, cf_es->id);
 	     if (es)
 	       {
 		  if (!cf_es->hide_timeout) cf_es->hide_timeout = 1.0; 
@@ -132,6 +135,7 @@
    
    es = E_OBJECT_ALLOC(E_Shelf, E_SHELF_TYPE, _e_shelf_free);
    if (!es) return NULL;
+   es->id = id;
 
    es->x = 0;
    es->y = 0;
@@ -192,13 +196,8 @@
 	evas_object_layer_set(es->o_event, layer);
 	evas_object_layer_set(es->o_base, layer);
      }
-   if (id < 0)
-     es->id = evas_list_count(shelves);
-   else
-     es->id = id;
 
-   snprintf(buf, sizeof(buf), "%i", es->id);
-   es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "e.swallow.content");
+   es->gadcon = e_gadcon_swallowed_new(es->name, es->id, es->o_base, "e.swallow.content");
    e_gadcon_min_size_request_callback_set(es->gadcon,
 					  _e_shelf_gadcon_min_size_request, es);
 
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to