So the edge bindings have once again ticked me off.  So much so that
I've made the attached patch to correct it's flaws.  I tried to keep
as much of the mechanisms the same even though I don't exactly like how
it's done right now.

Anyway, the patch fixes a couple of things.

First it will hide any of the edge windows if that edge is not being
used.  It is pointless to have the entire 1px border of the screen
unusable when I have no edge bindings.

Second it fixes the behavior of the fullscreen option.  Previously the
edges were set above all windows, even fullscreen.  The only difference
with the option set was that events would be ignored, but the edge
window was still in the way stealing events.  It is much better to
actually layer things properly so that when a fullscreen app is active,
the edge windows are layered below it and thus do not get in the way at
all and don't even have to ignore the events because they never happen.

Patch attached.  I would just commit it, but I know I was met with
resistance for some reason the last time I brought these issues up.
Index: src/bin/e_bindings.c
===================================================================
--- src/bin/e_bindings.c	(revision 42093)
+++ src/bin/e_bindings.c	(working copy)
@@ -414,7 +414,12 @@
 e_bindings_edge_add(E_Binding_Context ctxt, E_Zone_Edge edge, E_Binding_Modifier mod, int any_mod, const char *action, const char *params, float delay)
 {
    E_Binding_Edge *bind;
-   
+   Eina_List *l, *ll, *lll;
+   Eina_List *mans, *cons;
+   E_Manager *man;
+   E_Container *con;
+   E_Zone *zone;
+
    bind = calloc(1, sizeof(E_Binding_Edge));
    bind->ctxt = ctxt;
    bind->edge = edge;
@@ -424,6 +429,44 @@
    if (action) bind->action = eina_stringshare_add(action);
    if (params) bind->params = eina_stringshare_add(params);
    edge_bindings = eina_list_append(edge_bindings, bind);
+
+   /* Update all zones to show the edge */
+   EINA_LIST_FOREACH(e_manager_list(), l, man)
+     {
+	EINA_LIST_FOREACH(man->containers, ll, con)
+	  {
+	     EINA_LIST_FOREACH(con->zones, lll, zone)
+	       {
+		  switch(edge)
+		    {
+		     case E_ZONE_EDGE_LEFT:
+		       ecore_x_window_show(zone->edge.left);
+		       break;
+		     case E_ZONE_EDGE_TOP:
+		       ecore_x_window_show(zone->edge.top);
+		       break;
+		     case E_ZONE_EDGE_RIGHT:
+		       ecore_x_window_show(zone->edge.right);
+		       break;
+		     case E_ZONE_EDGE_BOTTOM:
+		       ecore_x_window_show(zone->edge.bottom);
+		       break;
+		     case E_ZONE_EDGE_TOP_LEFT:
+		       ecore_x_window_show(zone->corner.top_left);
+		       break;
+		     case E_ZONE_EDGE_TOP_RIGHT:
+		       ecore_x_window_show(zone->corner.top_right);
+		       break;
+		     case E_ZONE_EDGE_BOTTOM_RIGHT:
+		       ecore_x_window_show(zone->corner.bottom_right);
+		       break;
+		     case E_ZONE_EDGE_BOTTOM_LEFT:
+		       ecore_x_window_show(zone->corner.bottom_left);
+		       break;
+		    }
+	       }
+	  }
+     }
 }
 
 EAPI E_Binding_Edge *
