Loop managers & containers when looking for the proper zone.
authorChristopher Michael <cpmichael1@comcast.net>
Thu, 14 Jan 2010 20:10:11 +0000 (20:10 +0000)
committerChristopher Michael <cpmichael1@comcast.net>
Thu, 14 Jan 2010 20:10:11 +0000 (20:10 +0000)
Some re-org/cleanup during init.

SVN revision: 45124

src/modules/illume2/e_mod_layout.c
src/modules/illume2/e_mod_main.c

index 2a58509..4caa21f 100644 (file)
@@ -435,49 +435,51 @@ _e_mod_layout_cb_client_message(void *data, int type, void *event)
    else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_MODE) 
      {
         E_Border *bd;
+        E_Manager *man;
         E_Container *con;
         E_Zone *zone;
-        Eina_List *l;
+        Eina_List *l, *ll, *lll;
         int lock = 1;
 
-        con = e_container_current_get(e_manager_current_get());
-        EINA_LIST_FOREACH(con->zones, l, zone) 
-          {
-             if (zone->black_win == ev->win) 
-               {
-                  E_Illume_Config_Zone *cz;
-
-                  cz = e_illume_zone_config_get(zone->id);
-                  if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
-                    cz->mode.dual = 0;
-                  else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP) 
-                    {
-                       if (e_illume_border_valid_count_get(zone) < 2)
-                         ecore_x_e_illume_home_send(zone->black_win);
-                       cz->mode.dual = 1;
-                       cz->mode.side = 0;
-                       lock = 0;
-                    }
-                  else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT) 
-                    {
-                       if (e_illume_border_valid_count_get(zone) < 2)
-                         ecore_x_e_illume_home_send(zone->black_win);
-                       cz->mode.dual = 1;
-                       cz->mode.side = 1;
-                    }
-                  else
-                    cz->mode.dual = 0;
-                  e_config_save_queue();
-
-                  bd = e_illume_border_top_shelf_get(zone);
-                  if (bd)
-                    ecore_x_e_illume_drag_locked_set(bd->client.win, lock);
-                  bd = e_illume_border_bottom_panel_get(zone);
-                  if (bd)
-                    ecore_x_e_illume_drag_locked_set(bd->client.win, lock);
-                  break;
-               }
-          }
+        EINA_LIST_FOREACH(e_manager_list(), lll, man) 
+          EINA_LIST_FOREACH(man->containers, ll, con) 
+            EINA_LIST_FOREACH(con->zones, l, zone) 
+              {
+                 if (zone->black_win == ev->win) 
+                   {
+                      E_Illume_Config_Zone *cz;
+
+                      cz = e_illume_zone_config_get(zone->id);
+                      if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE)
+                        cz->mode.dual = 0;
+                      else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP) 
+                        {
+                           if (e_illume_border_valid_count_get(zone) < 2)
+                             ecore_x_e_illume_home_send(zone->black_win);
+                           cz->mode.dual = 1;
+                           cz->mode.side = 0;
+                           lock = 0;
+                        }
+                      else if (ev->data.l[0] == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT) 
+                        {
+                           if (e_illume_border_valid_count_get(zone) < 2)
+                             ecore_x_e_illume_home_send(zone->black_win);
+                           cz->mode.dual = 1;
+                           cz->mode.side = 1;
+                        }
+                      else
+                        cz->mode.dual = 0;
+                      e_config_save_queue();
+
+                      bd = e_illume_border_top_shelf_get(zone);
+                      if (bd)
+                        ecore_x_e_illume_drag_locked_set(bd->client.win, lock);
+                      bd = e_illume_border_bottom_panel_get(zone);
+                      if (bd)
+                        ecore_x_e_illume_drag_locked_set(bd->client.win, lock);
+                      break;
+                   }
+              }
      }
    else if (ev->message_type == ECORE_X_ATOM_E_ILLUME_BACK) 
      {
index b74ef41..3003014 100644 (file)
@@ -19,6 +19,8 @@ e_modapi_init(E_Module *m)
    E_Container *con;
    E_Zone *zone;
    Eina_List *l, *ll, *lll;
+   Ecore_X_Window *zones = NULL;
+   unsigned int i = 0, zone_count = 0;
 
    /* setup eina logging */
    if (_e_illume_log_dom < 0) 
@@ -47,6 +49,18 @@ e_modapi_init(E_Module *m)
         return NULL;
      }
 
