Ejemplo n.º 1
0
static void win_uncc256(Raster *wndo, UBYTE *ctab)
{
Wndo *w = (Wndo *)wndo;
Wscreen *s = w->W_screen;

	UNCC256(s->viscel,ctab);
	if(s->flags & WS_MUCOLORS_UP)
		set_refresh(s);
}
Ejemplo n.º 2
0
/* xors a rectangle with a color */
{
Wndo *w = (Wndo *)wndo;
SHORT xmax, ymax;
SHORT nextx, nexty;
LONG firstx;
LONG dheight;
SHORT osy;
UBYTE *ydots;
int rastid;
Raster *rast;
assert(x >= 0 && y >= 0);

	xmax = x + width;
	ymax = y + height;
	firstx = x;

	for(;;)
	{
		osy = y + w->behind.y;

		if((nexty = w->vchanges[y]) > ymax)
			dheight = ymax - y;
		else
			dheight = nexty - y;

		ydots = w->ydots[x];
		rastid = ydots[y];

		for(;;)
		{
			nextx = NEXTX(ydots);
			if(nextx >= xmax)
			{
				rast = w->rasts[rastid];
				XOR_RECT(rast,color,x + w->behind.x - rast->x,
						  osy - rast->y,xmax - x,dheight);
				if(nexty >= ymax)
					return;
				break; /* break for nextx loop */
			}
			ydots = w->ydots[nextx]; /* get next ydots for nextx and rastid */
			if(rastid == ydots[y]) /* if same continue and check next one */
				continue;
			rast = w->rasts[rastid];
			rastid = ydots[y];
			XOR_RECT(rast,color,x + w->behind.x - rast->x,
			  		  osy - rast->y,nextx - x,dheight);
			x = nextx;
		}
		x = firstx;
		y = nexty;
	}
}
static void
_win_mask1blit(UBYTE *mbytes, unsigned int mbpr, Coor mx, Coor my,
		Raster *wndo, Coor x, Coor y, Ucoor width, Ucoor height,
		Pixel oncolor)
{
Wndo *w = (Wndo *)wndo;
SHORT xmax, ymax;
SHORT nextx, nexty;
LONG firstx;
LONG firstmx;
LONG dheight;
SHORT osy;
UBYTE *ydots;
int rastid;
Raster *rast;

	xmax = x + width;
	ymax = y + height;
	firstx = x;
	firstmx = mx;

	for(;;)
	{
		osy = y + w->behind.y;
		if((nexty = w->vchanges[y]) > ymax)
			dheight = ymax - y;
		else
			dheight = nexty - y;

		ydots = w->ydots[x];
		rastid = ydots[y];

		for(;;)
		{
			nextx = NEXTX(ydots);
			if(nextx >= xmax)
			{
				rast = w->rasts[rastid];
				MASK1BLIT(mbytes,mbpr,mx,my,
							rast,x + w->behind.x - rast->x,osy - rast->y,
							xmax - x,dheight, oncolor );
				if(nexty >= ymax)
					return;
				break; /* break for nextx loop */
			}
			ydots = w->ydots[nextx]; /* get next ydots for nextx and rastid */
			if(rastid == ydots[y]) /* if same continue and check next one */
				continue;
			rast = w->rasts[rastid];
			rastid = ydots[y];
			MASK1BLIT(mbytes,mbpr,mx,my,rast,
					   x + w->behind.x - rast->x,osy - rast->y,
					   nextx - x,dheight, oncolor );
			mx += nextx - x;
			x = nextx;
		}
		x = firstx;
		mx = firstmx;
		my += nexty - y;
		y = nexty;
	}

}

