1999-10-04 15:06:00 -07:00
|
|
|
/*
|
2007-01-13 11:14:29 -08:00
|
|
|
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
2008-03-22 07:51:24 -07:00
|
|
|
* Copyright (C) 2004-2008 Kim Woelders
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies of the Software, its documentation and marketing & publicity
|
|
|
|
* materials, and acknowledgment shall be given in the documentation, materials
|
|
|
|
* and software packages that this Software was used.
|
2000-04-05 16:22:56 -07:00
|
|
|
*
|
1999-10-04 15:06:00 -07:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
1999-08-17 15:56:46 -07:00
|
|
|
#include "E.h"
|
2004-12-28 15:46:49 -08:00
|
|
|
#include "conf.h"
|
2006-11-19 13:55:52 -08:00
|
|
|
#include "cursors.h"
|
2006-02-18 00:30:09 -08:00
|
|
|
#include "e16-ecore_list.h"
|
2005-07-16 09:57:45 -07:00
|
|
|
#include "emodule.h"
|
|
|
|
#include "xwin.h"
|
2008-09-29 09:39:49 -07:00
|
|
|
#include <X11/cursorfont.h>
|
2009-08-18 10:27:08 -07:00
|
|
|
#if USE_XRENDER
|
2008-09-29 09:39:49 -07:00
|
|
|
#include <X11/extensions/Xrender.h>
|
|
|
|
#endif
|
2004-07-15 09:46:06 -07:00
|
|
|
|
2008-03-23 04:54:24 -07:00
|
|
|
struct _ecursor {
|
2004-07-15 09:46:06 -07:00
|
|
|
char *name;
|
|
|
|
Cursor cursor;
|
|
|
|
unsigned int ref_count;
|
|
|
|
};
|
1999-08-17 15:56:46 -07:00
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
static Ecore_List *cursor_list = NULL;
|
|
|
|
|
2008-09-29 09:39:49 -07:00
|
|
|
static Cursor
|
|
|
|
ECreatePixmapCursor(Pixmap cpmap, Pixmap cmask, unsigned int w, unsigned int h,
|
2009-09-13 06:45:34 -07:00
|
|
|
int xh, int yh, unsigned int fg, unsigned int bg)
|
2008-09-29 09:39:49 -07:00
|
|
|
{
|
|
|
|
Cursor curs;
|
|
|
|
|
2009-08-18 10:27:08 -07:00
|
|
|
#if USE_XRENDER
|
2008-09-29 09:39:49 -07:00
|
|
|
/* Assuming we have XRenderCreateCursor (render >= 0.5) */
|
|
|
|
Pixmap pmap;
|
|
|
|
XGCValues gcv;
|
|
|
|
GC gc;
|
|
|
|
Picture pict;
|
|
|
|
XRenderPictFormat *pictfmt;
|
|
|
|
|
|
|
|
pictfmt = XRenderFindStandardFormat(disp, PictStandardARGB32);
|
|
|
|
|
|
|
|
pmap = XCreatePixmap(disp, WinGetXwin(VROOT), w, h, 32);
|
|
|
|
|
|
|
|
gcv.foreground = 0;
|
|
|
|
gc = EXCreateGC(pmap, GCForeground, &gcv);
|
|
|
|
XFillRectangle(disp, pmap, gc, 0, 0, w, h);
|
|
|
|
gcv.fill_style = FillOpaqueStippled;
|
|
|
|
gcv.stipple = cpmap;
|
|
|
|
gcv.clip_mask = cmask;
|
2009-09-13 06:45:34 -07:00
|
|
|
gcv.foreground = fg;
|
|
|
|
gcv.background = bg;
|
2008-09-29 09:39:49 -07:00
|
|
|
XChangeGC(disp, gc,
|
|
|
|
GCForeground | GCBackground | GCFillStyle | GCStipple | GCClipMask,
|
|
|
|
&gcv);
|
|
|
|
XFillRectangle(disp, pmap, gc, 0, 0, w, h);
|
|
|
|
EXFreeGC(gc);
|
|
|
|
|
|
|
|
pict = XRenderCreatePicture(disp, pmap, pictfmt, 0, 0);
|
|
|
|
curs = XRenderCreateCursor(disp, pict, xh, yh);
|
|
|
|
|
|
|
|
XFreePixmap(disp, pmap);
|
|
|
|
XRenderFreePicture(disp, pict);
|
|
|
|
#else
|
|
|
|
XColor fgxc, bgxc;
|
|
|
|
|
2009-09-13 06:45:34 -07:00
|
|
|
COLOR32_TO_RGB16(fg, fgxc.red, fgxc.green, fgxc.blue);
|
|
|
|
COLOR32_TO_RGB16(bg, bgxc.red, bgxc.green, bgxc.blue);
|
|
|
|
XAllocColor(disp, WinGetCmap(VROOT), &fgxc);
|
|
|
|
XAllocColor(disp, WinGetCmap(VROOT), &bgxc);
|
2008-09-29 09:39:49 -07:00
|
|
|
|
|
|
|
curs = XCreatePixmapCursor(disp, cpmap, cmask, &fgxc, &bgxc, xh, yh);
|
|
|
|
w = h = 0;
|
|
|
|
#endif
|
|
|
|
return curs;
|
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static ECursor *
|
2008-09-29 09:39:49 -07:00
|
|
|
ECursorCreate(const char *name, const char *image, int native_id,
|
2009-09-13 06:45:34 -07:00
|
|
|
unsigned int fg, unsigned int bg)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
Cursor curs;
|
|
|
|
Pixmap pmap, mask;
|
|
|
|
int xh, yh;
|
|
|
|
unsigned int w, h, ww, hh;
|
|
|
|
char *img, msk[FILEPATH_LEN_MAX];
|
|
|
|
ECursor *ec;
|
|
|
|
|
2003-04-21 19:10:58 -07:00
|
|
|
if ((!name) || (!image && native_id == -1))
|
1999-08-17 15:56:46 -07:00
|
|
|
return NULL;
|
|
|
|
|
2003-04-21 19:10:58 -07:00
|
|
|
if (image)
|
2000-07-26 11:00:47 -07:00
|
|
|
{
|
2008-10-15 08:20:20 -07:00
|
|
|
img = FindFile(image, Mode.theme.path);
|
2003-05-22 12:15:03 -07:00
|
|
|
if (!img)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
Esnprintf(msk, sizeof(msk), "%s.mask", img);
|
|
|
|
pmap = 0;
|
|
|
|
mask = 0;
|
|
|
|
xh = 0;
|
|
|
|
yh = 0;
|
2008-03-24 04:12:40 -07:00
|
|
|
XReadBitmapFile(disp, WinGetXwin(VROOT), msk, &w, &h, &mask, &xh, &yh);
|
|
|
|
XReadBitmapFile(disp, WinGetXwin(VROOT), img, &w, &h, &pmap, &xh, &yh);
|
|
|
|
XQueryBestCursor(disp, WinGetXwin(VROOT), w, h, &ww, &hh);
|
2006-05-28 02:12:33 -07:00
|
|
|
curs = None;
|
|
|
|
if ((w <= ww) && (h <= hh) && (pmap))
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2006-05-28 02:12:33 -07:00
|
|
|
if (xh < 0 || xh >= (int)w)
|
|
|
|
xh = (int)w / 2;
|
|
|
|
if (yh < 0 || yh >= (int)h)
|
|
|
|
yh = (int)h / 2;
|
2008-09-29 09:39:49 -07:00
|
|
|
curs = ECreatePixmapCursor(pmap, mask, w, h, xh, yh, fg, bg);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2006-05-28 02:12:33 -07:00
|
|
|
if (!curs)
|
|
|
|
Eprintf("*** Failed to create cursor \"%s\" from %s,%s\n",
|
|
|
|
name, img, msk);
|
2003-11-15 14:27:17 -08:00
|
|
|
|
2006-05-28 02:12:33 -07:00
|
|
|
if (pmap)
|
|
|
|
EFreePixmap(pmap);
|
|
|
|
if (mask)
|
|
|
|
EFreePixmap(mask);
|
2003-05-22 12:15:03 -07:00
|
|
|
Efree(img);
|
2006-05-28 02:12:33 -07:00
|
|
|
|
|
|
|
if (!curs)
|
|
|
|
return NULL;
|
2000-07-26 11:00:47 -07:00
|
|
|
}
|
2003-04-21 19:10:58 -07:00
|
|
|
else
|
|
|
|
{
|
2004-07-18 05:27:38 -07:00
|
|
|
curs = (native_id == 999) ? None : XCreateFontCursor(disp, native_id);
|
2003-04-21 19:10:58 -07:00
|
|
|
}
|
|
|
|
|
2007-01-16 17:10:44 -08:00
|
|
|
ec = EMALLOC(ECursor, 1);
|
2004-02-28 07:14:02 -08:00
|
|
|
ec->name = Estrdup(name);
|
1999-08-17 15:56:46 -07:00
|
|
|
ec->cursor = curs;
|
|
|
|
ec->ref_count = 0;
|
2004-07-15 09:46:06 -07:00
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
if (!cursor_list)
|
|
|
|
cursor_list = ecore_list_new();
|
|
|
|
ecore_list_prepend(cursor_list, ec);
|
1999-08-17 15:56:46 -07:00
|
|
|
|
|
|
|
return ec;
|
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static void
|
|
|
|
ECursorDestroy(ECursor * ec)
|
|
|
|
{
|
|
|
|
if (!ec)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (ec->ref_count > 0)
|
|
|
|
{
|
2006-12-09 13:32:03 -08:00
|
|
|
DialogOK("ECursor Error!", _("%u references remain\n"), ec->ref_count);
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-07-25 13:02:57 -07:00
|
|
|
ecore_list_node_remove(cursor_list, ec);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2008-02-23 04:09:38 -08:00
|
|
|
Efree(ec->name);
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
Efree(ec);
|
|
|
|
}
|
|
|
|
|
2006-02-18 00:30:09 -08:00
|
|
|
static int
|
|
|
|
_ECursorMatchName(const void *data, const void *match)
|
|
|
|
{
|
2007-01-16 17:10:44 -08:00
|
|
|
return strcmp(((const ECursor *)data)->name, (const char *)match);
|
2006-02-18 00:30:09 -08:00
|
|
|
}
|
|
|
|
|
2008-03-22 08:00:07 -07:00
|
|
|
static ECursor *
|
2006-02-18 00:30:09 -08:00
|
|
|
ECursorFind(const char *name)
|
|
|
|
{
|
2007-07-27 09:59:50 -07:00
|
|
|
if (!name || !name[0])
|
|
|
|
return NULL;
|
2007-01-16 17:10:44 -08:00
|
|
|
return (ECursor *) ecore_list_find(cursor_list, _ECursorMatchName, name);
|
2006-02-18 00:30:09 -08:00
|
|
|
}
|
|
|
|
|
2007-07-27 09:59:50 -07:00
|
|
|
ECursor *
|
|
|
|
ECursorAlloc(const char *name)
|
|
|
|
{
|
|
|
|
ECursor *ec;
|
|
|
|
|
|
|
|
if (!name)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
ec = ECursorFind(name);
|
|
|
|
if (ec)
|
|
|
|
ec->ref_count++;
|
|
|
|
|
|
|
|
return ec;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ECursorFree(ECursor * ec)
|
|
|
|
{
|
|
|
|
if (ec)
|
|
|
|
ec->ref_count--;
|
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static int
|
|
|
|
ECursorConfigLoad(FILE * fs)
|
|
|
|
{
|
|
|
|
int err = 0;
|
2009-09-13 06:45:34 -07:00
|
|
|
unsigned int clr, clr2;
|
2004-12-28 15:46:49 -08:00
|
|
|
char s[FILEPATH_LEN_MAX];
|
|
|
|
char s2[FILEPATH_LEN_MAX];
|
2007-07-27 09:59:50 -07:00
|
|
|
char *p2;
|
2004-12-28 15:46:49 -08:00
|
|
|
int i1, i2, r, g, b;
|
2007-07-27 09:59:50 -07:00
|
|
|
char name[FILEPATH_LEN_MAX], *pname;
|
|
|
|
char file[FILEPATH_LEN_MAX], *pfile;
|
2004-12-28 15:46:49 -08:00
|
|
|
int native_id = -1;
|
2007-07-27 09:59:50 -07:00
|
|
|
|
2009-09-13 06:45:34 -07:00
|
|
|
COLOR32_FROM_RGB(clr, 0, 0, 0);
|
|
|
|
COLOR32_FROM_RGB(clr2, 255, 255, 255);
|
2008-09-29 09:39:49 -07:00
|
|
|
|
2007-07-27 09:59:50 -07:00
|
|
|
pname = pfile = NULL;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
while (GetLine(s, sizeof(s), fs))
|
|
|
|
{
|
2007-07-27 09:59:50 -07:00
|
|
|
i1 = ConfigParseline1(s, s2, &p2, NULL);
|
2004-12-28 15:46:49 -08:00
|
|
|
switch (i1)
|
|
|
|
{
|
|
|
|
case CONFIG_CURSOR:
|
|
|
|
err = -1;
|
|
|
|
i2 = atoi(s2);
|
|
|
|
if (i2 != CONFIG_OPEN)
|
|
|
|
goto done;
|
2009-09-13 06:45:34 -07:00
|
|
|
COLOR32_FROM_RGB(clr, 0, 0, 0);
|
|
|
|
COLOR32_FROM_RGB(clr2, 255, 255, 255);
|
2007-07-27 09:59:50 -07:00
|
|
|
pname = pfile = NULL;
|
2004-12-28 15:46:49 -08:00
|
|
|
native_id = -1;
|
|
|
|
break;
|
|
|
|
case CONFIG_CLOSE:
|
2009-09-13 06:45:34 -07:00
|
|
|
ECursorCreate(pname, pfile, native_id, clr, clr2);
|
2004-12-28 15:46:49 -08:00
|
|
|
err = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CONFIG_CLASSNAME:
|
2006-02-18 00:30:09 -08:00
|
|
|
if (ECursorFind(s2))
|
|
|
|
{
|
|
|
|
SkipTillEnd(fs);
|
|
|
|
goto done;
|
|
|
|
}
|
2007-07-27 09:59:50 -07:00
|
|
|
strcpy(name, s2);
|
|
|
|
pname = name;
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
case CURS_BG_RGB:
|
2005-10-30 11:40:49 -08:00
|
|
|
r = g = b = 0;
|
2007-07-27 09:59:50 -07:00
|
|
|
sscanf(p2, "%d %d %d", &r, &g, &b);
|
2009-09-13 06:45:34 -07:00
|
|
|
COLOR32_FROM_RGB(clr, r, g, b);
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
case CURS_FG_RGB:
|
2005-10-30 11:40:49 -08:00
|
|
|
r = g = b = 255;
|
2007-07-27 09:59:50 -07:00
|
|
|
sscanf(p2, "%d %d %d", &r, &g, &b);
|
2009-09-13 06:45:34 -07:00
|
|
|
COLOR32_FROM_RGB(clr2, r, g, b);
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
case XBM_FILE:
|
2007-07-27 09:59:50 -07:00
|
|
|
strcpy(file, s2);
|
|
|
|
pfile = file;
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
case NATIVE_ID:
|
2007-07-27 09:59:50 -07:00
|
|
|
native_id = atoi(s2);
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (err)
|
2006-12-09 13:32:03 -08:00
|
|
|
ConfigAlertLoad("Cursor");
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
1999-08-17 15:56:46 -07:00
|
|
|
void
|
2006-04-29 12:39:21 -07:00
|
|
|
ECursorApply(ECursor * ec, Win win)
|
1999-08-17 15:56:46 -07:00
|
|
|
{
|
|
|
|
if (!ec)
|
|
|
|
return;
|
2006-08-07 13:47:12 -07:00
|
|
|
XDefineCursor(disp, WinGetXwin(win), ec->cursor);
|
2004-07-15 09:46:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Cursor
|
2006-11-26 09:10:40 -08:00
|
|
|
ECursorGetByName(const char *name, const char *name2, unsigned int fallback)
|
2004-07-15 09:46:06 -07:00
|
|
|
{
|
|
|
|
ECursor *ec;
|
|
|
|
|
2007-07-27 09:59:50 -07:00
|
|
|
ec = ECursorAlloc(name);
|
2006-11-26 09:10:40 -08:00
|
|
|
if (!ec && name2)
|
2007-07-27 09:59:50 -07:00
|
|
|
ec = ECursorAlloc(name2);
|
2006-11-26 09:10:40 -08:00
|
|
|
if (ec)
|
2007-07-27 09:59:50 -07:00
|
|
|
return ec->cursor;
|
2004-07-15 09:46:06 -07:00
|
|
|
|
2006-11-26 09:10:40 -08:00
|
|
|
return XCreateFontCursor(disp, fallback);
|
1999-08-17 15:56:46 -07:00
|
|
|
}
|
|
|
|
|
2004-07-15 09:46:06 -07:00
|
|
|
static Cursor ECsrs[ECSR_COUNT];
|
|
|
|
|
|
|
|
Cursor
|
|
|
|
ECsrGet(int which)
|
|
|
|
{
|
|
|
|
return (which >= 0 && which < ECSR_COUNT) ? ECsrs[which] : None;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ECsrApply(int which, Window win)
|
|
|
|
{
|
|
|
|
XDefineCursor(disp, win, ECsrGet(which));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up some basic cursors
|
|
|
|
*/
|
2004-12-28 15:46:49 -08:00
|
|
|
static void
|
|
|
|
CursorsInit(void)
|
2004-07-15 09:46:06 -07:00
|
|
|
{
|
2004-07-15 11:23:54 -07:00
|
|
|
ECsrs[ECSR_NONE] = None;
|
2006-11-26 09:10:40 -08:00
|
|
|
ECsrs[ECSR_ROOT] = ECursorGetByName("DEFAULT", NULL, XC_left_ptr);
|
|
|
|
ECsrs[ECSR_GRAB] = ECursorGetByName("GRAB", NULL, XC_crosshair);
|
|
|
|
ECsrs[ECSR_PGRAB] = ECursorGetByName("PGRAB", NULL, XC_X_cursor);
|
|
|
|
ECsrs[ECSR_ACT_MOVE] = ECursorGetByName("GRAB_MOVE", NULL, XC_fleur);
|
|
|
|
ECsrs[ECSR_ACT_RESIZE] = ECursorGetByName("GRAB_RESIZE", NULL, XC_sizing);
|
|
|
|
ECsrs[ECSR_ACT_RESIZE_H] =
|
|
|
|
ECursorGetByName("RESIZE_H", NULL, XC_sb_h_double_arrow);
|
|
|
|
ECsrs[ECSR_ACT_RESIZE_V] =
|
|
|
|
ECursorGetByName("RESIZE_V", NULL, XC_sb_v_double_arrow);
|
|
|
|
ECsrs[ECSR_ACT_RESIZE_TL] =
|
|
|
|
ECursorGetByName("RESIZE_TL", "RESIZE_BR", XC_top_left_corner);
|
|
|
|
ECsrs[ECSR_ACT_RESIZE_TR] =
|
|
|
|
ECursorGetByName("RESIZE_TR", "RESIZE_BL", XC_top_right_corner);
|
|
|
|
ECsrs[ECSR_ACT_RESIZE_BL] =
|
|
|
|
ECursorGetByName("RESIZE_BL", "RESIZE_TR", XC_bottom_left_corner);
|
|
|
|
ECsrs[ECSR_ACT_RESIZE_BR] =
|
|
|
|
ECursorGetByName("RESIZE_BR", "RESIZE_TL", XC_bottom_right_corner);
|
2004-07-15 09:46:06 -07:00
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Cursor module
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
CursorSighan(int sig, void *prm __UNUSED__)
|
|
|
|
{
|
|
|
|
switch (sig)
|
|
|
|
{
|
|
|
|
case ESIGNAL_INIT:
|
2005-02-16 11:48:33 -08:00
|
|
|
ConfigFileLoad("cursors.cfg", Mode.theme.path, ECursorConfigLoad, 1);
|
2004-12-28 15:46:49 -08:00
|
|
|
CursorsInit();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-05-18 01:25:06 -07:00
|
|
|
CursorsIpc(const char *params)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
char cmd[128], prm[4096];
|
2006-02-18 00:30:09 -08:00
|
|
|
int len;
|
2004-12-28 15:46:49 -08:00
|
|
|
ECursor *ec;
|
|
|
|
|
|
|
|
cmd[0] = prm[0] = '\0';
|
|
|
|
p = params;
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
len = 0;
|
|
|
|
sscanf(p, "%100s %4000s %n", cmd, prm, &len);
|
|
|
|
p += len;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strncmp(cmd, "add", 3))
|
|
|
|
{
|
|
|
|
/* TBD */
|
|
|
|
IpcPrintf("Not implemented\n");
|
|
|
|
}
|
|
|
|
else if (!strncmp(cmd, "del", 3))
|
|
|
|
{
|
2006-02-18 00:30:09 -08:00
|
|
|
ECursorDestroy(ECursorFind(prm));
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
else if (!strncmp(cmd, "list", 2))
|
|
|
|
{
|
2006-02-18 00:30:09 -08:00
|
|
|
ECORE_LIST_FOR_EACH(cursor_list, ec) IpcPrintf("%s\n", ec->name);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-30 11:40:49 -08:00
|
|
|
static const IpcItem CursorIpcArray[] = {
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
CursorsIpc,
|
|
|
|
"cursor", "csr",
|
|
|
|
"Cursor functions",
|
|
|
|
" cursor add <classname> ... Create cursor\n"
|
|
|
|
" cursor del <classname> Delete cursor\n"
|
|
|
|
" cursor list Show all cursors\n"}
|
|
|
|
};
|
|
|
|
#define N_IPC_FUNCS (sizeof(CursorIpcArray)/sizeof(IpcItem))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Module descriptor
|
|
|
|
*/
|
2007-01-16 17:10:44 -08:00
|
|
|
extern const EModule ModCursors;
|
2006-04-21 15:52:59 -07:00
|
|
|
const EModule ModCursors = {
|
2004-12-28 15:46:49 -08:00
|
|
|
"cursor", "csr",
|
|
|
|
CursorSighan,
|
|
|
|
{N_IPC_FUNCS, CursorIpcArray}
|
|
|
|
,
|
|
|
|
{0, NULL}
|
|
|
|
};
|