示例#1
0
文件: cursors.c 项目: burzumishi/e16
static ECursor     *
ECursorRealize(ECursor * ec)
{
   Pixmap              pmap, mask;
   int                 xh, yh;
   unsigned int        w, h, ww, hh;
   char               *img, msk[FILEPATH_LEN_MAX];

   if (ec->file)
     {
	img = ThemeFileFind(ec->file, FILE_TYPE_CURSOR);
	_EFREE(ec->file);	/* Ok or not - we never need file again */
	if (!img)
	   goto done;

	Esnprintf(msk, sizeof(msk), "%s.mask", img);
	pmap = 0;
	mask = 0;
	xh = 0;
	yh = 0;
	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);
	if ((w <= ww) && (h <= hh) && (pmap))
	  {
	     if (xh < 0 || xh >= (int)w)
		xh = (int)w / 2;
	     if (yh < 0 || yh >= (int)h)
		yh = (int)h / 2;
	     ec->cursor =
		ECreatePixmapCursor(pmap, mask, w, h, xh, yh, ec->fg, ec->bg);
	  }

	if (ec->cursor == NoXID)
	  {
	     Eprintf("*** Failed to create cursor \"%s\" from %s,%s\n",
		     ec->name, img, msk);
	  }

	if (pmap)
	   EFreePixmap(pmap);
	if (mask)
	   EFreePixmap(mask);
	Efree(img);
     }
   else
     {
	ec->cursor = (ec->native_id == 999) ?
	   None : XCreateFontCursor(disp, ec->native_id);
     }

 done:
   if (ec->cursor == NoXID)
     {
	ECursorDestroy(ec);
	ec = NULL;
     }

   return ec;
}
示例#2
0
文件: x.c 项目: Limsik/e17
void
EFreeWindowBackgroundPixmap(Win win)
{
   if (!win || !win->bgpmap)
      return;

   if (win->bg_owned)
      EFreePixmap(win->bgpmap);
   win->bgpmap = 0;
   win->bg_owned = 0;
}
示例#3
0
文件: x.c 项目: Limsik/e17
static void
EShapeCombineMaskTiled(Win win, int dest, int x, int y,
		       Pixmap pmap, int op, int w, int h)
{
   XGCValues           gcv;
   GC                  gc;
   Window              tm;

   gcv.fill_style = FillTiled;
   gcv.tile = pmap;
   gcv.ts_x_origin = 0;
   gcv.ts_y_origin = 0;
   tm = ECreatePixmap(win, w, h, 1);
   gc = EXCreateGC(tm, GCFillStyle | GCTile |
		   GCTileStipXOrigin | GCTileStipYOrigin, &gcv);
   XFillRectangle(disp, tm, gc, 0, 0, w, h);
   EXFreeGC(gc);
   EShapeCombineMask(win, dest, x, y, tm, op);
   EFreePixmap(tm);
}