Exemple #1
0
/** Parse active window style information. */
void ParseActiveWindowStyle(const TokenNode *tp)
{

   const TokenNode *np;

   Assert(tp);

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FOREGROUND:
         SetColor(COLOR_TITLE_ACTIVE_FG, np->value);
         break;
      case TOK_BACKGROUND:
         ParseGradient(np->value,
            COLOR_TITLE_ACTIVE_BG1, COLOR_TITLE_ACTIVE_BG2);
         break;
      case TOK_OUTLINE:
         ParseGradient(np->value, COLOR_TITLE_ACTIVE_DOWN,
                       COLOR_TITLE_ACTIVE_UP);
         break;
      case TOK_OPACITY:
         settings.activeClientOpacity = ParseOpacity(np, np->value);
         break;
      default:
         InvalidTag(np, TOK_ACTIVE);
         break;
      }
   }

}
Exemple #2
0
/** Parse tray button style. */
void ParseTrayButtonStyle(const TokenNode *tp)
{

   const TokenNode *np;

   Assert(tp);

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FONT:
         SetFont(FONT_TRAYBUTTON, np->value);
         break;
      case TOK_FOREGROUND:
         SetColor(COLOR_TRAYBUTTON_FG, np->value);
         break;
      case TOK_BACKGROUND:
         ParseGradient(np->value, COLOR_TRAYBUTTON_BG1, COLOR_TRAYBUTTON_BG2);
         break;
      case TOK_ACTIVEFOREGROUND:
         SetColor(COLOR_TRAYBUTTON_ACTIVE_FG, np->value);
         break;
      case TOK_ACTIVEBACKGROUND:
         ParseGradient(np->value, COLOR_TRAYBUTTON_ACTIVE_BG1,
                       COLOR_TRAYBUTTON_ACTIVE_BG2);
         break;
      default:
         InvalidTag(np, TOK_TRAYBUTTONSTYLE);
         break;
      }
   }

}
Exemple #3
0
/** Parse tray style. */
void ParseTrayStyle(const TokenNode *tp) {

   const TokenNode *np;

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FONT:
         SetFont(FONT_TRAY, np->value);
         break;
      case TOK_BACKGROUND:
         ParseGradient(np->value, COLOR_TRAY_BG1, COLOR_TRAY_BG2);
         break;
      case TOK_FOREGROUND:
         SetColor(COLOR_TRAY_FG, np->value);
         break;
      case TOK_ACTIVEBACKGROUND:
         ParseGradient(np->value, COLOR_TRAY_ACTIVE_BG1, COLOR_TRAY_ACTIVE_BG2);
         break;
      case TOK_ACTIVEFOREGROUND:
         SetColor(COLOR_TRAY_ACTIVE_FG, np->value);
         break;
      case TOK_OPACITY:
         settings.trayOpacity = ParseOpacity(np, np->value);
         break;
      default:
         InvalidTag(np, TOK_TRAYSTYLE);
         break;
      }
   }

}
Exemple #4
0
/** Parse clock style. */
void ParseClockStyle(const TokenNode *tp)
{

   const TokenNode *np;

   Assert(tp);

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FONT:
         SetFont(FONT_CLOCK, np->value);
         break;
      case TOK_FOREGROUND:
         SetColor(COLOR_CLOCK_FG, np->value);
         break;
      case TOK_BACKGROUND:
         ParseGradient(np->value, COLOR_CLOCK_BG1, COLOR_CLOCK_BG2);
         break;
      default:
         InvalidTag(np, TOK_CLOCKSTYLE);
         break;
      }
   }

}
Exemple #5
0
/** Parse task list style. */
void ParseTaskListStyle(const TokenNode *tp)
{
   static const StringMappingType mapping[] = {
      { "left",   INSERT_LEFT    },
      { "right",  INSERT_RIGHT   }
   };
   TokenNode *np;

   settings.taskInsertMode = ParseAttribute(mapping, ARRAY_LENGTH(mapping),
      tp, "insert", settings.taskInsertMode);

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FONT:
         SetFont(FONT_TASK, np->value);
         break;
      case TOK_ACTIVE:
         ParseActiveTaskListStyle(np);
         break;
      case TOK_FOREGROUND:
         SetColor(COLOR_TASK_FG, np->value);
         break;
      case TOK_BACKGROUND:
         ParseGradient(np->value, COLOR_TASK_BG1, COLOR_TASK_BG2);
         break;
      default:
         InvalidTag(np, TOK_TASKLISTSTYLE);
         break;
      }
   }

}
Exemple #6
0
/** Parse inactive window style information. */
void ParseInactiveWindowStyle(const TokenNode *tp) {

   const TokenNode *np;

   Assert(tp);

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_TEXT:
         SetColor(COLOR_TITLE_FG, np->value);
         break;
      case TOK_TITLE:
         ParseGradient(np->value, COLOR_TITLE_BG1, COLOR_TITLE_BG2);
         break;
      case TOK_OUTLINE:
         SetColor(COLOR_BORDER_LINE, np->value);
         break;
      case TOK_OPACITY:
         settings.inactiveClientOpacity = ParseOpacity(tp, np->value);
         break;
      default:
         InvalidTag(np, TOK_INACTIVE);
         break;
      }
   }

}
Exemple #7
0
/** Parse menu style. */
void ParseMenuStyle(const TokenNode *tp)
{
   const TokenNode *np;

   settings.menuDecorations = ParseDecorations(tp);
   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FONT:
         SetFont(FONT_MENU, np->value);
         break;
      case TOK_FOREGROUND:
         SetColor(COLOR_MENU_FG, np->value);
         break;
      case TOK_BACKGROUND:
         SetColor(COLOR_MENU_BG, np->value);
         break;
      case TOK_ACTIVE:
         ParseActiveMenuStyle(np);
         break;
      case TOK_OUTLINE:
         ParseGradient(np->value, COLOR_MENU_DOWN, COLOR_MENU_UP);
         break;
      case TOK_OPACITY:
         settings.menuOpacity = ParseOpacity(np, np->value);
         break;
      default:
         InvalidTag(np, TOK_MENUSTYLE);
         break;
      }
   }

}
Exemple #8
0
/** Parse task list style. */
void ParseTaskListStyle(const TokenNode *tp) {

   const char *temp;
   TokenNode *np;

   temp = FindAttribute(tp->attributes, INSERT_ATTRIBUTE);
   if(temp) {
      if(!strcmp(temp, "right")) {
         settings.taskInsertMode = INSERT_RIGHT;
      } else if(!strcmp(temp, "left")) {
         settings.taskInsertMode = INSERT_LEFT;
      } else {
         ParseError(tp, _("invalid insert mode: \"%s\""), temp);
         settings.taskInsertMode = INSERT_RIGHT;
      }
   }

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FONT:
         SetFont(FONT_TASK, np->value);
         break;
      case TOK_FOREGROUND:
         SetColor(COLOR_TASK_FG, np->value);
         break;
      case TOK_BACKGROUND:
         ParseGradient(np->value, COLOR_TASK_BG1, COLOR_TASK_BG2);
         break;
      case TOK_ACTIVEFOREGROUND:
         SetColor(COLOR_TASK_ACTIVE_FG, np->value);
         break;
      case TOK_ACTIVEBACKGROUND:
         ParseGradient(np->value, COLOR_TASK_ACTIVE_BG1, COLOR_TASK_ACTIVE_BG2);
         break;
      default:
         InvalidTag(np, TOK_TASKLISTSTYLE);
         break;
      }
   }

}
Exemple #9
0
/** Parse window style. */
void ParseWindowStyle(const TokenNode *tp)
{
   const TokenNode *np;
   const char *decorations;

   decorations = FindAttribute(tp->attributes, "decorations");
   if(decorations) {
      if(!strcmp(decorations, "motif")) {
         settings.handles = 1;
      } else if(!strcmp(decorations, "flat")) {
         settings.handles = 0;
      } else {
         ParseError(tp, "invalid WindowStyle decorations: %s\n", decorations);
      }
   } else {
      settings.handles = 0;
   }

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FONT:
         SetFont(FONT_BORDER, np->value);
         break;
      case TOK_WIDTH:
         settings.borderWidth = ParseUnsigned(np, np->value);
         break;
      case TOK_HEIGHT:
         settings.titleHeight = ParseUnsigned(np, np->value);
         break;
      case TOK_CORNER:
         settings.cornerRadius = ParseUnsigned(np, np->value);
         break;
      case TOK_ACTIVE:
         ParseActiveWindowStyle(np);
         break;
      case TOK_FOREGROUND:
         SetColor(COLOR_TITLE_FG, np->value);
         break;
      case TOK_BACKGROUND:
         ParseGradient(np->value, COLOR_TITLE_BG1, COLOR_TITLE_BG2);
         break;
      case TOK_OUTLINE:
         SetColor(COLOR_BORDER_LINE, np->value);
         break;
      case TOK_OPACITY:
         settings.inactiveClientOpacity = ParseOpacity(tp, np->value);
         break;
      default:
         InvalidTag(np, TOK_WINDOWSTYLE);
         break;
      }
   }
}
Exemple #10
0
/** Parse window style. */
void ParseWindowStyle(const TokenNode *tp)
{
   const TokenNode *np;

   settings.windowDecorations = ParseDecorations(tp);
   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FONT:
         SetFont(FONT_BORDER, np->value);
         break;
      case TOK_WIDTH:
         settings.borderWidth = ParseUnsigned(np, np->value);
         break;
      case TOK_HEIGHT:
         settings.titleHeight = ParseUnsigned(np, np->value);
         break;
      case TOK_CORNER:
         settings.cornerRadius = ParseUnsigned(np, np->value);
         break;
      case TOK_ACTIVE:
         ParseActiveWindowStyle(np);
         break;
      case TOK_FOREGROUND:
         SetColor(COLOR_TITLE_FG, np->value);
         break;
      case TOK_BACKGROUND:
         ParseGradient(np->value, COLOR_TITLE_BG1, COLOR_TITLE_BG2);
         break;
      case TOK_OUTLINE:
         ParseGradient(np->value, COLOR_TITLE_DOWN, COLOR_TITLE_UP);
         break;
      case TOK_OPACITY:
         settings.inactiveClientOpacity = ParseOpacity(tp, np->value);
         break;
      default:
         InvalidTag(np, TOK_WINDOWSTYLE);
         break;
      }
   }
}
Exemple #11
0
/** Parse tray style. */
void ParseTrayStyle(const TokenNode *tp)
{
   const TokenNode *np;
   const char *temp;

   settings.trayDecorations = ParseDecorations(tp);
   temp = FindAttribute(tp->attributes, "group");
   if(temp) {
      settings.groupTasks = !strcmp(temp, TRUE_VALUE);
   }

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FONT:
         SetFont(FONT_TRAY, np->value);
         break;
      case TOK_ACTIVE:
         ParseActiveTrayStyle(np);
         break;
      case TOK_BACKGROUND:
         ParseGradient(np->value, COLOR_TRAY_BG1, COLOR_TRAY_BG2);
         break;
      case TOK_FOREGROUND:
         SetColor(COLOR_TRAY_FG, np->value);
         break;
      case TOK_OUTLINE:
         ParseGradient(np->value, COLOR_TRAY_DOWN, COLOR_TRAY_UP);
         break;
      case TOK_OPACITY:
         settings.trayOpacity = ParseOpacity(np, np->value);
         break;
      default:
         InvalidTag(np, TOK_TRAYSTYLE);
         break;
      }
   }

}
Exemple #12
0
/** Parse active menu style. */
void ParseActiveMenuStyle(const TokenNode *tp)
{
   const TokenNode *np;
   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FOREGROUND:
         SetColor(COLOR_MENU_ACTIVE_FG, np->value);
         break;
      case TOK_BACKGROUND:
         ParseGradient(np->value, COLOR_MENU_ACTIVE_BG1, COLOR_MENU_ACTIVE_BG2);
         break;
      default:
         InvalidTag(np, TOK_ACTIVE);
         break;
      }
   }
}
Exemple #13
0
/** Parse menu style. */
void ParseMenuStyle(const TokenNode *tp) {

   const TokenNode *np;

   Assert(tp);

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_FONT:
         SetFont(FONT_MENU, np->value);
         break;
      case TOK_FOREGROUND:
         SetColor(COLOR_MENU_FG, np->value);
         break;
      case TOK_BACKGROUND:
         SetColor(COLOR_MENU_BG, np->value);
         break;
      case TOK_ACTIVEFOREGROUND:
         SetColor(COLOR_MENU_ACTIVE_FG, np->value);
         break;
      case TOK_ACTIVEBACKGROUND:
         ParseGradient(np->value, COLOR_MENU_ACTIVE_BG1, COLOR_MENU_ACTIVE_BG2);
         break;
      case TOK_OUTLINE:
         SetColor(COLOR_MENU_ACTIVE_OL, np->value);
         break;
      case TOK_OPACITY:
         settings.menuOpacity = ParseOpacity(np, np->value);
         break;
      default:
         InvalidTag(np, TOK_MENUSTYLE);
         break;
      }
   }

}
Exemple #14
0
/* Create a pixmap from a gradient specifier, width and height are hints
 * that are only used for gradients that can be tiled e.g. H or V types
 * types are HVDBSCRY for Horizontal, Vertical, Diagonal, Back-diagonal, Square,
 * Circular, Radar and Yin/Yang respectively (in order of bloatiness)
 */
