XFree86 XCursor sample support. No change with a default install, but if you grab...
authorsleuth <sleuth>
Sat, 8 Mar 2003 12:51:06 +0000 (12:51 +0000)
committersleuth <sleuth@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 8 Mar 2003 12:51:06 +0000 (12:51 +0000)
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 <cobra@compuserve.com>

SVN revision: 6751

17 files changed:
AUTHORS
autogen.sh
data/config/behavior/default/behavior.db
data/cursors/Close.db
data/cursors/Default.db
data/cursors/Iconify.db
data/cursors/Max_Size.db
data/cursors/Menu.db
data/cursors/Resize.db
data/cursors/Resize_Horizontal.db
data/cursors/Resize_Vertical.db
data/cursors/Title_Bar.db
src/config.c
src/config.h
src/cursors.c
src/menu.c
src/text.c

diff --git a/AUTHORS b/AUTHORS
index b54297b..1f5301d 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -3,3 +3,4 @@ Christian Kreibich <cK@whoop.org>
 Burra <burra@colorado.edu>
 Graham MacDonald <macdonag@lineone.net>
 Alan Schmitt <alan.schmitt@inria.fr>
+Kevin Brosius <cobra@compuserve.com>
index 6dbed50..40363f3 100755 (executable)
@@ -130,3 +130,7 @@ ln -sf selected-0.sticky-0.shaded-0.bits.db selected-1.sticky-0.shaded-1.bits.db
 ln -sf selected-0.sticky-0.shaded-0.bits.db selected-1.sticky-1.shaded-1.bits.db
 ln -sf selected-0.sticky-0.shaded-0.bits.db selected-0.sticky-1.shaded-1.bits.db
 cd ..
+
+cd fonts
+ln -sf borzoib.ttf menu.ttf
+ln -sf borzoib.ttf text.ttf
index aeb15ca..6775c14 100644 (file)
Binary files a/data/config/behavior/default/behavior.db and b/data/config/behavior/default/behavior.db differ
index 3a061f7..74d03f8 100644 (file)
Binary files a/data/cursors/Close.db and b/data/cursors/Close.db differ
index 19c66ee..57ff1a4 100644 (file)
Binary files a/data/cursors/Default.db and b/data/cursors/Default.db differ
index 633c66e..71d80d2 100644 (file)
Binary files a/data/cursors/Iconify.db and b/data/cursors/Iconify.db differ
index beffdd1..9d1c214 100644 (file)
Binary files a/data/cursors/Max_Size.db and b/data/cursors/Max_Size.db differ
index 7388946..b84f742 100644 (file)
Binary files a/data/cursors/Menu.db and b/data/cursors/Menu.db differ
index 4316e22..20a6fcc 100644 (file)
Binary files a/data/cursors/Resize.db and b/data/cursors/Resize.db differ
index 62be05f..573ac17 100644 (file)
Binary files a/data/cursors/Resize_Horizontal.db and b/data/cursors/Resize_Horizontal.db differ
index f2ad2f1..b13faa3 100644 (file)
Binary files a/data/cursors/Resize_Vertical.db and b/data/cursors/Resize_Vertical.db differ
index 11775f9..9bde4d4 100644 (file)
Binary files a/data/cursors/Title_Bar.db and b/data/cursors/Title_Bar.db differ
index 92488ad..16a0e63 100644 (file)
@@ -151,6 +151,8 @@ e_config_desktops_init()
               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
index 519e2d5..f5d5bda 100644 (file)
@@ -17,6 +17,7 @@ struct _E_Config_Desktops
    int                 speed;
    int                 width;
    int                 height;
+   int                 e_native_cursors;
 };
 
 typedef struct _E_Config_Guides E_Config_Guides;
index 6266e27..690652f 100644 (file)
@@ -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 @@ struct _e_cursor
    char               *type;
    Cursor              cursor;
    time_t              mod;
+   int                 x_cursor_id;
 };
 
 static int          cursor_change = 0;
@@ -120,8 +126,62 @@ e_cursors_display_in_window(Window win, char *type)
        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 @@ e_cursors_display_in_window(Window win, char *type)
             FREE(c);
             c = NULL;
          }
+
+
+             }
+           /* end native cursors */
+
+
        if (c)
          {
             c->cursor =
@@ -236,9 +302,24 @@ e_cursors_display_in_window(Window win, char *type)
             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"))
index 0df4ddf..1d79937 100644 (file)
@@ -1531,7 +1531,7 @@ e_menu_item_realize(E_Menu * m, E_Menu_Item * mi)
        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);
index df737cb..d8ae459 100644 (file)
@@ -22,23 +22,23 @@ e_text_new(Evas * evas, char *text, char *class)
       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);