@@ -445,25 +488,74 @@
 e_bindings_edge_del(E_Binding_Context ctxt, E_Zone_Edge edge, E_Binding_Modifier mod, int any_mod, const char *action, const char *params, float delay)
 {
    E_Binding_Edge *bind;
-   Eina_List *l;
+   Eina_List *l, *ll, *lll;
+   Eina_List *mans, *cons;
+   E_Manager *man;
+   E_Container *con;
+   E_Zone *zone;
+   int ref_count = 0;
 
    EINA_LIST_FOREACH(edge_bindings, l, bind)
      {
-	if ((bind->ctxt == ctxt) &&
-	    (bind->edge == edge) &&
-	    (bind->mod == mod) &&
-	    ((bind->delay * 1000) == (delay * 1000)) &&
-	    (bind->any_mod == any_mod) &&
-	    (((bind->action) && (action) && (!strcmp(bind->action, action))) ||
-	     ((!bind->action) && (!action))) &&
-	    (((bind->params) && (params) && (!strcmp(bind->params, params))) ||
-	     ((!bind->params) && (!params))))
+	if ((bind->edge == edge))
 	  {
-	     _e_bindings_edge_free(bind);
-	     edge_bindings = eina_list_remove_list(edge_bindings, l);
-	     break;
+	     if ((bind->ctxt == ctxt) &&
+		 (bind->mod == mod) &&
+		 ((bind->delay * 1000) == (delay * 1000)) &&
+		 (bind->any_mod == any_mod) &&
+		 (((bind->action) && (action) && (!strcmp(bind->action, action))) ||
+		   ((!bind->action) && (!action))) &&
+		 (((bind->params) && (params) && (!strcmp(bind->params, params))) ||
+		   ((!bind->params) && (!params))))
+	       {
+		  _e_bindings_edge_free(bind);
+		  edge_bindings = eina_list_remove_list(edge_bindings, l);
+	       }
+	     else
+	       ref_count++;
 	  }
      }
+
+   /* Hide edge/corner in all zones if no more bindings exist */
+   if(!ref_count)
+     {
+        EINA_LIST_FOREACH(e_manager_list(), l, man)
+	  {
+	     EINA_LIST_FOREACH(man->containers, ll, con)
+	       {
+		  EINA_LIST_FOREACH(con->zones, lll, zone)
+		    {
+		       switch(edge)
+			 {
+			  case E_ZONE_EDGE_LEFT:
+			    ecore_x_window_hide(zone->edge.left);
+			    break;
+			  case E_ZONE_EDGE_TOP:
+			    ecore_x_window_hide(zone->edge.top);
+			    break;
+			  case E_ZONE_EDGE_RIGHT:
+			    ecore_x_window_hide(zone->edge.right);
+			    break;
+			  case E_ZONE_EDGE_BOTTOM:
+			    ecore_x_window_hide(zone->edge.bottom);
+			    break;
+			  case E_ZONE_EDGE_TOP_LEFT:
+			    ecore_x_window_hide(zone->corner.top_left);
+			    break;
+			  case E_ZONE_EDGE_TOP_RIGHT:
+			    ecore_x_window_hide(zone->corner.top_right);
+			    break;
+			  case E_ZONE_EDGE_BOTTOM_RIGHT:
+			    ecore_x_window_hide(zone->corner.bottom_right);
+			    break;
+			  case E_ZONE_EDGE_BOTTOM_LEFT:
+			    ecore_x_window_hide(zone->corner.bottom_left);
+			    break;
+			 }
+		    }
+	       }
+	  }
+     }
 }
 
 EAPI E_Action *
@@ -473,8 +565,12 @@
    E_Binding_Edge *bind;
    E_Desk *current = NULL;
    E_Action *act = NULL;
-   Eina_List *l;
-   
+   Eina_List *l, *ll, *lll;
+   Eina_List *mans, *cons;
+   E_Manager *man;
+   E_Container *con;
+   E_Zone *zone;
+
    current = e_desk_at_xy_get(ev->zone, ev->zone->desk_x_current, ev->zone->desk_y_current);
    if (current->fullscreen_borders && (!e_config->fullscreen_flip)) return NULL;
 
Index: src/bin/e_zone.c
===================================================================
--- src/bin/e_zone.c	(revision 42093)
+++ src/bin/e_zone.c	(working copy)
@@ -65,6 +65,7 @@
    Evas_Object *o;
    E_Event_Zone_Add *ev;
    int cw, ch;
+   int layer;
 
    zone = E_OBJECT_ALLOC(E_Zone, E_ZONE_TYPE, _e_zone_free);
    if (!zone) return NULL;
@@ -110,32 +111,24 @@
    zone->corner.bottom_left = ecore_x_window_input_new(con->win,
 	 zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1);
 
-   e_container_window_raise(zone->container, zone->corner.left_bottom, 999);
-   e_container_window_raise(zone->container, zone->corner.left_top, 999);
-   e_container_window_raise(zone->container, zone->corner.top_left, 999);
-   e_container_window_raise(zone->container, zone->corner.top_right, 999);
-   e_container_window_raise(zone->container, zone->corner.right_top, 999);
-   e_container_window_raise(zone->container, zone->corner.right_bottom, 999);
-   e_container_window_raise(zone->container, zone->corner.bottom_right, 999);
-   e_container_window_raise(zone->container, zone->corner.bottom_left, 999);
+   if(e_config->fullscreen_flip)
+     layer = 250;
+   else
+     layer = 200;
 