Pixmap CreateGradientPixmapFromString(
	Display *dpy, Drawable d, GC gc, int type, char *action,
	int *width_return, int *height_return,
	Pixel **pixels_return, int *nalloc_pixels, int dither)
{
	Pixel *d_pixels = NULL;
	int d_npixels = 0;
	XColor *xcs = NULL;
	int ncolors = 0;
	char **colors;
	int *perc, nsegs;
	Pixmap pixmap = None;

	/* set return pixels to NULL in case of premature return */
	if (pixels_return)
		*pixels_return = NULL;
	if (nalloc_pixels)
		*nalloc_pixels = 0;

	/* translate the gradient string into an array of colors etc */
	if (!(ncolors = ParseGradient(action, NULL, &colors, &perc, &nsegs))) {
		fprintf(stderr, "Can't parse gradient: '%s'\n", action);
		return None;
	}
	/* grab the colors */
	xcs = AllocAllGradientColors(
		colors, perc, nsegs, ncolors, dither);
	if (xcs == NULL)
	{
		return None;
	}

	/* grok the size to create from the type */
	type = toupper(type);

	if (CalculateGradientDimensions(
		    dpy, d, ncolors, type, dither, width_return, height_return))
	{
		pixmap = CreateGradientPixmap(
			dpy, d, gc, type, *width_return, *height_return,
			ncolors, xcs, dither, &d_pixels, &d_npixels,
			None, 0, 0, 0, 0, NULL);
	}

	/* if the caller has not asked for the pixels there is probably a leak
	 */
	if (PUseDynamicColors)
	{
		if (!(pixels_return && nalloc_pixels))
		{
			/* if the caller has not asked for the pixels there is
			 * probably a leak */
			fprintf(stderr,
			"CreateGradient: potential color leak, losing track"
			" of pixels\n");
			if (d_pixels != NULL)
			{
				free(d_pixels);
			}
		}
		else
		{
			if (!dither)
			{
				Pixel *pixels;
				int i;

				pixels = (Pixel *)safemalloc(
					ncolors * sizeof(Pixel));
				for(i=0; i<ncolors; i++)
				{
					pixels[i] = xcs[i].pixel;
				}
				*pixels_return = pixels;
				*nalloc_pixels = ncolors;
			}
			else
			{
				*pixels_return = d_pixels;
				*nalloc_pixels = d_npixels;
			}
		}
	}
	else if (d_pixels != NULL)
	{
		/* should not happen */
		free(d_pixels);
	}

	free(xcs);

	return pixmap;
}