patches for some cleanups...
authorCarsten Haitzler <raster@rasterman.com>
Mon, 7 Mar 2005 07:27:52 +0000 (07:27 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Mon, 7 Mar 2005 07:27:52 +0000 (07:27 +0000)
and i'm moving xinerama handling to 1 central place to fixup bugs in xinerama
detection. its not complete.

SVN revision: 13643

TODO
src/bin/Makefile.am
src/bin/e_includes.h
src/bin/e_main.c
src/bin/e_xinerama.c [new file with mode: 0644]
src/bin/e_xinerama.h [new file with mode: 0644]

diff --git a/TODO b/TODO
index 808e8ab..136522e 100644 (file)
--- a/TODO
+++ b/TODO
@@ -29,6 +29,7 @@ Current freeze issues are:
 
 ISSUES:
 
+* borders raise/lower stack doesnt modify any list to track stacking
 * consoldiate client lists - we have client lists for containers, zones, desks AND e_borders.c consolidate into 1 list that has all borders with their stacking and what desk they belong to (and thus zone and container)
 * focus newly created windows when appropriate (under mouse and focus follows mouse etc.)
 * focus issues in general
index a789310..6d4c383 100644 (file)
@@ -41,7 +41,8 @@ e_startup.h \
 e_iconify.h \
 e_hints.h \
 e_gadman.h \
-e_signals.h
+e_signals.h \
+e_xinerama.h
 
 
 enlightenment_SOURCES = \
@@ -77,6 +78,7 @@ e_iconify.c \
 e_hints.c \
 e_gadman.c \
 e_signals.c \
+e_xinerama.c \
 $(ENLIGHTENMENTHEADERS)
 
 enlightenment_LDFLAGS = -export-dynamic @e_libs@ @dlopen_libs@
index 6eade67..8862bbb 100644 (file)
@@ -32,3 +32,4 @@
 #include "e_hints.h"
 #include "e_gadman.h"
 #include "e_signals.h"
+#include "e_xinerama.h"
index 756dbaf..aa77bc7 100644 (file)
@@ -256,9 +256,15 @@ main(int argc, char **argv)
    else
      _e_main_shutdown_push(_e_main_ipc_shutdown);
 
-   /* setup module loading etc. FIXME: check return value */
-   e_module_init();
-
+   /* setup module loading etc */
+   if (!e_module_init())
+     {
+       e_error_message_show("Enlightenment cannot set up its module system.");
+       _e_main_shutdown(-1);
+     }
+   _e_main_shutdown_push(e_module_shutdown);
+   
+   /* setup iconification */
    if (!e_iconify_init())
      {
        e_error_message_show("Enlightenment cannot setup its iconify system.");
@@ -289,7 +295,7 @@ main(int argc, char **argv)
    /* add in a handler that just before we go idle we flush x */
    _e_main_idle_enterer_flusher = ecore_idle_enterer_add(_e_main_cb_x_flusher, NULL);
       
-   /* an intle enterer to be called after all others */
+   /* an idle enterer to be called after all others */
    _e_main_idle_enterer_after = ecore_idle_enterer_add(_e_main_cb_idler_after, NULL);
 
    ecore_x_ungrab();
@@ -323,7 +329,6 @@ main(int argc, char **argv)
    /* NB: no need to do this as config shutdown will flush any saves */
    /*     and all changed config was already saved before */
    e_config_save_flush();
-   e_module_shutdown();
 
    /* unroll our stack of shutdown functions with exit code of 0 */
    _e_main_shutdown(0);
@@ -340,7 +345,7 @@ main(int argc, char **argv)
    return 0;
 }
 
-/* FIXME: make save to deleet within a callback */
+/* FIXME: make save to delete within a callback */
 E_Before_Idler *
 e_main_idler_before_add(int (*func) (void *data), void *data, int once)
 {
@@ -457,7 +462,7 @@ _e_main_dirs_init(void)
    /* err dont just disable it - replace it with a proper wizard tool */
    /* outside e's main source to populate these directories from gnome/kde */
    /* app menu data etc. */
-   snprintf(buf, sizeof(buf), "%s/.e/e/applications/all/eterm.eapp", homedir);
+   snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/.order", homedir);
    if (!ecore_file_exists(buf))
      {
        printf("GETTING YOU STARTED!\n");
@@ -485,6 +490,7 @@ _e_main_screens_init(void)
    Ecore_X_Window *roots;
    int num, i;
 
+   if (!e_xinerama_init()) return 0;
    if (!e_atoms_init()) return 0;
    if (!e_manager_init()) return 0;
    if (!e_container_init()) return 0;
@@ -530,69 +536,6 @@ _e_main_screens_init(void)
                                  i);
             return 0;
          }
-       /* FIXME
-        * This should be removed!
-         {
-            E_Gadman_Client *gmc;
-            
-            gmc = e_gadman_client_new(con->gadman);
-            gmc->x = 0;
-            gmc->y = 300;
-            gmc->w = 100;
-            gmc->h = 100;
-            e_gadman_client_policy_set(gmc, 
-//                                     E_GADMAN_POLICY_EDGES | 
-                                       E_GADMAN_POLICY_ANYWHERE |
-                                       E_GADMAN_POLICY_HMOVE | 
-                                       E_GADMAN_POLICY_VMOVE |
-                                       E_GADMAN_POLICY_HSIZE | 
-                                       E_GADMAN_POLICY_VSIZE);
-            e_gadman_client_min_size_set(gmc, 20, 20);
-            e_gadman_client_auto_size_set(gmc, 50, 200);
-            e_gadman_client_align_set(gmc, 0.0, 0.5);
-            e_client_gadman_edge_set(gmc, E_GADMAN_EDGE_LEFT);
-            e_gadman_client_domain_set(gmc, "test", 0);
-            e_gadman_client_load(gmc);
-
-            gmc = e_gadman_client_new(con->gadman);
-            gmc->x = 0;
-            gmc->y = 400;
-            gmc->w = 100;
-            gmc->h = 100;
-            e_gadman_client_policy_set(gmc, 
-//                                     E_GADMAN_POLICY_EDGES | 
-                                       E_GADMAN_POLICY_ANYWHERE |
-                                       E_GADMAN_POLICY_HMOVE | 
-                                       E_GADMAN_POLICY_VMOVE |
-                                       E_GADMAN_POLICY_HSIZE | 
-                                       E_GADMAN_POLICY_VSIZE);
-            e_gadman_client_min_size_set(gmc, 20, 20);
-            e_gadman_client_auto_size_set(gmc, 50, 200);
-            e_gadman_client_align_set(gmc, 0.0, 0.5);
-            e_client_gadman_edge_set(gmc, E_GADMAN_EDGE_LEFT);
-            e_gadman_client_domain_set(gmc, "test", 1);
-            e_gadman_client_load(gmc);
-
-            gmc = e_gadman_client_new(con->gadman);
-            gmc->x = 0;
-            gmc->y = 500;
-            gmc->w = 100;
-            gmc->h = 100;
-            e_gadman_client_policy_set(gmc, 
-//                                     E_GADMAN_POLICY_EDGES | 
-                                       E_GADMAN_POLICY_ANYWHERE |
-                                       E_GADMAN_POLICY_HMOVE | 
-                                       E_GADMAN_POLICY_VMOVE |
-                                       E_GADMAN_POLICY_HSIZE | 
-                                       E_GADMAN_POLICY_VSIZE);
-            e_gadman_client_min_size_set(gmc, 20, 20);
-            e_gadman_client_auto_size_set(gmc, 50, 200);
-            e_gadman_client_align_set(gmc, 0.0, 0.5);
-            e_client_gadman_edge_set(gmc, E_GADMAN_EDGE_LEFT);
-            e_gadman_client_domain_set(gmc, "test", 2);
-            e_gadman_client_load(gmc);
-         }
-        */
      }
    free(roots);
    ecore_x_sync();
