コード例 #1
0
status_t
ScreenManager::AcquireScreens(ScreenOwner* owner, int32* wishList,
	int32 wishCount, const char* target, bool force, ScreenList& list)
{
	BAutolock locker(this);
	int32 added = 0;

	// TODO: don't ignore the wish list

	for (int32 i = 0; i < fScreenList.CountItems(); i++) {
		screen_item* item = fScreenList.ItemAt(i);

		if (item->owner == NULL && list.AddItem(item->screen)) {
			item->owner = owner;
			added++;
		}
	}

#if TEST_MODE == 0 && !defined(__x86_64__)
	if (added == 0 && target != NULL) {
		// there's a specific target screen we want to initialize
		// TODO: right now we only support remote screens, but we could
		// also target specific accelerants to support other graphics cards
		HWInterface* interface;
		/*
		if (strncmp(target, "vnc:", 4) == 0)
			interface = new(nothrow) VNCHWInterface(target);
		else*/
		if (strncmp(target, "html5:", 6) == 0)
			interface = new(nothrow) HTML5HWInterface(target);
		else
			interface = new(nothrow) RemoteHWInterface(target);
		if (interface != NULL) {
			screen_item* item = _AddHWInterface(interface);
			if (item != NULL && list.AddItem(item->screen)) {
				item->owner = owner;
				added++;
			}
		}
	}
#endif // TEST_MODE == 0

	return added > 0 ? B_OK : B_ENTRY_NOT_FOUND;
}
コード例 #2
0
ファイル: VirtualScreen.cpp プロジェクト: mariuz/haiku
void
VirtualScreen::_Reset()
{
	ScreenList list;
	for (int32 i = 0; i < fScreenList.CountItems(); i++) {
		screen_item* item = fScreenList.ItemAt(i);

		list.AddItem(item->screen);
	}

	gScreenManager->ReleaseScreens(list);
	fScreenList.MakeEmpty();

	fFrame.Set(0, 0, 0, 0);
	fDrawingEngine = NULL;
	fHWInterface = NULL;
}