Enlightenment CVS committal

Author  : sleuth
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src


Modified Files:
        config.c config.h cursors.c menu.c text.c 


Log Message:
XFree86 XCursor sample support.  No change with a default install, but if you grab the 
new behaviour.db and change /desktops/cursors/e_native to 0, then E will use your 
local XCursor setup.  Check out the edevel mailing list for a theme I've tried.  
XCursor support is only available in XFree86 4.3.0.

Also allow different fonts for borders vs. menus.  This adds links in 
/usr/local/share/enlightenment/fonts (default install) for a menu.ttf and a text.ttf 
file.  text.tff is the font used for border text/window titles.  menu.ttf will be used 
for menus.  No change by default, but you'll need to re-run autogen.sh & make install 
for the links to be created automatically.

Update AUTHORS

Kevin Brosius <[EMAIL PROTECTED]>

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/config.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- config.c    15 Jan 2003 18:29:55 -0000      1.33
+++ config.c    8 Mar 2003 12:51:06 -0000       1.34
@@ -151,6 +151,8 @@
               width, (E_Data_Value) 1);
    E_DATA_NODE(cfg_desktops, "height", E_DATA_TYPE_INT, NULL, E_Config_Desktops,
               height, (E_Data_Value) 1);
+   E_DATA_NODE(cfg_desktops, "cursors/e_native", E_DATA_TYPE_INT,
+              NULL, E_Config_Desktops, e_native_cursors, (E_Data_Value) 1);
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/config.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- config.h    15 Jan 2003 18:29:55 -0000      1.9
+++ config.h    8 Mar 2003 12:51:06 -0000       1.10
@@ -17,6 +17,7 @@
    int                 speed;
    int                 width;
    int                 height;
+   int                 e_native_cursors;
 };
 
 typedef struct _E_Config_Guides E_Config_Guides;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/cursors.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- cursors.c   15 Jan 2003 18:29:55 -0000      1.10
+++ cursors.c   8 Mar 2003 12:51:06 -0000       1.11
@@ -3,6 +3,11 @@
 #include "config.h"
 #include "util.h"
 #include "file.h"
+#include <X11/cursorfont.h>
+#if 0
+/* XCursor */
+#include <X11/Xcursor/Xcursor.h>
+#endif
 
 typedef struct _e_cursor E_Cursor;
 
@@ -11,6 +16,7 @@
    char               *type;
    Cursor              cursor;
    time_t              mod;
+   int                 x_cursor_id;
 };
 
 static int          cursor_change = 0;
@@ -120,8 +126,62 @@
        c->mod = e_file_mod_time(buf);
        E_DB_INT_GET(buf, "/cursor/x", hx, ok);
        E_DB_INT_GET(buf, "/cursor/y", hy, ok);
+       /* Handle x_cursor if available */
+       E_DB_INT_GET(buf, "/cursor/x_id", c->x_cursor_id, ok);  
+       if(!ok)
+         c->x_cursor_id = XC_arrow;
+
+       /* Some sample code to load XCursor data directly. */
+       /* This works, but shading and colorization is different */
+       /* than native XFree86 XCursors.  It appears the xcursorgen */
+       /* program does some preprocessing.  We could do the same. */
+#if 0
+       /* XCursor */
+       if(0)
+         {
+           Evas *ic_e;
+           Evas_Object *e_im;
+           int *idata;
+           int wid, hei;
+           XcursorImage * xcur;
+
+           snprintf(buf, PATH_MAX, "%s/%s.db",
+                    e_config_get("cursors"), type);
+
+           ic_e = e_evas_new_all(ecore_display_get(), 0,
+                                 0, 0, 200, 200, "");
+           e_im = evas_object_image_add(ic_e);
+           evas_object_image_file_set(e_im, buf, "/cursor/image");
+           idata = evas_object_image_data_get(e_im, 1);
+           evas_object_image_size_get(e_im, &wid, &hei);
+
+           /* Make sure width and height are sane, protect ourselves.*/
+           if(wid > 128) wid=128;
+           if(hei > 128) hei=128;
+           
+           xcur = XcursorImageCreate( wid, hei);
+           xcur->pixels = /*Xmalloc ? */(int *) malloc(wid * hei * 4);
+           if(!xcur->pixels)
+               D("Failed alloc!!!!!!!!!!\n");
+           memcpy(xcur->pixels, idata, wid*hei*4);
+           xcur->xhot = hx;
+           xcur->yhot = hy;
+
+           c->cursor = XcursorImageLoadCursor(ecore_display_get(), xcur);
+
+           evas_object_del(e_im);
+         }
+       else
+         {
+#endif
+
+           /* Only load images for native cursors */
+           if(config_data->desktops->e_native_cursors)
+             {
+
        snprintf(buf, PATH_MAX, "%s/%s.db:/cursor/image",
                 e_config_get("cursors"), type);
+
        im = imlib_load_image(buf);
        if (im)
          {
@@ -228,6 +288,12 @@
             FREE(c);
             c = NULL;
          }
+
+
+             }
+           /* end native cursors */
+
+
        if (c)
          {
             c->cursor =
@@ -236,9 +302,24 @@
             ecore_pixmap_free(mask);
             cursors = evas_list_append(cursors, c);
          }
+#if 0
+         } /* XCursor */
+#endif
      }
    if (c)
