コード例 #1
0
ファイル: display_rfb_mod.c プロジェクト: technosaurus/tekui
static TBOOL rfb_inittask(struct TTask *task)
{
	TAPTR TExecBase = TGetExecBase(task);
	RFBDISPLAY *mod = TGetTaskData(task);

	for (;;)
	{
		TTAGITEM *opentags = mod->rfb_OpenTags;
		TSTRPTR subname;
		
		/* Initialize rectangle pool */
		region_initpool(&mod->rfb_RectPool, TExecBase);
		
		/* list of free input messages: */
		TInitList(&mod->rfb_IMsgPool);

		/* list of all open visuals: */
		TInitList(&mod->rfb_VisualList);

		/* init fontmanager and default font */
		TInitList(&mod->rfb_FontManager.openfonts);

		/* Instance lock (currently needed for async VNC) */
		mod->rfb_InstanceLock = TCreateLock(TNULL);
		if (mod->rfb_InstanceLock == TNULL)
			break;
		
		/* Open sub device, if one is requested: */
		subname = (TSTRPTR) TGetTag(opentags, TVisual_DriverName,
			(TTAG) SUBDEVICE_NAME);
		if (subname)
		{
			TTAGITEM subtags[2];
			subtags[0].tti_Tag = TVisual_IMsgPort;
			subtags[0].tti_Value = TGetTag(opentags, TVisual_IMsgPort, TNULL);
			subtags[1].tti_Tag = TTAG_DONE;
			
			mod->rfb_RndRPort = TCreatePort(TNULL);
			if (mod->rfb_RndRPort == TNULL)
				break;
			mod->rfb_RndDevice = TOpenModule(subname, 0, subtags);
			if (mod->rfb_RndDevice == TNULL)
				break;
			mod->rfb_RndRequest = TAllocMsg(sizeof(struct TVRequest));
			if (mod->rfb_RndRequest == TNULL)
				break;
			mod->rfb_RndIMsgPort = TCreatePort(TNULL);
			if (mod->rfb_RndIMsgPort == TNULL)
				break;
		}

		TDBPRINTF(TDB_TRACE,("Instance init successful\n"));
		return TTRUE;
	}

	rfb_exittask(mod);
	return TFALSE;
}
コード例 #2
0
ファイル: display_rfb_mod.c プロジェクト: callcc/tekui
static TBOOL rfb_inittask(struct TTask *task)
{
	TAPTR TExecBase = TGetExecBase(task);
	struct rfb_Display *mod = TGetTaskData(task);

	for (;;)
	{
		TTAGITEM *opentags = mod->rfb_OpenTags;
		TSTRPTR subname;

		/* Initialize rectangle pool */
		region_initpool(&mod->rfb_RectPool, TExecBase);

		/* list of free input messages: */
		TInitList(&mod->rfb_IMsgPool);

		/* list of all open visuals: */
		TInitList(&mod->rfb_VisualList);

		/* init fontmanager and default font */
		TInitList(&mod->rfb_FontManager.openfonts);

		region_init(&mod->rfb_RectPool, &mod->rfb_DirtyRegion, TNULL);

		mod->rfb_PixBuf.tpb_Format = TVPIXFMT_UNDEFINED;
		mod->rfb_DevWidth = RFB_DEF_WIDTH;
		mod->rfb_DevHeight = RFB_DEF_HEIGHT;

		mod->rfb_Flags = RFBFL_BUFFER_CAN_RESIZE;

#if defined(ENABLE_LINUXFB)
		if (!rfb_linux_init(mod))
			break;
#endif
		/* Instance lock (currently needed for async VNC) */
		mod->rfb_InstanceLock = TCreateLock(TNULL);
		if (mod->rfb_InstanceLock == TNULL)
			break;

		/* Open sub device, if one is requested: */
		subname = (TSTRPTR) TGetTag(opentags, TVisual_DriverName,
			(TTAG) SUBDEVICE_NAME);
		if (subname)
		{
			TTAGITEM subtags[2];

			subtags[0].tti_Tag = TVisual_IMsgPort;
			subtags[0].tti_Value = TGetTag(opentags, TVisual_IMsgPort, TNULL);
			subtags[1].tti_Tag = TTAG_DONE;

			mod->rfb_RndRPort = TCreatePort(TNULL);
			if (mod->rfb_RndRPort == TNULL)
				break;
			mod->rfb_RndDevice = TOpenModule(subname, 0, subtags);
			if (mod->rfb_RndDevice == TNULL)
				break;
			mod->rfb_RndRequest = TAllocMsg(sizeof(struct TVRequest));
			if (mod->rfb_RndRequest == TNULL)
				break;
			mod->rfb_RndIMsgPort = TCreatePort(TNULL);
			if (mod->rfb_RndIMsgPort == TNULL)
				break;
		}

		TDBPRINTF(TDB_TRACE, ("Instance init successful\n"));
		return TTRUE;
	}

	rfb_exittask(mod);
	return TFALSE;
}