本文整理汇总了C++中ReleaseEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ ReleaseEvent函数的具体用法?C++ ReleaseEvent怎么用?C++ ReleaseEvent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReleaseEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NiFreeNat
// Release the NAT
void NiFreeNat(NAT *n)
{
// Validate arguments
if (n == NULL)
{
return;
}
// Complete management command
//NiFreeAdminAccept(n);
// Stop if the virtual host is running
Lock(n->lock);
{
if (n->Virtual != NULL)
{
StopVirtualHost(n->Virtual);
ReleaseVirtual(n->Virtual);
n->Virtual = NULL;
}
}
Unlock(n->lock);
// Release the settings
NiFreeConfig(n);
// Delete the object
ReleaseCedar(n->Cedar);
ReleaseEvent(n->HaltEvent);
DeleteLock(n->lock);
Free(n);
}
示例2: NiFreeNat
// NAT の解放
void NiFreeNat(NAT *n)
{
// 引数チェック
if (n == NULL)
{
return;
}
// 管理コマンド終了
//NiFreeAdminAccept(n);
// 仮想ホストが動作中の場合は停止
Lock(n->lock);
{
if (n->Virtual != NULL)
{
StopVirtualHost(n->Virtual);
ReleaseVirtual(n->Virtual);
n->Virtual = NULL;
}
}
Unlock(n->lock);
// 設定の解放
NiFreeConfig(n);
// オブジェクトの削除
ReleaseCedar(n->Cedar);
ReleaseEvent(n->HaltEvent);
DeleteLock(n->lock);
Free(n);
}
示例3: FindSpecificEventInQueue
void MacOpMessageLoop::DispatchAllPostedMessagesNow()
{
#ifdef USE_UNTESTED_DISPATCH_CODE
OpVector<EventRef> eventList;
OSStatus err;
EventRef nextEvent;
do
{
nextEvent = FindSpecificEventInQueue(gMainEventQueue, OperaEventComparatorProc, NULL);
if(nextEvent)
{
if(noErr == RemoveEventFromQueue(gMainEventQueue, nextEvent))
{
eventList.Add(&nextEvent);
}
}
} while(nextEvent);
if(eventList.GetCount() > 0)
{
for(int i = 0; i < eventList.GetCount(); i++)
{
nextEvent = *eventList.Get(i);
err = SendEventToEventTarget(nextEvent, GetEventDispatcherTarget());
ReleaseEvent(nextEvent);
}
}
#endif
}
示例4: NullPaFree
// Release
void NullPaFree(SESSION *s)
{
// Validate arguments
NULL_LAN *n;
BLOCK *b;
if (s == NULL || (n = s->PacketAdapter->Param) == NULL)
{
return;
}
n->Halt = true;
Set(n->Event);
WaitThread(n->PacketGeneratorThread, INFINITE);
ReleaseThread(n->PacketGeneratorThread);
LockQueue(n->PacketQueue);
{
while (b = GetNext(n->PacketQueue))
{
FreeBlock(b);
}
}
UnlockQueue(n->PacketQueue);
ReleaseQueue(n->PacketQueue);
ReleaseCancel(n->Cancel);
ReleaseEvent(n->Event);
s->PacketAdapter->Param = NULL;
Free(n);
}
示例5: TkMacOSXReceiveAndProcessEvent
OSStatus
TkMacOSXReceiveAndProcessEvent()
{
static EventTargetRef targetRef = NULL;
EventRef eventRef;
OSStatus err;
/*
* This is a poll, since we have already counted the events coming
* into this routine, and are guaranteed to have one waiting.
*/
err = ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &eventRef);
if (err == noErr) {
if (!targetRef) {
targetRef = GetEventDispatcherTarget();
}
TkMacOSXStartTclEventLoopCarbonTimer();
err = SendEventToEventTarget(eventRef,targetRef);
TkMacOSXStopTclEventLoopCarbonTimer();
#ifdef TK_MAC_DEBUG
if (err != noErr && err != eventLoopTimedOutErr
&& err != eventNotHandledErr
) {
char buf [256];
fprintf(stderr,
"RCNE SendEventToEventTarget (%s) failed, %d\n",
CarbonEventToAscii(eventRef, buf), (int)err);
}
#endif
ReleaseEvent(eventRef);
}
return err;
}
示例6: contentView
/*
Position the contentView (presumed to be a subview of the frameView) by
asking the content view for its metrics and positioning it appropriately.
*/
OSStatus PositionContentViewWithMetrics(HIViewRef frameView, HIViewRef contentView)
{
HIViewFrameMetrics metrics = { 0, 0, 0, 0 };
EventRef getMetricsEvent = NULL;
// First we check the frame metrics of the content view by asking it (politely) for the
// metrics it wants
verify_noerr(CreateEvent(NULL, kEventClassControl, kEventControlGetFrameMetrics, GetCurrentEventTime(), 0, &getMetricsEvent));
if(NULL != getMetricsEvent) {
SetEventParameter(getMetricsEvent, kEventParamDirectObject, typeControlRef, sizeof(contentView), &contentView);
SetEventParameter(getMetricsEvent, kEventParamControlFrameMetrics, typeControlFrameMetrics, sizeof(metrics), &metrics);
OSStatus result = SendEventToEventTarget(getMetricsEvent, HIObjectGetEventTarget((HIObjectRef)contentView));
if(result == noErr) {
verify_noerr(GetEventParameter(getMetricsEvent, kEventParamControlFrameMetrics, typeControlFrameMetrics, NULL, sizeof(metrics), NULL, &metrics));
}
ReleaseEvent(getMetricsEvent);
getMetricsEvent = NULL;
}
// Now we reposition the content view based on the metrics we got from it.
HIRect bounds, contentRect;
HIViewGetBounds(frameView, &bounds);
contentRect.origin.x = metrics.left;
contentRect.origin.y = metrics.top;
contentRect.size.width = bounds.size.width - (metrics.left + metrics.right);
contentRect.size.height = bounds.size.height - (metrics.top + metrics.bottom);
HIViewSetFrame(contentView, &contentRect);
return noErr;
}
示例7: _initReceiverQueue
void MessagePump::dispatchAll()
{
_initReceiverQueue();
while( true )
{
EventRef event;
if( _needGlobalLock )
Global::enterCarbon();
const OSStatus status = ReceiveNextEvent( 0, 0, 0.0, true, &event );
if( status == eventLoopTimedOutErr )
break;
if( status != noErr )
{
EQWARN << "ReceiveNextEvent failed: " << status << std::endl;
break;
}
EQVERB << "Dispatch Carbon event " << event << std::endl;
if( !_needGlobalLock )
Global::enterCarbon();
const EventTargetRef target = GetEventDispatcherTarget();
SendEventToEventTarget( event, target );
Global::leaveCarbon();
ReleaseEvent( event );
}
if( _needGlobalLock )
Global::leaveCarbon();
}
示例8: CreateCustomToolbarItem
//-----------------------------------------------------------------------------
// CreateCustomToolbarItem
//-----------------------------------------------------------------------------
// Our 'public' API to create our custom URL item.
//
HIToolbarItemRef
CreateCustomToolbarItem( CFStringRef inIdentifier, CFTypeRef inURL )
{
OSStatus err;
EventRef event;
UInt32 options = kHIToolbarItemAllowDuplicates;
HIToolbarItemRef result = NULL;
RegisterCustomToolbarItemClass();
err = CreateEvent( NULL, kEventClassHIObject, kEventHIObjectInitialize,
GetCurrentEventTime(), 0, &event );
require_noerr( err, CantCreateEvent );
SetEventParameter( event, kEventParamToolbarItemIdentifier, typeCFStringRef, sizeof( CFStringRef ), &inIdentifier );
SetEventParameter( event, kEventParamAttributes, typeUInt32, sizeof( UInt32 ), &options );
if ( inURL )
SetEventParameter( event, kEventParamToolbarItemConfigData, typeCFTypeRef, sizeof( CFTypeRef ), &inURL );
err = HIObjectCreate( kCustomToolbarItemClassID, event, (HIObjectRef*)&result );
check_noerr( err );
ReleaseEvent( event );
CantCreateEvent:
return result;
}
示例9: ReceiveNextEvent
void wxApp::MacDoOneEvent()
{
wxMacAutoreleasePool autoreleasepool;
EventRef theEvent;
s_inReceiveEvent = true ;
OSStatus status = ReceiveNextEvent(0, NULL, sleepTime, true, &theEvent) ;
s_inReceiveEvent = false ;
switch (status)
{
case eventLoopTimedOutErr :
if ( wxTheApp->ProcessIdle() )
sleepTime = kEventDurationNoWait ;
else
sleepTime = kEventDurationSecond;
break;
case eventLoopQuitErr :
// according to QA1061 this may also occur
// when a WakeUp Process is executed
break;
default:
MacHandleOneEvent( theEvent ) ;
ReleaseEvent( theEvent );
sleepTime = kEventDurationNoWait ;
break;
}
// repeaters
DeletePendingObjects() ;
wxMacProcessNotifierAndPendingEvents() ;
}
示例10: FreeTick64
// Release of the Tick64
void FreeTick64()
{
UINT i;
if (tk64 == NULL)
{
// Uninitialized
return;
}
// Termination process
tk64->Halt = true;
Set(halt_tick_event);
WaitThread(tk64->Thread, INFINITE);
ReleaseThread(tk64->Thread);
// Releasing process
for (i = 0;i < LIST_NUM(tk64->AdjustTime);i++)
{
ADJUST_TIME *t = LIST_DATA(tk64->AdjustTime, i);
Free(t);
}
ReleaseList(tk64->AdjustTime);
DeleteLock(tk64->TickLock);
Free(tk64);
tk64 = NULL;
ReleaseEvent(halt_tick_event);
halt_tick_event = NULL;
}
示例11: ReceiveNextEvent
void wxApp::MacDoOneEvent()
{
EventRef theEvent;
s_inReceiveEvent = true ;
OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
s_inReceiveEvent = false ;
if ( status == eventLoopTimedOutErr )
{
if ( wxTheApp->ProcessIdle() )
sleepTime = kEventDurationNoWait ;
else
sleepTime = kEventDurationSecond;
}
else if ( status == eventLoopQuitErr )
{
// according to QA1061 this may also occur when a WakeUp Process
// is executed
}
else
{
MacHandleOneEvent( theEvent ) ;
ReleaseEvent(theEvent);
sleepTime = kEventDurationNoWait ;
}
// repeaters
DeletePendingObjects() ;
wxMacProcessNotifierAndPendingEvents() ;
}
示例12: wxFAIL_MSG
bool wxApp::Yield(bool onlyIfNeeded)
{
if (s_inYield)
{
if ( !onlyIfNeeded )
{
wxFAIL_MSG( wxT("wxYield called recursively" ) );
}
return false;
}
#if wxUSE_THREADS
// Yielding from a non-gui thread needs to bail out, otherwise we end up
// possibly sending events in the thread too.
if ( !wxThread::IsMain() )
{
return true;
}
#endif // wxUSE_THREADS
s_inYield = true;
// by definition yield should handle all non-processed events
EventRef theEvent;
OSStatus status = noErr ;
while ( status == noErr )
{
s_inReceiveEvent = true ;
status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
s_inReceiveEvent = false ;
if ( status == eventLoopTimedOutErr )
{
// make sure next time the event loop will trigger idle events
sleepTime = kEventDurationNoWait ;
}
else if ( status == eventLoopQuitErr )
{
// according to QA1061 this may also occur when a WakeUp Process
// is executed
}
else
{
MacHandleOneEvent( theEvent ) ;
ReleaseEvent(theEvent);
}
}
wxMacProcessNotifierAndPendingEvents() ;
s_inYield = false;
return true;
}
示例13: PostCustomEvent
void PostCustomEvent(DWORD id, void *data, DWORD size)
{
EventRef e;
CreateEvent(NULL,'blah','blah',0,0,&e);
SetEventParameter(e,'evid',0,sizeof(id),&id);
SetEventParameter(e,'data',0,size,data);
PostEventToQueue(GetMainEventQueue(),e,kEventPriorityHigh);
ReleaseEvent(e);
}
示例14: RetainEvent
void QMacInputContext::setLastKeydownEvent(EventRef event)
{
EventRef tmpEvent = keydownEvent;
keydownEvent = event;
if (keydownEvent)
RetainEvent(keydownEvent);
if (tmpEvent)
ReleaseEvent(tmpEvent);
}
示例15: while
//--------------------------------------------------------------------------------//
void WindowEventUtilities::messagePump()
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
// Windows Message Loop (NULL means check all HWNDs belonging to this context)
MSG msg;
while( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
//GLX Message Pump
RenderWindowList::iterator win = _msWindows.begin();
RenderWindowList::iterator end = _msWindows.end();
Display* xDisplay = 0; // same for all windows
for (; win != end; win++)
{
XID xid;
XEvent event;
if (!xDisplay)
(*win)->getCustomAttribute("XDISPLAY", &xDisplay);
(*win)->getCustomAttribute("WINDOW", &xid);
while (XCheckWindowEvent (xDisplay, xid, StructureNotifyMask | VisibilityChangeMask | FocusChangeMask, &event))
{
GLXProc(*win, event);
}
// The ClientMessage event does not appear under any Event Mask
while (XCheckTypedWindowEvent (xDisplay, xid, ClientMessage, &event))
{
GLXProc(*win, event);
}
}
#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE && !defined __OBJC__ && !defined __LP64__
// OSX Message Pump
EventRef event = NULL;
EventTargetRef targetWindow;
targetWindow = GetEventDispatcherTarget();
// If we are unable to get the target then we no longer care about events.
if( !targetWindow ) return;
// Grab the next event, process it if it is a window event
while( ReceiveNextEvent( 0, NULL, kEventDurationNoWait, true, &event ) == noErr )
{
// Dispatch the event
SendEventToEventTarget( event, targetWindow );
ReleaseEvent( event );
}
#endif
}