static void
_win_mask2blit(UBYTE *mbytes, unsigned int mbpr, Coor mx, Coor my,
		Raster *wndo, Coor x, Coor y, Ucoor width, Ucoor height,
		Pixel oncolor, Pixel offcolor)
{
Wndo *w = (Wndo *)wndo;
SHORT xmax, ymax;
SHORT nextx, nexty;
LONG firstx;
LONG firstmx;
LONG dheight;
SHORT osy;
UBYTE *ydots;
int rastid;
Raster *rast;

	xmax = x + width;
	ymax = y + height;
	firstx = x;
	firstmx = mx;

	for(;;)
	{
		osy = y + w->behind.y;
		if((nexty = w->vchanges[y]) > ymax)
			dheight = ymax - y;
		else
			dheight = nexty - y;
		ydots = w->ydots[x];
		rastid = ydots[y];

		for(;;)
		{
			nextx = NEXTX(ydots);
			if(nextx >= xmax)
			{
				rast = w->rasts[rastid];
				MASK2BLIT(mbytes,mbpr,mx,my,
						   rast,x + w->behind.x - rast->x,osy - rast->y, 
						   xmax - x,dheight, oncolor, offcolor );
				if(nexty >= ymax)
					return;
				break; /* break for nextx loop */
			}
			ydots = w->ydots[nextx]; /* get next ydots for nextx and rastid */
			if(rastid == ydots[y]) /* if same continue and check next one */
				continue;
			rast = w->rasts[rastid];
			rastid = ydots[y];
			MASK2BLIT(mbytes,mbpr,mx,my,
					   rast,x + w->behind.x - rast->x,osy - rast->y, 
					   nextx - x,dheight, oncolor, offcolor );
			mx += nextx - x;
			x = nextx;
		}
		x = firstx;
		mx = firstmx;
		my += nexty - y;
		y = nexty;
	}

}
#ifdef SLUFFED
static check_set_mcalt(Wscreen *s,LONG start,LONG count, Rgb3 *ctab)
{
Rgb3 *ideals;
UBYTE mask;

	if((count += start) <= FIRST_MUCOLOR)
		return;

	if(start < FIRST_MUCOLOR)
	{
		ctab += FIRST_MUCOLOR - start;
		start = FIRST_MUCOLOR;
		ideals = s->mc_ideals;
		mask = 1;
	}
	else
	{
		ideals = &(s->mc_ideals[start - FIRST_MUCOLOR]);
		mask = 1 << (start - FIRST_MUCOLOR); 
	}

	while(start < count)
	{
		if(mask & s->mc_alt)
		{
			if(ideals->r != ctab->r
				|| ideals->g != ctab->g
				|| ideals->b != ctab->b)
			{
				s->mc_alt &= ~mask;
			}
		}
		++ideals;
		++ctab;
		mask <<= 1;
	}
}
#endif /* SLUFFED */
static void win_set_colors(Raster *wndo, LONG start, LONG count, void *ctab)
{
Wndo *w = (Wndo *)wndo;
Wscreen *s = w->W_screen;

	SET_COLORS(s->viscel,start,count,ctab);
	if(s->flags & WS_MUCOLORS_UP)
	{
#ifdef NOTNEEDED
		if(s->mc_alt)
			check_set_mcalt(s, count, start, ctab);
#endif /* NOTNEEDED */
		set_refresh(s);
	}
}
Ejemplo n.º 3
0
static void construct(CPU_plug_data **p)
{
  GConfValue *value;
  *p = g_malloc(sizeof(CPU_plug_data));
  CPU_plug_data * data = *p;
  gchar * svalue;
  data->max_width_left = -1;
  data->max_width_right = -1;
  data->timer = 100;
  data->user = 0;
  data->sys = 0;
  data->idle = 100;
  data->iowait = 0;

  data->emotive_text = FALSE;

  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_CPU_METER_NO_GTK_BG, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_CPU_METER_NO_GTK_BG, svalue = g_strdup("999999ee"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->bg);

  g_free(svalue);

  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_CPU_METER_NO_GTK_FG, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_CPU_METER_NO_GTK_FG, svalue = g_strdup("000000ff"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->fg);

  g_free(svalue);

  value = gconf_client_get(get_dashboard_gconf(), GCONF_CPU_SIZE_MULT, NULL);

  if (value)
  {
    data->size_mult = gconf_client_get_float(get_dashboard_gconf(), GCONF_CPU_SIZE_MULT, NULL);
  }
  else
  {
    data->size_mult = 1.72;
    gconf_client_set_float(get_dashboard_gconf(), GCONF_CPU_SIZE_MULT, data->size_mult, NULL);
  }

  value = gconf_client_get(get_dashboard_gconf(), GCONF_CPU_REFRESH, NULL);

  if (value)
  {
    data->refresh = gconf_client_get_int(get_dashboard_gconf(), GCONF_CPU_REFRESH, NULL);
  }
  else
  {
    data->refresh = 500;
    set_refresh(*p, data->refresh);
  }

  value = gconf_client_get(get_dashboard_gconf(), GCONF_CPU_METER, NULL);

  if (value)
  {
    data->shiny_graphs = gconf_client_get_bool(get_dashboard_gconf(), GCONF_CPU_METER, NULL);
  }
  else
  {
    data->shiny_graphs = TRUE;
    gconf_client_set_bool(get_dashboard_gconf(), GCONF_CPU_METER,
                          data->shiny_graphs, NULL);
  }

  value = gconf_client_get(get_dashboard_gconf(), GCONF_CPU_METER_USE_2_COLOUR_GRADIENT    , NULL);

  if (value)
  {
    data->two_colour_gradient = gconf_client_get_bool(get_dashboard_gconf(), GCONF_CPU_METER_USE_2_COLOUR_GRADIENT    , NULL);
  }
  else
  {
    data->two_colour_gradient = FALSE;
    gconf_client_set_bool(get_dashboard_gconf(), GCONF_CPU_METER_USE_2_COLOUR_GRADIENT, data->two_colour_gradient, NULL);
  }

  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_CPU_METER_START_COLOUR, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_CPU_METER_START_COLOUR, svalue = g_strdup("00FF10bb"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->colour_meter_start);

  g_free(svalue);
  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_CPU_METER_MIDDLE_COLOUR, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_CPU_METER_MIDDLE_COLOUR, svalue = g_strdup("EEC83177"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->colour_meter_middle);

  g_free(svalue);
  svalue = gconf_client_get_string(get_dashboard_gconf(), GCONF_CPU_METER_STOP_COLOUR, NULL);

  if (!svalue)
  {
    gconf_client_set_string(get_dashboard_gconf(), GCONF_CPU_METER_STOP_COLOUR, svalue = g_strdup("FF0010ee"), NULL);
  }

  awn_cairo_string_to_color(svalue, &data->colour_meter_end);

  g_free(svalue);
  //data->pats[] is initialized once i render.. then needs to be free'd in constructor

}
Ejemplo n.º 4
0
static gboolean _set_5000(GtkWidget *widget, GdkEventButton *event, CPU_plug_data *p)
{
  return set_refresh(p, 5000);
}