some work on contact...
authorCarsten Haitzler <raster@rasterman.com>
Sun, 17 Feb 2013 14:45:00 +0000 (14:45 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Sun, 17 Feb 2013 14:45:00 +0000 (14:45 +0000)
SVN revision: 84024

src/modules/contact/e_mod_main.c
src/modules/contact/e_policy.c
src/modules/contact/e_policy.h

index bdad7e4..186e34c 100644 (file)
@@ -7,6 +7,30 @@ _cb_in_left(void *data, int d, double v)
 {
    // show PREV window in list from urrent focused window on top of current
    // window but in an inital "off to the right" state in comp
+   Eina_List *borders = (Eina_List *)e_policy_borders_get();
+   E_Border *bd_active = (E_Border *)e_polict_border_active_get();
+   E_Border *bd = NULL;
+   Eina_List *bd_active_l = NULL;
+   if (!bd_active)
+     {
+        if (!borders) return;
+        bd = eina_list_last(borders)->data;
+     }
+   if (!bd)
+     {
+        if (bd_active)
+          bd_active_l = eina_list_data_find_list(borders, bd_active);
+        if ((bd_active_l) && (bd_active_l->prev)) bd = bd_active_l->prev->data;
+     }
+   if ((!bd) && (bd_active))
+     {
+        e_border_iconify(bd_active);
+        return;
+     }
+   if (!bd) return;
+   e_border_uniconify(bd);
+   e_border_raise(bd);
+   e_border_show(bd);
 }
 
 static void
@@ -21,6 +45,30 @@ _cb_in_right(void *data, int d, double v)
 {
    // show NEXT window in list from urrent focused window on top of current
    // window but in an inital "off to the right" state in comp
+   Eina_List *borders = (Eina_List *)e_policy_borders_get();
+   E_Border *bd_active = (E_Border *)e_polict_border_active_get();
+   E_Border *bd = NULL;
+   Eina_List *bd_active_l = NULL;
+   if (!bd_active)
+     {
+        if (!borders) return;
+        bd = borders->data;
+     }
+   if (!bd)
+     {
+        if (bd_active)
+          bd_active_l = eina_list_data_find_list(borders, bd_active);
+        if ((bd_active_l) && (bd_active_l->next)) bd = bd_active_l->next->data;
+     }
+   if ((!bd) && (bd_active))
+     {
+        e_border_iconify(bd_active);
+        return;
+     }
+   if (!bd) return;
+   e_border_uniconify(bd);
+   e_border_raise(bd);
+   e_border_show(bd);
 }
 
 static void
index c5dd4b3..f4c40d0 100644 (file)
@@ -1,5 +1,7 @@
 #include "e_mod_main.h"
 
+static Eina_Bool _cb_event_add(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _cb_event_del(void *data __UNUSED__, int type __UNUSED__, void *event);
 static Eina_Bool _cb_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
 static Eina_Bool _cb_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
 static void _cb_hook_post_fetch(void *data __UNUSED__, void *data2);
@@ -9,8 +11,10 @@ static void _cb_hook_layout(void *data __UNUSED__, void *data2);
 static Eina_List *hooks = NULL;
 static Eina_List *handlers = NULL;
 
-static Eina_Bool kbd_on = EINA_FALSE;
-static Eina_Bool kbd_override = EINA_FALSE;
+static Eina_Bool  kbd_on = EINA_FALSE;
+static Eina_Bool  kbd_override = EINA_FALSE;
+static Eina_List *borders = NULL;
+static E_Border  *bd_active = NULL;
 
 #define LADD(l, f) l = eina_list_append(l, f)
 
@@ -23,6 +27,10 @@ e_policy_init(void)
                                  _cb_hook_post_assign, NULL));
    LADD(hooks, e_border_hook_add(E_BORDER_HOOK_CONTAINER_LAYOUT,
                                  _cb_hook_layout, NULL));
+   LADD(handlers, ecore_event_handler_add(E_EVENT_BORDER_ADD,
+                                          _cb_event_add, NULL));
+   LADD(handlers, ecore_event_handler_add(E_EVENT_BORDER_REMOVE,
+                                          _cb_event_del, NULL));
    LADD(handlers, ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN,
                                           _cb_event_focus_in, NULL));
    LADD(handlers, ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT,
@@ -63,19 +71,57 @@ e_policy_kbd_override_set(Eina_Bool override)
      }
 }
 
+const Eina_List *
+e_policy_borders_get(void)
+{
+   return borders;
+}
+
+const E_Border *
+e_polict_border_active_get(void)
+{
+   return bd_active;
+}
+
+static Eina_Bool
+_cb_event_add(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+   E_Event_Border_Add *ev = event;
+   E_Border *bd = ev->border;
+   
+   if (bd_active) borders = eina_list_append_relative(borders, bd, bd_active);
+   else borders = eina_list_prepend(borders, bd);
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_cb_event_del(void *data __UNUSED__, int type __UNUSED__, void *event)
+{
+   E_Event_Border_Remove *ev = event;
+   E_Border *bd = ev->border;
+   
+   borders = eina_list_remove(borders, bd);
+   if (bd_active == bd) bd_active = NULL;
+   return ECORE_CALLBACK_PASS_ON;
+}
+
 static Eina_Bool
 _cb_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
 {
-   E_Border *bd = event;
+   E_Event_Border_Focus_In *ev = event;
+   E_Border *bd = ev->border;
    
+   bd_active = bd;
    return ECORE_CALLBACK_PASS_ON;
 }
 
 static Eina_Bool
 _cb_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
 {
-   E_Border *bd = event;
+   E_Event_Border_Focus_Out *ev = event;
+   E_Border *bd = ev->border;
 
+   if (bd_active == bd) bd_active = NULL;
    if (kbd_on) e_policy_kbd_override_set(EINA_FALSE);
    return ECORE_CALLBACK_PASS_ON;
 }
index 44df36a..6c98fca 100644 (file)
@@ -4,5 +4,7 @@
 void e_policy_init(void);
 void e_policy_shutdown(void);
 void e_policy_kbd_override_set(Eina_Bool override);
+const Eina_List *e_policy_borders_get(void);
+const E_Border *e_polict_border_active_get(void);
 
 #endif