Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_container.c e_init.c e_xinerama.c e_xinerama.h
Log Message:
centralised xinerama code - now we can put intellligent selection (partly
there) and manual selection into 1 place.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_container.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- e_container.c 16 Feb 2005 11:23:56 -0000 1.29
+++ e_container.c 7 Mar 2005 09:56:48 -0000 1.30
@@ -44,7 +44,7 @@
E_Zone *zone;
Evas_Object *o;
char name[40];
- int i, n;
+ Evas_List *l, *screens;
con = E_OBJECT_ALLOC(E_Container, E_CONTAINER_TYPE, _e_container_free);
if (!con) return NULL;
@@ -82,36 +82,14 @@
snprintf(name, sizeof(name), "Container %d", con->num);
con->name = strdup(name);
- n = ecore_x_xinerama_screen_count_get();
- if (n == 0)
- zone = e_zone_new(con, 0, 0, 0, con->w, con->h);
- else
+ screens = (Evas_List *)e_xinerama_screens_get();
+ for (l = screens; l; l = l->next)
{
- for (i = 0; i < n; i++)
- {
- int zx, zy, zw, zh;
- int skip;
- Evas_List *l;
-
- if (ecore_x_xinerama_screen_geometry_get(i, &zx, &zy, &zw, &zh))
- {
- skip = 0;
- for (l = con->zones; l; l = l->next)
- {
- zone = l->data;
- if (E_INTERSECTS(zone->x, zone->y, zone->w, zone->h,
- zx, zy, zw, zh))
- {
- skip = 1;
- break;
- }
- }
- if (!skip)
- zone = e_zone_new(con, i, zx, zy, zw, zh);
- }
- }
+ E_Screen *scr;
+
+ scr = l->data;
+ zone = e_zone_new(con, scr->screen, scr->x, scr->y, scr->w, scr->h);
}
-
con->gadman = e_gadman_new(con);
return con;
@@ -468,43 +446,35 @@
_e_container_resize_handle(E_Container *con)
{
E_Event_Container_Resize *ev;
- Evas_List *l;
- int n, i;
+ Evas_List *l, *screens;
ev = calloc(1, sizeof(E_Event_Container_Resize));
ev->container = con;
- /* FIXME: Handle resizing of zones if container is resized */
- n = ecore_x_xinerama_screen_count_get();
- if (n == 0)
+
+ e_xinerama_update();
+
+ screens = (Evas_List *)e_xinerama_screens_get();
+ for (l = screens; l; l = l->next)
{
- if (con->zones)
+ E_Screen *scr;
+ E_Zone *zone;
+
+ scr = l->data;
+ zone = e_container_zone_number_get(con, scr->screen);
+ if (zone)
{
- E_Zone *zone;
-
- zone = con->zones->data;
- e_zone_move(zone, 0, 0);
- e_zone_resize(zone, con->w, con->h);
+ e_zone_move(zone, scr->x, scr->y);
+ e_zone_resize(zone, scr->w, scr->h);
}
- }
- else
- {
- for (i = 0; i < n; i++)
+ else
{
- int zx, zy, zw, zh;
-
- if (ecore_x_xinerama_screen_geometry_get(i, &zx, &zy, &zw, &zh))
- {
- E_Zone *zone;
-
- zone = e_container_zone_number_get(con, i);
- if (zone)
- {
- e_zone_move(zone, zx, zy);
- e_zone_resize(zone, zw, zh);
- }
- }
+ zone = e_zone_new(con, scr->screen, scr->x, scr->y, scr->w,
scr->h);
}
+ /* FIXME: what if a zone exists for a screen that doesn't exist?
+ * not sure this will ever happen...
+ */
}
+
e_gadman_container_resize(con->gadman);
e_object_ref(E_OBJECT(con));
ecore_event_add(E_EVENT_CONTAINER_RESIZE, ev,
_e_container_event_container_resize_free, NULL);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_init.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_init.c 28 Feb 2005 05:34:58 -0000 1.8
+++ e_init.c 7 Mar 2005 09:56:49 -0000 1.9
@@ -25,7 +25,7 @@
Ecore_X_Window *roots;
int num;
Evas_Object *o;
- int n;
+ Evas_List *l, *screens;
num = 0;
roots = ecore_x_window_root_list(&num);
@@ -50,60 +50,36 @@
ecore_evas_raise(_e_init_ecore_evas);
ecore_evas_show(_e_init_ecore_evas);
- n = ecore_x_xinerama_screen_count_get();
- if (n == 0)
+ screens = (Evas_List *)e_xinerama_screens_get();
+ for (l = screens; l; l = l->next)
{
- o = edje_object_add(_e_init_evas);
- edje_object_file_set(o,
- /* FIXME: "init.eet" needs to come from config */
- e_path_find(path_init, "init.eet"),
- "init/splash");
- evas_object_move(o, 0, 0);
- evas_object_resize(o, w, h);
- evas_object_show(o);
- _e_init_object = o;
- }
- else
- {
- int i;
- int mx, my, mw, mh;
+ E_Screen *scr;
- for (i = 0; i < n; i++)
+ scr = l->data;
+ /* first screen */
+ if (l == screens)
+ {
+ o = edje_object_add(_e_init_evas);
+ edje_object_file_set(o,
+ /* FIXME: "init.eet" needs to come from
config */
+ e_path_find(path_init, "init.eet"),
+ "init/splash");
+ evas_object_move(o, scr->x, scr->y);
+ evas_object_resize(o, scr->w, scr->h);
+ evas_object_show(o);
+ _e_init_object = o;
+ }
+ /* other screens */
+ else
{
- ecore_x_xinerama_screen_geometry_get(i, &x, &y, &w, &h);
- if (i == 0)
- {
- /* Remeber the size and placement of the first window */
- mx = x;
- my = y;
- mw = w;
- mh = h;
- /* Init splash */
- o = edje_object_add(_e_init_evas);
- edje_object_file_set(o,
- /* FIXME: "init.eet" needs to come from
config */
- e_path_find(path_init, "init.eet"),
- "init/splash");
- evas_object_move(o, x, y);
- evas_object_resize(o, w, h);
- evas_object_show(o);
- _e_init_object = o;
- }
- /* Only add extra screen if it doesn't overlap with the main
screen */
- /* FIXME: What if extra screens overlap? Maybe zones should be
- * initialized before we come here? */
- else if (!E_INTERSECTS(x, y, w, h,
- mx, my, mw, mh))
- {
- o = edje_object_add(_e_init_evas);
- edje_object_file_set(o,
- /* FIXME: "init.eet" needs to come from
config */
- e_path_find(path_init, "init.eet"),
- "init/extra_screen");
- evas_object_move(o, x, y);
- evas_object_resize(o, w, h);
- evas_object_show(o);
- }
+ o = edje_object_add(_e_init_evas);
+ edje_object_file_set(o,
+ /* FIXME: "init.eet" needs to come from
config */
+ e_path_find(path_init, "init.eet"),
+ "init/extra_screen");
+ evas_object_move(o, scr->x, scr->y);
+ evas_object_resize(o, scr->w, scr->h);
+ evas_object_show(o);
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_xinerama.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_xinerama.c 7 Mar 2005 07:27:52 -0000 1.1
+++ e_xinerama.c 7 Mar 2005 09:56:49 -0000 1.2
@@ -23,6 +23,26 @@
return 1;
}
+void
+e_xinerama_update(void)
+{
+ _e_xinerama_clean();
+ _e_xinerama_update();
+}
+
+const Evas_List *
+e_xinerama_screens_get(void)
+{
+ return chosen_screens;
+}
+
+const Evas_List *
+e_xinerama_screens_all_get(void)
+{
+ return all_screens;
+}
+
+/* local subsystem functions */
static void
_e_xinerama_clean(void)
{
@@ -33,7 +53,6 @@
}
while (chosen_screens)
{
- free(chosen_screens->data);
chosen_screens = evas_list_remove_list(chosen_screens, chosen_screens);
}
}
@@ -41,14 +60,17 @@
static void
_e_xinerama_update(void)
{
- int i, n;
- Ecore_X_Window root, *roots;
+ int n;
+ Ecore_X_Window *roots;
+ Evas_List *l;
_e_xinerama_clean();
roots = ecore_x_window_root_list(&n);
if (roots)
{
+ int i;
int rw, rh;
+ Ecore_X_Window root;
/* more than 1 root window - xinerama wont be active */
if (n > 1)
@@ -101,4 +123,51 @@
}
}
/* now go through all_screens... and build a list of chosen screens */
+ for (l = all_screens; l; l = l->next)
+ {
+ Evas_List *ll;
+ E_Screen *scr;
+ int add = 0;
+ Evas_List *removes;
+
+ scr = l->data;
+ add = 1;
+ removes = NULL;
+ /* does this screen intersect with any we have chosen? */
+ for (ll = chosen_screens; ll; ll = ll->next)
+ {
+ E_Screen *scr2;
+
+ scr2 = ll->data;
+ /* if they intersect */
+ if (E_INTERSECTS(scr->x, scr->y, scr->w, scr->h,
+ scr2->x, scr2->y, scr2->w, scr2->h))
+ {
+ int sz, sz2;
+
+ /* calculate pixel area */
+ sz = scr->w * scr->h;
+ sz2 = scr2->w * scr2->h;
+ /* if the one we already have is bigger, DONT add the new */
+ if (sz2 > sz)
+ add = 0;
+ /* add the old to a list to remove */
+ else
+ removes = evas_list_append(removes, scr);
+ }
+ }
+ /* if there are screens to remove - remove them */
+ while (removes)
+ {
+ chosen_screens = evas_list_remove(chosen_screens, removes->data);
+ removes = evas_list_remove_list(removes, removes);
+ }
+ /* if this screen is to be added, add it */
+ if (add)
+ {
+ printf("E17 INIT: XINERAMA CHOSEN: [%i], %ix%i+%i+%i\n",
+ scr->screen, scr->w, scr->h, scr->x, scr->y);
+ chosen_screens = evas_list_append(chosen_screens, scr);
+ }
+ }
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_xinerama.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_xinerama.h 7 Mar 2005 07:27:52 -0000 1.1
+++ e_xinerama.h 7 Mar 2005 09:56:49 -0000 1.2
@@ -15,8 +15,11 @@
int x, y, w, h;
};
-EAPI int e_xinerama_init(void);
-EAPI int e_xinerama_shutdown(void);
-
+EAPI int e_xinerama_init(void);
+EAPI int e_xinerama_shutdown(void);
+EAPI void e_xinerama_update(void);
+EAPI const Evas_List *e_xinerama_screens_get(void);
+EAPI const Evas_List *e_xinerama_screens_all_get(void);
+
#endif
#endif
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs