Ejemplo n.º 1
0
Archivo: text.c Proyecto: antrik/libggi
int GGI_tele_puts(struct ggi_visual *vis, int x, int y, const char * s)
{
	ggi_tele_priv *priv = TELE_PRIV(vis);
	TeleCmdPutStrData *p;
	TeleEvent ev;
	int err = 0;
	unsigned int i = 0;

	T_Long * data;

	p = tclient_new_event(priv->client, &ev, TELE_CMD_PUTSTR,
				sizeof(TeleCmdPutStrData)-4,
				(signed)((strlen(s) + 1) * sizeof(T_Long)));

	p->x = (T_Long)(x);
	p->y = (T_Long)(y);
	p->length = (T_Long)strlen(s);
	p->fg = (T_Long)(LIBGGI_GC_FGCOLOR(vis));
	p->bg = (T_Long)(LIBGGI_GC_BGCOLOR(vis));

	data = (T_Long *)(p->text);

	for (i = 0 ; i <= strlen(s); ++i) {	/* Copy the trailing \0! */
		data[i] = (T_Long)(s[i]);
	}

	err = tclient_write(priv->client, &ev);

	if (err == TELE_ERROR_SHUTDOWN) {
		TELE_HANDLE_SHUTDOWN;
	}	/* if */

	return err;
}	/* GGI_tele_puts */
Ejemplo n.º 2
0
Archivo: text.c Proyecto: antrik/libggi
int GGI_tele_getcharsize(struct ggi_visual *vis, int *width, int *height)
{
	ggi_tele_priv *priv = TELE_PRIV(vis);
	TeleCmdGetCharSizeData *p;
	TeleEvent ev;
	int err;

        p = tclient_new_event(priv->client, &ev, TELE_CMD_GETCHARSIZE,
				sizeof(TeleCmdGetCharSizeData), 0);

	err = tclient_write(priv->client, &ev);

	if (err == TELE_ERROR_SHUTDOWN) {
		TELE_HANDLE_SHUTDOWN;
	} else if (err < 0) {
		return err;
	}	/* if */

	tele_receive_reply(vis, &ev, TELE_CMD_GETCHARSIZE,
			ev.sequence);

	*width = p->width;
	*height = p->height;

	return 0;
}	/* GGI_tele_getcharsize */
Ejemplo n.º 3
0
int tele_receive_reply(ggi_visual *vis, TeleEvent *ev, 
			   long type, long seq)
{
	ggi_tele_priv *priv = TELE_PRIV(vis);

	ev->size = 0;

	priv->wait_event = ev;
	priv->wait_type  = type;
	priv->wait_sequence = seq;

	DPRINT_EVENTS("display-tele: WAITING FOR (type=0x%08lx "
	              "seq=0x%08lx)\n", type, seq);

	for (;;) {
		struct timeval tv;

		tv.tv_sec = tv.tv_usec = 0;

		GII_tele_poll(priv->input, NULL);

		if (ev->size != 0) {
			break;
		}

		ggUSleep(MINSLEEPTIME);
	}

	DPRINT_EVENTS("display-tele: WAIT OVER (type=0x%08lx "
	              "seq=0x%08lx)\n", type, seq);

	priv->wait_event = NULL;

	return 0;
}
Ejemplo n.º 4
0
int GGI_tele_copybox(ggi_visual *vis, int x, int y, int w, int h,
			int nx, int ny)
{
	ggi_tele_priv *priv = TELE_PRIV(vis);
	TeleCmdCopyBoxData *p;
	TeleEvent ev;

	int err;

	LIBGGICLIP_COPYBOX(vis, x,y,w,h, nx,ny);

	p = tclient_new_event(priv->client, &ev, TELE_CMD_COPYBOX,
			      sizeof(TeleCmdCopyBoxData), 0);
	p->sx = x;
	p->sy = y;
	p->width  = w;
	p->height = h;
	p->dx = nx;
	p->dy = ny;
	
	err = tclient_write(priv->client, &ev);

	if (err == TELE_ERROR_SHUTDOWN) {
		TELE_HANDLE_SHUTDOWN;
	}	/* if */

	return err;
}	/* GGI_tele_copybox */
Ejemplo n.º 5
0
int GGI_tele_drawbox(ggi_visual *vis, int x, int y, int w, int h)
{
	ggi_tele_priv *priv = TELE_PRIV(vis);
	TeleCmdDrawBoxData *p;
	TeleEvent ev;

	int err;

	LIBGGICLIP_XYWH(vis, x, y, w, h);

	p = tclient_new_event(priv->client, &ev, TELE_CMD_DRAWBOX,
			      sizeof(TeleCmdDrawBoxData), 0);
	p->x = x;
	p->y = y;
	p->width  = w;
	p->height = h;
	p->pixel  = LIBGGI_GC_FGCOLOR(vis);

	err = tclient_write(priv->client, &ev);

	if (err == TELE_ERROR_SHUTDOWN) {
		TELE_HANDLE_SHUTDOWN;
	}	/* if */

	return err;
}	/* GGI_tele_drawbox */
Ejemplo n.º 6
0
int GGI_tele_drawline(struct ggi_visual *vis, int x,int y, int xe,int ye)
{
	ggi_tele_priv *priv = TELE_PRIV(vis);
	TeleCmdDrawLineData *p;
	TeleEvent ev;

	int err;

	p = tclient_new_event(priv->client, &ev, TELE_CMD_DRAWLINE,
			      sizeof(TeleCmdDrawLineData), 0);
	p->x = x;
	p->y = y;
	p->xe  = xe;
	p->ye = ye;
	p->pixel  = LIBGGI_GC_FGCOLOR(vis);

	err = tclient_write(priv->client, &ev);

	if (err == TELE_ERROR_SHUTDOWN) {
		TELE_HANDLE_SHUTDOWN;
	}	/* if */

	return err;
}	/* GGI_tele_drawline */