本文整理汇总了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();
}
示例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;
}
}
}
}
}
示例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));
}
示例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);
}
示例5: Unlock
void Unlock()
{
if (fHasLock)
{
BLooper *looper;
fMessenger->Target(&looper);
if (looper)
looper->Unlock();
fHasLock = false;
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}