@@ -611,6 +554,7 @@ _e_main_screens_shutdown(void)
    e_container_shutdown();
    e_manager_shutdown();
    e_atoms_shutdown();
+   e_xinerama_shutdown();
    return 1;
 }
 
@@ -813,4 +757,3 @@ _e_main_cb_startup_fake_end(void *data)
    e_init_hide();
    return 0;
 }
-
diff --git a/src/bin/e_xinerama.c b/src/bin/e_xinerama.c
new file mode 100644 (file)
index 0000000..f77b15e
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#include "e.h"
+
+static void _e_xinerama_clean(void);
+static void _e_xinerama_update(void);
+
+static Evas_List *all_screens = NULL;
+static Evas_List *chosen_screens = NULL;
+
+int
+e_xinerama_init(void)
+{
+   _e_xinerama_update();
+   return 1;
+}
+
+int
+e_xinerama_shutdown(void)
+{
+   _e_xinerama_clean();
+   return 1;
+}
+
+static void
+_e_xinerama_clean(void)
+{
+   while (all_screens)
+     {
+       free(all_screens->data);
+       all_screens = evas_list_remove_list(all_screens, all_screens);
+     }
+   while (chosen_screens)
+     {
+       free(chosen_screens->data);
+       chosen_screens = evas_list_remove_list(chosen_screens, chosen_screens);
+     }
+}
+
+static void
+_e_xinerama_update(void)
+{
+   int i, n;
+   Ecore_X_Window root, *roots;
+   
+   _e_xinerama_clean();
+   roots = ecore_x_window_root_list(&n);
+   if (roots)
+     {
+       int rw, rh;
+       
+       /* more than 1 root window - xinerama wont be active */
+       if (n > 1)
+         {
+            free(roots);
+            return;
+         }
+       /* first (and only) root window */
+       root = roots[0];
+       free(roots);
+       /* get root size */
+       ecore_x_window_size_get(root, &rw, &rh);
+       /* get number of xinerama screens */
+       n = ecore_x_xinerama_screen_count_get();
+       if (n < 1)
+         {
+            E_Screen *scr;
+            
+            scr = calloc(1, sizeof(E_Screen));
+            scr->screen = 0;
+            scr->x = 0;
+            scr->y = 0;
+            scr->w = rw;
+            scr->h = rh;
+            all_screens = evas_list_append(all_screens, scr);
+         }
+       else
+         {
+            for (i = 0; i < n; i++)
+              {
+                 int x, y, w, h;
+                 
+                 /* get each xinerama screen geometry */
+                 if (ecore_x_xinerama_screen_geometry_get(i, &x, &y, &w, &h))
+                   {
+                      E_Screen *scr;
+                      
+                      printf("E17 INIT: XINERAMA SCREEN: [%i], %ix%i+%i+%i\n",
+                             i, w, h, x, y);
+                      /* add it to our list */
+                      scr = calloc(1, sizeof(E_Screen));
+                      scr->screen = i;
+                      scr->x = x;
+                      scr->y = y;
+                      scr->w = w;
+                      scr->h = h;
+                      all_screens = evas_list_append(all_screens, scr);
+                   }
+              }
+         }
+     }
+   /* now go through all_screens... and build a list of chosen screens */
+}
diff --git a/src/bin/e_xinerama.h b/src/bin/e_xinerama.h
new file mode 100644 (file)
index 0000000..066d443
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#ifdef E_TYPEDEFS
+
+typedef struct _E_Screen E_Screen;
+
+#else
+#ifndef E_XINERAMA_H
+#define E_XINERAMA_H
+
+struct _E_Screen
+{
+   int screen;
+   int x, y, w, h;
+};
+
+EAPI int          e_xinerama_init(void);
+EAPI int          e_xinerama_shutdown(void);
+
+#endif
+#endif