Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_xinerama.c 


Log Message:


fix xinerama detection to handle bad xinerama info and ignore overlapping
"subset" regions and re-order xinerama screens to skip bad ones and order
them from biggest to smallest.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_xinerama.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- e_xinerama.c        7 Jan 2006 10:39:45 -0000       1.7
+++ e_xinerama.c        16 Oct 2007 15:34:07 -0000      1.8
@@ -5,6 +5,7 @@
 
 static void _e_xinerama_clean(void);
 static void _e_xinerama_update(void);
+static int _e_xinerama_cb_screen_sort(void *data1, void *data2);
 
 static Evas_List *all_screens = NULL;
 static Evas_List *chosen_screens = NULL;
@@ -85,6 +86,7 @@
    int n;
    Ecore_X_Window *roots;
    Evas_List *l;
+   int sorted;
    
    roots = ecore_x_window_root_list(&n);
    if (roots)
@@ -170,11 +172,11 @@
                  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;
+                 if (sz > sz2)
+                   removes = evas_list_append(removes, scr2);
                  /* add the old to a list to remove */
                  else
-                   removes = evas_list_append(removes, scr);
+                   add = 0;
               }
          }
        /* if there are screens to remove - remove them */
@@ -185,10 +187,31 @@
          }
        /* 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);
-         }
+         chosen_screens = evas_list_append(chosen_screens, scr);
+     }
+   chosen_screens = evas_list_sort(chosen_screens,
+                                  evas_list_count(chosen_screens),
+                                  _e_xinerama_cb_screen_sort);
+   for (n = 0, l = chosen_screens; l; l = l->next, n++)
+     {
+        E_Screen *scr;
+       
+       scr = l->data;
+       printf("E17 INIT: XINERAMA CHOSEN: [%i], %ix%i+%i+%i\n",
+              scr->screen, scr->w, scr->h, scr->x, scr->y);
+       scr->screen = n;
      }
+}
+
+static int
+_e_xinerama_cb_screen_sort(void *data1, void *data2)
+{
+   E_Screen *scr, *scr2;
+   int dif;
+   
+   scr = data1;
+   scr2 = data2;
+   dif = (scr2->w * scr2->h) - (scr->w * scr->h);
+   if (dif == 0) return scr->screen - scr2->screen;
+   return dif;
 }



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to