-      ecore_cursor_set(win, c->cursor);
+     {
+       /* If behavior.db has /desktops/cursors/native == 1, then use */
+       /* images installed */
+       /* by E, else use X cursors by cursorfont id. */
+       if(config_data->desktops->e_native_cursors)
+        ecore_cursor_set(win, c->cursor);
+       else
+        {
+          Cursor x_cursor;
+          x_cursor = XCreateFontCursor(ecore_display_get(), c->x_cursor_id);
+          ecore_cursor_set(win, x_cursor);
+        }
+     }
    else
      {
        if (!strcmp(type, "Default"))
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/menu.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- menu.c      15 Jan 2003 18:29:55 -0000      1.34
+++ menu.c      8 Mar 2003 12:51:06 -0000       1.35
@@ -1531,7 +1531,7 @@
        if (mi->str)
          {
             mi->obj_text = evas_object_text_add(m->evas);
-            evas_object_text_font_set(mi->obj_text, "borzoib", 8);
+            evas_object_text_font_set(mi->obj_text, "menu", 8);
             evas_object_text_text_set(mi->obj_text, mi->str);
             evas_object_color_set(mi->obj_text, 0, 0, 0, 255);
             evas_object_show(mi->obj_text);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/text.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- text.c      15 Jan 2003 18:29:56 -0000      1.10
+++ text.c      8 Mar 2003 12:51:06 -0000       1.11
@@ -22,23 +22,23 @@
       t->text = strdup("");
    t->evas = evas;
    t->obj.o1 = evas_object_text_add(t->evas);
-   evas_object_text_font_set(t->obj.o1, "borzoib", 8);
+   evas_object_text_font_set(t->obj.o1, "text", 8);
    evas_object_text_text_set(t->obj.o1, t->text);
 
    t->obj.o2 = evas_object_text_add(t->evas);
-   evas_object_text_font_set(t->obj.o2, "borzoib", 8);
+   evas_object_text_font_set(t->obj.o2, "text", 8);
    evas_object_text_text_set(t->obj.o2, t->text);
 
    t->obj.o3 = evas_object_text_add(t->evas);
-   evas_object_text_font_set(t->obj.o3, "borzoib", 8);
+   evas_object_text_font_set(t->obj.o3, "text", 8);
    evas_object_text_text_set(t->obj.o3, t->text);
 
    t->obj.o4 = evas_object_text_add(t->evas);
-   evas_object_text_font_set(t->obj.o4, "borzoib", 8);
+   evas_object_text_font_set(t->obj.o4, "text", 8);
    evas_object_text_text_set(t->obj.o4, t->text);
 
    t->obj.text = evas_object_text_add(t->evas);
-   evas_object_text_font_set(t->obj.text, "borzoib", 8);
+   evas_object_text_font_set(t->obj.text, "text", 8);
    evas_object_text_text_set(t->obj.text, t->text);
 
    evas_object_pass_events_set(t->obj.o1, 1);




-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to