当前位置: 首页>>代码示例>>C++>>正文


C++ BLooper::Unlock方法代码示例

本文整理汇总了C++中BLooper::Unlock方法的典型用法代码示例。如果您正苦于以下问题:C++ BLooper::Unlock方法的具体用法?C++ BLooper::Unlock怎么用?C++ BLooper::Unlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BLooper的用法示例。


在下文中一共展示了BLooper::Unlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

/**
	Quit()
	@case	Looper is unlocked
	@result	Prints message "ERROR - you must Lock a looper before calling
			Quit(), team=%ld, looper=%s\n"
 */
void
TQuitTest::QuitTest1()
{
	BLooper* looper = new BLooper;
	looper->Unlock();
	looper->Quit();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:13,代码来源:QuitTest.cpp

示例2: MakeFocus

void TTimeTextView::MakeFocus(bool focusState)
{
	BTextView::MakeFocus(focusState);
	
	// Inform target
	if ( focusState == false)
	{
		if (m_Target)
		{
			BLooper *looper = m_Target->Looper();
			
			if ( looper->Lock() )
			{
				CheckLastEdit();
				
				for (int16 index = 1; index < 5; index++)
					ConvertToTime(index);
				
				if (m_MessageID)
				{
					BMessage *message = new BMessage(m_MessageID);
					message->AddInt32("TheTime", m_Time);
					m_Target->MessageReceived( message);
					looper->Unlock();
					delete message;
				}
			}			
		}
	}
}
开发者ID:ModeenF,项目名称:UltraDV,代码行数:30,代码来源:TTimeTextView.cpp

示例3:

/**
	RemoveHandler(BHandler* handler)
	@case		handler doesn't belong to this looper, looper is unlocked
	@param		handler Valid BHandler pointer, not assigned to looper
	@results
 */
void TRemoveHandlerTest::RemoveHandler4()
{
	DEBUGGER_ESCAPE;

	BLooper Looper;
	BHandler Handler;
	Looper.Unlock();
	CPPUNIT_ASSERT(!Looper.RemoveHandler(&Handler));
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:15,代码来源:RemoveHandlerTest.cpp

示例4: gui_window_destroy

void gui_window_destroy(struct gui_window *g)
{
	if (!g)
		return;

	if (g->prev)
		g->prev->next = g->next;
	else
		window_list = g->next;

	if (g->next)
		g->next->prev = g->prev;


	LOG(("Destroying gui_window %p", g));
	assert(g != NULL);
	assert(g->bw != NULL);
	LOG(("     Scaffolding: %p", g->scaffold));
	LOG(("     Window name: %s", g->bw->name));

	if (g->view == NULL)
		return;
	if (!g->view->LockLooper())
		return;

	BLooper *looper = g->view->Looper();
	/* If we're a top-level gui_window, destroy our scaffold */
	if (g->toplevel) {
		g->view->RemoveSelf();
		delete g->view;
		nsbeos_scaffolding_destroy(g->scaffold);
	} else {
		g->view->RemoveSelf();
		delete g->view;
		looper->Unlock();
	}
	//XXX 
	//looper->Unlock();

#warning FIXME

#if 0 /* GTK */
	/* If we're a top-level gui_window, destroy our scaffold */
	if (g->scrolledwindow == NULL) {
	  	gtk_widget_destroy(GTK_WIDGET(g->viewport));
		nsgtk_scaffolding_destroy(g->scaffold);
	} else {
	  	gtk_widget_destroy(GTK_WIDGET(g->scrolledwindow));
	}
#endif

	free(g);

}
开发者ID:pcwalton,项目名称:NetSurf,代码行数:54,代码来源:window.cpp

示例5: Unlock

		void Unlock()
		{
			if (fHasLock)
			{
				BLooper *looper;
				fMessenger->Target(&looper);
				if (looper)
					looper->Unlock();
				fHasLock = false;
			}
		}
开发者ID:axeld,项目名称:driveencryption,代码行数:11,代码来源:PaneSwitch.cpp

示例6: MouseWatcher

int32 MouseWatcher(void* data)
{
	BMessenger* TheMessenger = (BMessenger*)data;
	BPoint PreviousPos;
	uint32 PreviousButtons;
	bool FirstCheck = true;
	BMessage MessageToSend;
	MessageToSend.AddPoint("where",BPoint(0,0));
	MessageToSend.AddInt32("buttons",0);
	MessageToSend.AddInt32("modifiers",0);
	while(true)
	{
		if (!TheMessenger->LockTarget())
		{
			delete TheMessenger;
			return 0;			// window is dead so exit
		}
		BLooper *TheLooper;
		BView* TheView = (BView*)TheMessenger->Target(&TheLooper);
		BPoint Where;
		uint32 Buttons;
		TheView->GetMouse(&Where,&Buttons,false);
		if(FirstCheck)
		{
			PreviousPos = Where;
			PreviousButtons = Buttons;
			FirstCheck = false;
		}
		bool Send = false;
		if(Buttons != PreviousButtons || Buttons == 0 || Where != PreviousPos)
		{
			if(Buttons == 0)
				MessageToSend.what = MW_MOUSE_UP;
			else if(Buttons != PreviousButtons)
				MessageToSend.what = MW_MOUSE_DOWN;
			else
				MessageToSend.what = MW_MOUSE_MOVED;
			MessageToSend.ReplacePoint("where",Where);
			MessageToSend.ReplaceInt32("buttons",Buttons);
			MessageToSend.ReplaceInt32("modifiers",modifiers());
			Send = true;
		}
		TheLooper->Unlock();
		if(Send)
			TheMessenger->SendMessage(&MessageToSend);
		if(Buttons == 0)
		{
			//Button was released
			delete TheMessenger;
			return 0;
		}
		snooze(50000);
	}
}
开发者ID:mariuz,项目名称:haiku,代码行数:54,代码来源:MouseWatcher.cpp

示例7:

/**
	SetNextHandler(BHandler* handler);
	NextHandler();
	@case			Handler1 belongs to a unlocked BLooper, Handler2 does not
	@param	handler	Valid BHandler pointer
	@results		NextHandler() returns BLooper
					debug message "The handler's looper must be locked before
					setting NextHandler"
 */
void TSetNextHandlerTest::SetNextHandler2()
{
	DEBUGGER_ESCAPE;

	BHandler Handler1;
	BHandler Handler2;
	BLooper Looper;
	Looper.AddHandler(&Handler1);
	Looper.Unlock();
	Handler1.SetNextHandler(&Handler2);
	CPPUNIT_ASSERT(Handler1.NextHandler() == &Looper);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:21,代码来源:SetNextHandlerTest.cpp

示例8: CallerFrame

static BRect CallerFrame(BMessenger& caller)
{
	BRect rect;
	if (caller.LockTarget())
	{
		BLooper* looper;
		caller.Target(&looper);
		BWindow* window = dynamic_cast<BWindow*>(looper);
		if (window)
			rect = window->Frame();
		looper->Unlock();
	}
	return rect;
}
开发者ID:HaikuArchives,项目名称:Pe,代码行数:14,代码来源:HDialog.cpp

示例9:

void
TDeskbarMenu::DetachedFromWindow()
{
	if (fBarView != NULL) {
		BLooper* looper = fBarView->Looper();
		if (looper != NULL && looper->Lock()) {
			fBarView->DragStop();
			looper->Unlock();
		}
	}

	// don't call BNavMenu::DetachedFromWindow
	// it sets the TypesList to NULL
	BMenu::DetachedFromWindow();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:15,代码来源:DeskbarMenu.cpp

示例10: Invoke

status_t
TBarMenuTitle::Invoke(BMessage* message)
{
	TBarView* barview = dynamic_cast<TBarApp*>(be_app)->BarView();
	if (barview) {
		BLooper* looper = barview->Looper();
		if (looper->Lock()) {
			// tell barview to add the refs to the deskbar menu
			barview->HandleDeskbarMenu(NULL);
			looper->Unlock();
		}
	}

	return BMenuItem::Invoke(message);
}
开发者ID:DonCN,项目名称:haiku,代码行数:15,代码来源:BarMenuTitle.cpp

示例11:

bool
BMessenger::LockTarget() const
{
	BLooper* looper = NULL;
	Target(&looper);
	if (looper != NULL && looper->Lock()) {
		if (looper->fMsgPort == fPort)
			return true;

		looper->Unlock();
		return false;
	}

	return false;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:15,代码来源:Messenger.cpp

示例12: IsTargetLocal

/*
	bool IsTargetLocal() const
	@case 3			this is initialized to local target with specific handler
	@results		should return true.
 */
void TargetTester::IsTargetLocalTest3()
{
	// create looper and handler
	status_t result = B_OK;
	BLooper *looper = new BLooper;
	looper->Run();
	LooperQuitter quitter(looper);
	BHandler *handler = new BHandler;
	HandlerDeleter deleter(handler);
	CHK(looper->Lock());
	looper->AddHandler(handler);
	looper->Unlock();
	// create the messenger and do the checks
	BMessenger messenger(handler, NULL, &result);
	CHK(messenger.IsTargetLocal() == true);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:21,代码来源:TargetTester.cpp

示例13: self

void
TTeamMenu::DetachedFromWindow()
{
	TBarView* barView = (dynamic_cast<TBarApp*>(be_app))->BarView();
	if (barView != NULL) {
		BLooper* looper = barView->Looper();
		if (looper != NULL && looper->Lock()) {
			barView->DragStop();
			looper->Unlock();
		}
	}

	BMenu::DetachedFromWindow();

	BMessenger self(this);
	TBarApp::Unsubscribe(self);
}
开发者ID:DonCN,项目名称:haiku,代码行数:17,代码来源:TeamMenu.cpp

示例14:

bool
BHandler::LockLooper()
{
	BLooper* looper = fLooper;
	// Locking the looper also makes sure that the looper is valid
	if (looper != NULL && looper->Lock()) {
		// Have we locked the right looper? That's as far as the
		// "pseudo-atomic" operation mentioned in the BeBook.
		if (fLooper == looper)
			return true;

		// we locked the wrong looper, bail out
		looper->Unlock();
	}

	return false;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:17,代码来源:Handler.cpp

示例15: AttachedToWindow

void
TWindowMenu::DetachedFromWindow()
{
	// in expando mode the teammenu will not call DragStop,
	// thus, it needs to be called from here
	TBarView *barview = (dynamic_cast<TBarApp*>(be_app))->BarView();
	if (barview && barview->Expando()) {
		BLooper *looper = barview->Looper();
		if (looper->Lock()) {
			Window()->Show();		// We changed the show level in AttachedToWindow().  Undo it.
			barview->DragStop();
			looper->Unlock();
		}
	}
	
	BMenu::DetachedFromWindow();
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:17,代码来源:WindowMenu.cpp


注:本文中的BLooper::Unlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。