+   /* initialize the layout subsystem */
+   if (!e_mod_layout_init()) 
+     {
+        /* cleanup eina logging */
+        if (_e_illume_log_dom > 0) 
+          {
+             eina_log_domain_unregister(_e_illume_log_dom);
+             _e_illume_log_dom = -1;
+          }
+        return NULL;
+     }
+
    /* initialize the keyboard subsystem */
    e_kbd_init();
 
@@ -56,38 +70,46 @@ e_modapi_init(E_Module *m)
    /* initialize the quickpanel subsystem */
    e_quickpanel_init();
 
-   EINA_LIST_FOREACH(e_manager_list(), l, man) 
+   EINA_LIST_FOREACH(e_manager_list(), l, man)
+     EINA_LIST_FOREACH(man->containers, ll, con)
+       zone_count += eina_list_count(con->zones);
+
+   zones = calloc(zone_count, sizeof(Ecore_X_Window));
+   if (zone_count > 0) 
      {
-        EINA_LIST_FOREACH(man->containers, ll, con) 
+        EINA_LIST_FOREACH(e_manager_list(), l, man)
           {
-             EINA_LIST_FOREACH(con->zones, lll, zone) 
-               {
-                  E_Illume_Config_Zone *cz;
-                  E_Quickpanel *qp;
-
-                  /* create a new quickpanel */
-                  if (!(qp = e_quickpanel_new(zone))) continue;
-                  quickpanels = eina_list_append(quickpanels, qp);
-
-                  cz = e_illume_zone_config_get(zone->id);
-                  if (cz->mode.dual == 0) 
-                    ecore_x_e_illume_mode_set(zone->black_win, 
-                                              ECORE_X_ILLUME_MODE_SINGLE);
-                  else 
-                    {
-                       if (cz->mode.side == 0)
-                         ecore_x_e_illume_mode_set(zone->black_win, 
-                                                   ECORE_X_ILLUME_MODE_DUAL_TOP);
-                       else
-                         ecore_x_e_illume_mode_set(zone->black_win, 
-                                                   ECORE_X_ILLUME_MODE_DUAL_LEFT);
-                    }
-               }
+             i = 0;
+             EINA_LIST_FOREACH(man->containers, ll, con)
+               EINA_LIST_FOREACH(con->zones, lll, zone) 
+                 {
+                    Ecore_X_Illume_Mode mode;
+                    E_Illume_Config_Zone *cz;
+                    E_Quickpanel *qp;
+
+                    /* create a new quickpanel */
+                    if (!(qp = e_quickpanel_new(zone))) continue;
+                    quickpanels = eina_list_append(quickpanels, qp);
+
+                    cz = e_illume_zone_config_get(zone->id);
+                    if (cz->mode.dual == 0) 
+                      mode = ECORE_X_ILLUME_MODE_SINGLE;
+                    else 
+                      {
+                         if (cz->mode.side == 0)
+                           mode = ECORE_X_ILLUME_MODE_DUAL_TOP;
+                         else
+                           mode = ECORE_X_ILLUME_MODE_DUAL_LEFT;
+                      }
+                    ecore_x_e_illume_mode_set(zone->black_win, mode);
+                    ecore_x_e_illume_mode_send(zone->black_win, mode);
+                    zones[i++] = zone->black_win;
+                 }
+             if (i > 0) 
+               ecore_x_e_illume_zone_list_set(man->root, zones, i);
           }
      }
-
-   /* initialize the layout subsystem */
-   e_mod_layout_init();
+   E_FREE(zones);
 
    return m;
 }