Exemplo n.º 1
0
Arquivo: warp.c Projeto: Limsik/e17
static WarpFocusWin *
WarpFocusWinCreate(void)
{
   WarpFocusWin       *fw;

   fw = ECALLOC(WarpFocusWin, 1);
   if (!fw)
      return fw;

   EoInit(fw, EOBJ_TYPE_MISC, None, 0, 0, 1, 1, 1, "Warp");
   EoSetFloating(fw, 1);
   EoSetLayer(fw, 20);
   EoSetFade(fw, 1);
   EoSetShadow(fw, 1);

   EventCallbackRegister(EoGetWin(fw), WarpFocusHandleEvent, NULL);
   ESelectInput(EoGetWin(fw), ButtonReleaseMask);

   fw->tc = TextclassFind("WARPFOCUS", 0);
   if (!fw->tc)
      fw->tc = TextclassFind("COORDS", 1);

   fw->ic = ImageclassFind("WARPFOCUS", 0);
   if (!fw->ic)
      fw->ic = ImageclassFind("COORDS", 1);

   return fw;
}
Exemplo n.º 2
0
MenuStyle          *
MenuStyleFind(const char *name)
{
   MenuStyle          *ms;

   ms = (MenuStyle *) ecore_list_find(menu_style_list, _MenuStyleMatchName,
				      name);
   if (ms)
      return ms;

   ms = (MenuStyle *) ecore_list_find(menu_style_list, _MenuStyleMatchName,
				      "__fb_ms");
   if (ms)
      return ms;

   ms = MenuStyleCreate("__fb_ms");
   if (!ms)
      return ms;

   ms->tclass = TextclassFind(NULL, 1);
   ms->bg_iclass = ImageclassFind(NULL, 1);
   ms->item_iclass = ImageclassFind(NULL, 1);
   ms->sub_iclass = ImageclassFind(NULL, 1);

   return ms;
}
Exemplo n.º 3
0
static ImageClass  *
ImageclassGetFallback(void)
{
   ImageClass         *ic;

   ic = ImageclassFind("__fb_ic", 0);
   if (ic)
      return ic;

   /* Create fallback imageclass */
   ic = ImageclassCreate("__fb_ic");
   if (!ic)
      return ic;

   ic->norm.normal = ImagestateCreateX(255, 255, 0, 0, 160, 160, 160);
   ic->norm.hilited = ImagestateCreateX(255, 255, 0, 0, 192, 192, 192);
   ic->norm.clicked = ImagestateCreateX(0, 0, 255, 255, 192, 192, 192);
   ic->active.normal = ImagestateCreateX(255, 255, 0, 0, 180, 140, 160);
   ic->active.hilited = ImagestateCreateX(255, 255, 0, 0, 230, 190, 210);
   ic->active.clicked = ImagestateCreateX(0, 0, 255, 255, 230, 190, 210);

   ic->padding.left = 4;
   ic->padding.right = 4;
   ic->padding.top = 4;
   ic->padding.bottom = 4;

   ImageclassPopulate(ic);

   return ic;
}
Exemplo n.º 4
0
Arquivo: iclass.c Projeto: Limsik/e17
ImageClass         *
ImageclassAlloc(const char *name, int fallback)
{
   ImageClass         *ic;

   if (!name || !name[0])
      return NULL;

   ic = ImageclassFind(name, fallback);
   if (ic)
      ic->ref_count++;

   return ic;
}
Exemplo n.º 5
0
Arquivo: iclass.c Projeto: Limsik/e17
static ImageClass  *
ImageclassGetFallback(void)
{
   ImageClass         *ic;

   ic = ImageclassFind("__fb_ic", 0);
   if (ic)
      return ic;

   /* Create fallback imageclass */
   ic = ImageclassCreate("__fb_ic");
   if (!ic)
      return ic;

   ic->norm.normal = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->norm.normal, 255, 255, 160, 0, 0);
   ic->norm.normal->bevelstyle = BEVEL_AMIGA;

   ic->norm.hilited = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->norm.hilited, 255, 255, 192, 0, 0);
   ic->norm.hilited->bevelstyle = BEVEL_AMIGA;

   ic->norm.clicked = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->norm.clicked, 0, 0, 192, 255, 255);
   ic->norm.clicked->bevelstyle = BEVEL_AMIGA;

   ic->active.normal = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->active.normal, 255, 255, 0, 0, 0);
   COLOR32_FROM_RGB(ic->active.normal->bg, 180, 140, 160);
   ic->active.normal->bevelstyle = BEVEL_AMIGA;

   ic->active.hilited = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->active.hilited, 255, 255, 0, 0, 0);
   COLOR32_FROM_RGB(ic->active.hilited->bg, 230, 190, 210);
   ic->active.hilited->bevelstyle = BEVEL_AMIGA;

   ic->active.clicked = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->active.clicked, 0, 0, 0, 255, 255);
   COLOR32_FROM_RGB(ic->active.clicked->bg, 230, 190, 210);
   ic->active.clicked->bevelstyle = BEVEL_AMIGA;

   ic->padding.left = 4;
   ic->padding.right = 4;
   ic->padding.top = 4;
   ic->padding.bottom = 4;

   ImageclassPopulate(ic);

   return ic;
}
Exemplo n.º 6
0
static void
TooltipIclassPaste(ToolTip * tt, const char *ic_name, int x, int y, int *px)
{
   ImageClass         *ic;
   EImage             *im;
   int                 w, h;

   ic = ImageclassFind(ic_name, 0);
   im = ImageclassGetImage(ic, 0, 0, 0);
   if (!ic || !im)
      return;

   EImageGetSize(im, &w, &h);
   EImageRenderOnDrawable(im, EobjGetWin(tt->TTWIN), None, EIMAGE_BLEND, x, y,
			  w, h);

   *px = x + w;
}
Exemplo n.º 7
0
Arquivo: iclass.c Projeto: Limsik/e17
ImageClass         *
ImageclassGetBlack(void)
{
   ImageClass         *ic;

   ic = ImageclassFind("__BLACK", 0);
   if (ic)
      return ic;

   /* Create all black image class for filler borders */
   ic = ImageclassCreate("__BLACK");
   if (!ic)
      return ic;

   ic->norm.normal = ImagestateCreate(NULL);
   ImagestateColorsSetGray(ic->norm.normal, 0, 0, 0, 0, 0);

   ImageclassPopulate(ic);

   return ic;
}
Exemplo n.º 8
0
static ImageClass  *
TooltipCreateIclass(const char *name, const char *file, int *pw, int *ph)
{
   ImageClass         *ic;
   EImage             *im;
   int                 w, h;

   ic = ImageclassFind(name, 0);
   if (!ic)
      ic = ImageclassCreateSimple(name, file);
   im = ImageclassGetImage(ic, 0, 0, 0);

   if (im)
     {
	EImageGetSize(im, &w, &h);
	if (*pw < w)
	   *pw = w;
	if (*ph < h)
	   *ph = h;
     }

   return ic;
}
Exemplo n.º 9
0
Arquivo: iclass.c Projeto: Limsik/e17
int
ImageclassConfigLoad(FILE * fs)
{
   int                 err = 0;
   char                s[FILEPATH_LEN_MAX];
   char                s2[FILEPATH_LEN_MAX];
   char               *p2;
   int                 i1;
   ImageClass         *ic = NULL;
   ImageState         *is = NULL;
   int                 l, r, t, b;

   while (GetLine(s, sizeof(s), fs))
     {
	i1 = ConfigParseline1(s, s2, &p2, NULL);

	/* ic not needed */
	switch (i1)
	  {
	  case CONFIG_CLOSE:
	     ImageclassPopulate(ic);
	     goto done;
	  case CONFIG_COLORMOD:
	  case ICLASS_COLORMOD:
	     continue;
	  case CONFIG_CLASSNAME:
	  case ICLASS_NAME:
	     if (ImageclassFind(s2, 0))
	       {
		  SkipTillEnd(fs);
		  goto done;
	       }
	     ic = ImageclassCreate(s2);
	     continue;
	  }

	/* ic needed */
	if (!ic)
	   break;

	switch (i1)
	  {
	  case CONFIG_INHERIT:
	     {
		ImageClass         *ic2;

		ic2 = ImageclassFind(s2, 0);
		if (!ic2)
		   goto not_ok;
		ic->norm = ic2->norm;
		ic->active = ic2->active;
		ic->sticky = ic2->sticky;
		ic->sticky_active = ic2->sticky_active;
		ic->padding = ic2->padding;
	     }
	     continue;
	  case ICLASS_PADDING:
	     l = r = t = b = 0;
	     sscanf(p2, "%i %i %i %i", &l, &r, &t, &b);
	     ic->padding.left = l;
	     ic->padding.right = r;
	     ic->padding.top = t;
	     ic->padding.bottom = b;
	     continue;
	  case CONFIG_DESKTOP:
	     /* don't ask... --mandrake */
	  case ICLASS_NORMAL:
	     is = ImagestateSet(&ic->norm.normal, s2);
	     continue;
	  case ICLASS_CLICKED:
	     is = ImagestateSet(&ic->norm.clicked, s2);
	     continue;
	  case ICLASS_HILITED:
	     is = ImagestateSet(&ic->norm.hilited, s2);
	     continue;
	  case ICLASS_DISABLED:
	     is = ImagestateSet(&ic->norm.disabled, s2);
	     continue;
	  case ICLASS_STICKY_NORMAL:
	     is = ImagestateSet(&ic->sticky.normal, s2);
	     continue;
	  case ICLASS_STICKY_CLICKED:
	     is = ImagestateSet(&ic->sticky.clicked, s2);
	     continue;
	  case ICLASS_STICKY_HILITED:
	     is = ImagestateSet(&ic->sticky.hilited, s2);
	     continue;
	  case ICLASS_STICKY_DISABLED:
	     is = ImagestateSet(&ic->sticky.disabled, s2);
	     continue;
	  case ICLASS_ACTIVE_NORMAL:
	     is = ImagestateSet(&ic->active.normal, s2);
	     continue;
	  case ICLASS_ACTIVE_CLICKED:
	     is = ImagestateSet(&ic->active.clicked, s2);
	     continue;
	  case ICLASS_ACTIVE_HILITED:
	     is = ImagestateSet(&ic->active.hilited, s2);
	     continue;
	  case ICLASS_ACTIVE_DISABLED:
	     is = ImagestateSet(&ic->active.disabled, s2);
	     continue;
	  case ICLASS_STICKY_ACTIVE_NORMAL:
	     is = ImagestateSet(&ic->sticky_active.normal, s2);
	     continue;
	  case ICLASS_STICKY_ACTIVE_CLICKED:
	     is = ImagestateSet(&ic->sticky_active.clicked, s2);
	     continue;
	  case ICLASS_STICKY_ACTIVE_HILITED:
	     is = ImagestateSet(&ic->sticky_active.hilited, s2);
	     continue;
	  case ICLASS_STICKY_ACTIVE_DISABLED:
	     is = ImagestateSet(&ic->sticky_active.disabled, s2);
	     continue;
	  }

	/* is needed */
	if (!is)
	   break;

	switch (i1)
	  {
	  case ICLASS_LRTB:
	     if (!is->border)
		is->border = EMALLOC(EImageBorder, 1);
	     l = r = t = b = 0;
	     sscanf(p2, "%i %i %i %i", &l, &r, &t, &b);
	     is->border->left = l;
	     is->border->right = r;
	     is->border->top = t;
	     is->border->bottom = b;
	     /* Hmmm... imlib2 works better with this */
	     is->border->right++;
	     is->border->bottom++;
	     continue;
	  case ICLASS_FILLRULE:
	     is->pixmapfillstyle = atoi(s2);
	     continue;
	  case ICLASS_TRANSPARENT:
	     is->transparent = strtoul(s2, NULL, 0);
	     continue;
	  case ICLASS_ROTATE:	/* flip goes here too */
	     is->rotate = strtoul(s2, NULL, 0);
	     continue;
	  case ICLASS_BEVEL:
	     {
		int                 n, bevel;

		n = sscanf(p2, "%i %i %i %i %i %i",
			   &bevel, &is->hihi, &is->hi, &is->bg, &is->lo,
			   &is->lolo);
		if (n < 6)
		   goto not_ok;
		is->bevelstyle = bevel;
	     }
	     continue;
	  default:
	     goto not_ok;
	  }
     }
 not_ok:
   err = -1;

 done:
   return err;
}
Exemplo n.º 10
0
Arquivo: iclass.c Projeto: Limsik/e17
static void
ImageclassIpc(const char *params)
{
   char                param1[1024];
   char                param2[1024];
   int                 l;
   const char         *p;
   ImageClass         *ic;

   if (!params)
     {
	IpcPrintf("Please specify...\n");
	return;
     }

   p = params;
   l = 0;
   param1[0] = param2[0] = '\0';
   sscanf(p, "%1000s %1000s %n", param1, param2, &l);
   p += l;

   if (!strncmp(param1, "list", 2))
     {
	ECORE_LIST_FOR_EACH(iclass_list, ic) IpcPrintf("%s\n", ic->name);
	return;
     }

   if (!param1[0])
     {
	IpcPrintf("ImageClass not specified\n");
	return;
     }

   if (!strcmp(param2, "free_pixmap"))
     {
	Pixmap              pmap;

	pmap = (Pixmap) strtol(p, NULL, 0);
	EImagePixmapsFree(pmap, None);
	return;
     }

   ic = ImageclassFind(param1, 0);
   if (!ic)
     {
	IpcPrintf("ImageClass not found: %s\n", param1);
	return;
     }

   if (!strcmp(param2, "get_padding"))
     {
	IpcPrintf("%i %i %i %i\n",
		  ic->padding.left, ic->padding.right,
		  ic->padding.top, ic->padding.bottom);
     }
   else if (!strcmp(param2, "get_image_size"))
     {
	ImagestateRealize(ic->norm.normal);
	if (ic->norm.normal->im)
	  {
	     int                 w, h;

	     EImageGetSize(ic->norm.normal->im, &w, &h);
	     EImageFree(ic->norm.normal->im);
	     IpcPrintf("%i %i\n", w, h);
	  }
     }
   else if (!strcmp(param2, "apply"))
     {
	Window              xwin;
	Win                 win;
	char                state[20];
	int                 st, w, h;

	/* 3:xwin 4:state 5:w 6:h */
	xwin = None;
	state[0] = '\0';
	w = h = -1;
	sscanf(p, "%lx %16s %d %d", &xwin, state, &w, &h);

	win = ECreateWinFromXwin(xwin);
	if (!win)
	   return;

	if (!strcmp(state, "normal"))
	   st = STATE_NORMAL;
	else if (!strcmp(state, "hilited"))
	   st = STATE_HILITED;
	else if (!strcmp(state, "clicked"))
	   st = STATE_CLICKED;
	else if (!strcmp(state, "disabled"))
	   st = STATE_DISABLED;
	else
	   st = STATE_NORMAL;

	ImageclassApply(ic, win, 0, 0, st, ST_SOLID);
	EDestroyWin(win);
     }
   else if (!strcmp(param2, "apply_copy"))
     {
	Window              xwin;
	Win                 win;
	char                state[20];
	int                 st, w, h;
	PmapMask            pmm;

	/* 3:xwin 4:state 5:w 6:h */
	xwin = None;
	state[0] = '\0';
	w = h = -1;
	sscanf(p, "%lx %16s %d %d", &xwin, state, &w, &h);

	win = ECreateWinFromXwin(xwin);
	if (!win)
	   return;

	if (!strcmp(state, "normal"))
	   st = STATE_NORMAL;
	else if (!strcmp(state, "hilited"))
	   st = STATE_HILITED;
	else if (!strcmp(state, "clicked"))
	   st = STATE_CLICKED;
	else if (!strcmp(state, "disabled"))
	   st = STATE_DISABLED;
	else
	   st = STATE_NORMAL;

	if (w < 0 || h < 0)
	  {
	     IpcPrintf("Error:  missing width and/or height\n");
	     return;
	  }

	ImageclassApplyCopy(ic, win, w, h, 0, 0, st, &pmm,
			    IC_FLAG_MAKE_MASK | IC_FLAG_FULL_SIZE, ST_SOLID);
	IpcPrintf("0x%08lx 0x%08lx\n", pmm.pmap, pmm.mask);
	EDestroyWin(win);
     }
   else if (!strcmp(param2, "query"))
     {
	IpcPrintf("ImageClass %s found\n", ic->name);
     }
   else if (!strcmp(param2, "ref_count"))
     {
	IpcPrintf("%u references remain\n", ic->ref_count);
     }
   else
     {
	IpcPrintf("Error: unknown operation specified\n");
     }
}
Exemplo n.º 11
0
static void
_CoordsShow(EWin * ewin, int mode)
{
   TextClass          *tc;
   ImageClass         *ic;
   char                s[256];
   int                 md;
   int                 x, y;
   unsigned int        w, h;
   int                 cx, cy, cw, ch;
   EObj               *eo = coord_eo;
   EImageBorder       *pad;
   int                 bl, br, bt, bb;

   if (!Conf.movres.mode_info)
      return;
   if (!ewin || !ewin->state.show_coords)
      return;

   tc = TextclassFind("COORDS", 1);
   ic = ImageclassFind("COORDS", 1);
   if ((!ic) || (!tc))
      return;

   cx = cy = cw = ch = 0;

   x = ewin->shape_x;
   y = ewin->shape_y;
   w = (ewin->state.shaded) ? ewin->client.w : ewin->shape_w;
   h = (ewin->state.shaded) ? ewin->client.h : ewin->shape_h;
   ICCCM_GetIncrementalSize(ewin, w, h, &w, &h);

   switch (mode)
     {
     default:
     case 0:
	Esnprintf(s, sizeof(s), "%i x %i (%i, %i)", w, h, x, y);
	break;
     case 1:
	Esnprintf(s, sizeof(s), _("Focused/unfocused opacity: %d/%d %%"),
		  OpacityToPercent(ewin->props.focused_opacity),
		  OpacityToPercent(ewin->ewmh.opacity));
	break;
     }
   TextSize(tc, 0, 0, 0, s, &cw, &ch, 17);
   pad = ImageclassGetPadding(ic);
   cw += pad->left + pad->right;
   ch += pad->top + pad->bottom;

   /* Width hysteresis (hack - assuming horizontal text) */
   cw += 8;
   if (eo && abs(EobjGetW(eo) - cw) < 8)
      cw = EobjGetW(eo);

   if (Mode.mode == MODE_MOVE)
      md = Conf.movres.mode_move;
   else
      md = Conf.movres.mode_resize;

   if ((md == 0) || ((cw < ewin->shape_w - 2) && (ch < ewin->shape_h - 2)))
     {
	if (Conf.movres.mode_info == 1)
	  {
	     switch (md)
	       {
	       case 0:
	       case 1:
	       case 2:
		  EwinBorderGetSize(ewin, &bl, &br, &bt, &bb);
		  w = (ewin->state.shaded) ?
		     EoGetW(ewin) : ewin->shape_w + bl + br;
		  h = (ewin->state.shaded) ?
		     EoGetH(ewin) : ewin->shape_h + bt + bb;
		  cx = x + (w - cw) / 2 + EoGetX(EoGetDesk(ewin));
		  cy = y + (h - ch) / 2 + EoGetY(EoGetDesk(ewin));
		  break;
	       }
	  }
     }

   if (!eo)
     {
	eo = EobjWindowCreate(EOBJ_TYPE_MISC, 0, 0, 1, 1, 2, "Coord");
	if (!eo)
	   return;
	coord_eo = eo;
	eo->fade = eo->shadow = 1;

	/* Center text (override theme) */
	TextclassSetJustification(tc, 512);
     }

#define TEST_COORD_REPARENT_TO_FRAME 0
#if TEST_COORD_REPARENT_TO_FRAME
   cx -= x;
   cy -= y;
#endif
   md = cw != EobjGetW(eo) || ch != EobjGetH(eo);	/* md is change size flag */
   EobjMoveResize(eo, cx, cy, cw, ch);

   if (!eo->shown)
     {
#if TEST_COORD_REPARENT_TO_FRAME
	EobjReparent(eo, EoObj(ewin), cx, cy);
#endif
	EobjMap(eo, 0);
     }

   ITApply(EobjGetWin(eo), ic, NULL, STATE_NORMAL, 1, 0, ST_SOLID, tc, NULL, s,
	   1);

   if (md)			/* Assuming that shape change only happens when size changes too */
      EobjShapeUpdate(eo, 0);

   EFlush();
}
Exemplo n.º 12
0
Arquivo: startup.c Projeto: Limsik/e17
void
StartupWindowsCreate(void)
{
   Win                 w1, w2, win1, win2, b1, b2;
   Background         *bg;
   ImageClass         *ic;
   int                 x, y, bx, by, bw, bh, dbw;
   EObj               *eo;

   /* Acting only as boolean? */
   if (BackgroundFind("STARTUP_BACKGROUND_SIDEWAYS"))
      bg_sideways = 1;

   ic = ImageclassFind("STARTUP_BAR", 0);
   if (!ic)
      ic = ImageclassFind("DESKTOP_DRAGBUTTON_HORIZ", 0);
   bg = BackgroundFind("STARTUP_BACKGROUND");
   if (!ic || !bg)
      return;

   dbw = Conf.desks.dragbar_width;
   if (dbw <= 0)
      dbw = 16;
   if (bg_sideways)
     {
	x = WinGetW(VROOT) / 2;
	y = 0;
	bx = WinGetW(VROOT) - dbw;
	by = 0;
	bw = dbw;
	bh = WinGetH(VROOT);
     }
   else
     {
	x = 0;
	y = WinGetH(VROOT) / 2;
	bx = 0;
	by = WinGetH(VROOT) - dbw;
	bw = WinGetW(VROOT);
	bh = dbw;
     }

   eo = EobjWindowCreate(EOBJ_TYPE_MISC,
			 -x, -y, WinGetW(VROOT), WinGetH(VROOT), 1, "Init-1");
   if (!eo)
      return;
   init_win1 = eo;
   w1 = EobjGetWin(eo);
   win1 = ECreateWindow(w1, x, y, WinGetW(VROOT), WinGetH(VROOT), 0);

   eo = EobjWindowCreate(EOBJ_TYPE_MISC,
			 x, y, WinGetW(VROOT), WinGetH(VROOT), 1, "Init-2");
   if (!eo)
      return;
   init_win2 = eo;
   w2 = EobjGetWin(eo);
   win2 = ECreateWindow(w2, -x, -y, WinGetW(VROOT), WinGetH(VROOT), 0);

   EMapWindow(win1);
   EMapWindow(win2);

   if (bw > 0 && bh > 0)
     {
	b1 = ECreateWindow(w1, bx, by, bw, bh, 0);
	b2 = ECreateWindow(w2, 0, 0, bw, bh, 0);
	EMapRaised(b1);
	EMapRaised(b2);

	ImageclassApply(ic, b1, 0, 0, 0, ST_SOLID);
	ImageclassApply(ic, b2, 0, 0, 0, ST_SOLID);
     }

   BackgroundSet(bg, win1, WinGetW(VROOT), WinGetH(VROOT));
   BackgroundSet(bg, win2, WinGetW(VROOT), WinGetH(VROOT));
   StartupBackgroundsDestroy();

   EobjMap(init_win1, 0);
   EobjMap(init_win2, 0);

   EobjsRepaint();
}