-   e_container_window_raise(zone->container, zone->edge.left, 999);
-   e_container_window_raise(zone->container, zone->edge.right, 999);
-   e_container_window_raise(zone->container, zone->edge.top, 999);
-   e_container_window_raise(zone->container, zone->edge.bottom, 999);
+   e_container_window_raise(zone->container, zone->corner.left_bottom, layer);
+   e_container_window_raise(zone->container, zone->corner.left_top, layer);
+   e_container_window_raise(zone->container, zone->corner.top_left, layer);
+   e_container_window_raise(zone->container, zone->corner.top_right, layer);
+   e_container_window_raise(zone->container, zone->corner.right_top, layer);
+   e_container_window_raise(zone->container, zone->corner.right_bottom, layer);
+   e_container_window_raise(zone->container, zone->corner.bottom_right, layer);
+   e_container_window_raise(zone->container, zone->corner.bottom_left, layer);
 
-   ecore_x_window_show(zone->edge.left);
-   ecore_x_window_show(zone->edge.right);
-   ecore_x_window_show(zone->edge.top);
-   ecore_x_window_show(zone->edge.bottom);
-   ecore_x_window_show(zone->corner.left_bottom);
-   ecore_x_window_show(zone->corner.left_top);
-   ecore_x_window_show(zone->corner.top_left);
-   ecore_x_window_show(zone->corner.top_right);
-   ecore_x_window_show(zone->corner.right_top);
-   ecore_x_window_show(zone->corner.right_bottom);
-   ecore_x_window_show(zone->corner.bottom_right);
-   ecore_x_window_show(zone->corner.bottom_left);
+   e_container_window_raise(zone->container, zone->edge.left, layer);
+   e_container_window_raise(zone->container, zone->edge.right, layer);
+   e_container_window_raise(zone->container, zone->edge.top, layer);
+   e_container_window_raise(zone->container, zone->edge.bottom, layer);
 
    zone->handlers = 
      eina_list_append(zone->handlers,
Index: src/modules/conf_edgebindings/e_int_config_edgebindings.c
===================================================================
--- src/modules/conf_edgebindings/e_int_config_edgebindings.c	(revision 42093)
+++ src/modules/conf_edgebindings/e_int_config_edgebindings.c	(working copy)
@@ -180,8 +180,13 @@
 static int
 _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
-   Eina_List *l = NULL;
+   Eina_List *l, *ll, *lll;
+   Eina_List *mans, *cons;
+   E_Manager *man;
+   E_Container *con;
+   E_Zone *zone;
    E_Config_Binding_Edge *bi, *bi2;
+   int layer;
 
    _auto_apply_changes(cfdata);
 
@@ -215,6 +220,35 @@
      }
    e_config->fullscreen_flip = cfdata->fullscreen_flip;
 
+   if(cfdata->fullscreen_flip)
+     layer = 250;
+   else
+     layer = 200;
+
+   /* Update layers for all existing edges */
+   EINA_LIST_FOREACH(e_manager_list(), l, man)
+   {
+      EINA_LIST_FOREACH(man->containers, ll, con)
+	{
+	   EINA_LIST_FOREACH(con->zones, lll, zone)
+	     {
+		e_container_window_raise(zone->container, zone->corner.left_bottom, layer);
+		e_container_window_raise(zone->container, zone->corner.left_top, layer);
+		e_container_window_raise(zone->container, zone->corner.top_left, layer);
+		e_container_window_raise(zone->container, zone->corner.top_right, layer);
+		e_container_window_raise(zone->container, zone->corner.right_top, layer);
+		e_container_window_raise(zone->container, zone->corner.right_bottom, layer);
+		e_container_window_raise(zone->container, zone->corner.bottom_right, layer);
+		e_container_window_raise(zone->container, zone->corner.bottom_left, layer);
+
+		e_container_window_raise(zone->container, zone->edge.left, layer);
+		e_container_window_raise(zone->container, zone->edge.right, layer);
+		e_container_window_raise(zone->container, zone->edge.top, layer);
+		e_container_window_raise(zone->container, zone->edge.bottom, layer);
+	     }
+	}
+   }
+
    e_config_save_queue();
 
    return 1;
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to