bool unloadPlayerWin() { ControlRef cRef; ControlID cID; OSStatus iErr; cID.signature = FOUR_CHAR_CODE('volu'); cID.id = 6; if (noErr != (iErr = GetControlByID(g_refPlayerWin, &cID, &cRef))) { /* We don't return false here since this is always called on the way out. */ fprintf(stderr, "unloadPlayerWin() - GetControlByID() failed, returning %lu!\n", (unsigned long) iErr); } else { SetControlAction(cRef, (ControlActionUPP) -1); } HideWindow(g_refPlayerWin); RemoveEventHandler(g_refSeekHdlr); RemoveEventHandler(g_refPlayerHdlr); DisposeWindow(g_refPlayerWin); DisposeEventHandlerUPP(g_lpfnPlayerProc); DisposeControlActionUPP(g_lpfnVolumeProc); return true; }
IGraphicsCarbon::~IGraphicsCarbon() { if (mTextEntryView) { RemoveEventHandler(mTextEntryHandler); mTextEntryHandler = 0; #if USE_MLTE TXNFocus(mTextEntryView, false); TXNClear(mTextEntryView); TXNDeleteObject(mTextEntryView); #else HIViewRemoveFromSuperview(mTextEntryView); #endif mTextEntryView = 0; mEdControl = 0; mEdParam = 0; } RemoveEventLoopTimer(mTimer); RemoveEventHandler(mControlHandler); RemoveEventHandler(mWindowHandler); mTimer = 0; mView = 0; // DisposeRgn(mRgn); }
void EventListenerManager::SetEventHandler(OnErrorEventHandlerNonNull* aHandler) { if (mIsMainThreadELM) { if (!aHandler) { RemoveEventHandler(nsGkAtoms::onerror, EmptyString()); return; } // Untrusted events are always permitted for non-chrome script // handlers. SetEventHandlerInternal(JS::NullPtr(), nsGkAtoms::onerror, EmptyString(), nsEventHandler(aHandler), !nsContentUtils::IsCallerChrome()); } else { if (!aHandler) { RemoveEventHandler(nullptr, NS_LITERAL_STRING("error")); return; } // Untrusted events are always permitted. SetEventHandlerInternal(JS::NullPtr(), nullptr, NS_LITERAL_STRING("error"), nsEventHandler(aHandler), true); } }
// Close out the console log windows along with the main emu window. // Note: This event only happens after a close event has occurred and was *not* veto'd. Ie, // it means it's time to provide an unconditional closure of said window. // void MainEmuFrame::OnCloseWindow(wxCloseEvent& evt) { if( IsBeingDeleted() ) return; CoreThread.Suspend(); bool isClosing = false; if( !evt.CanVeto() ) { // Mandatory destruction... isClosing = true; } else { // TODO : Add confirmation prior to exit here! // Problem: Suspend is often slow because it needs to wait until the current EE frame // has finished processing (if the GS or logging has incurred severe overhead this makes // closing PCSX2 difficult). A non-blocking suspend with modal dialog might suffice // however. --air //evt.Veto( true ); } sApp.OnMainFrameClosed( GetId() ); if( m_menubar.FindItem(MenuId_IsoSelector) ) m_menuCDVD.Remove(MenuId_IsoSelector); RemoveEventHandler( &wxGetApp().GetRecentIsoManager() ); wxGetApp().PostIdleAppMethod( &Pcsx2App::PrepForExit ); evt.Skip(); }
void wxApp::DoCleanUp() { if (!sm_isEmbedded) RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) ); if (!sm_isEmbedded) { AERemoveEventHandler( kCoreEventClass , kAEOpenDocuments , sODocHandler , FALSE ) ; AERemoveEventHandler( kInternetEventClass, kAEGetURL, sGURLHandler , FALSE ) ; AERemoveEventHandler( kCoreEventClass , kAEOpenApplication , sOAppHandler , FALSE ) ; AERemoveEventHandler( kCoreEventClass , kAEPrintDocuments , sPDocHandler , FALSE ) ; AERemoveEventHandler( kCoreEventClass , kAEReopenApplication , sRAppHandler , FALSE ) ; AERemoveEventHandler( kCoreEventClass , kAEQuitApplication , sQuitHandler , FALSE ) ; DisposeAEEventHandlerUPP( sODocHandler ) ; DisposeAEEventHandlerUPP( sGURLHandler ) ; DisposeAEEventHandlerUPP( sOAppHandler ) ; DisposeAEEventHandlerUPP( sPDocHandler ) ; DisposeAEEventHandlerUPP( sRAppHandler ) ; DisposeAEEventHandlerUPP( sQuitHandler ) ; } }
//------------------------------------------------------------------------ void cBitmapFontEditable::looseFocus(CDrawContext *pContext) { // Call this yet to avoid recursive call endEdit(); if(getFrame()->getFocusView() == this) { getFrame()->setFocusView(0); } #if WINDOWS // char newText[255]; // GetWindowText((HWND)platformControl, newText, 255); // strcpy (text, newText); DestroyWindow ((HWND)platformControl); #elif MAC if(gEventHandler) { RemoveEventHandler(gEventHandler); } gEventHandler = 0; #endif m_editing = false; setDirty(true); if(listener) { listener->valueChanged(pContext, this); } CControl::looseFocus(pContext); }
bool unloadInfoWin() { DataBrowserCallbacks dbc; ControlRef cRef; ControlID cID; cID.signature = FOUR_CHAR_CODE('tags'); cID.id = 16; if (noErr == GetControlByID(g_refInfoWin, &cID, &cRef)) { dbc.version = kDataBrowserLatestCallbacks; if (noErr == InitDataBrowserCallbacks(&dbc)) { SetDataBrowserCallbacks(cRef, &dbc); } } clearInfoWin(); HideWindow(g_refInfoWin); RemoveEventHandler(g_refInfoHdlr); DisposeWindow(g_refInfoWin); DisposeEventHandlerUPP(g_lpfnInfoProc); DisposeDataBrowserItemDataUPP(g_lpfnGSIDProc); /* Clean up any previous contents */ return true; }
//-------------------------------------------------------------------------------------------------// void OSXCarbonWindow::destroy(void) { if(!mCreated) return; if(mIsFullScreen) { // Handle fullscreen destruction destroyCGLFullscreen(); } else { // Handle windowed destruction // Destroy the Ogre context delete mContext; if(!mIsExternal) { // Remove the window from the Window listener WindowEventUtilities::_removeRenderWindow( this ); // Remove our event handler if(mEventHandlerRef) RemoveEventHandler(mEventHandlerRef); } } mActive = false; mClosed = true; mCreated = false; }
static void setup_menu_event_handler (void) { static gboolean is_setup = FALSE; EventHandlerUPP menu_event_handler_upp; EventHandlerRef menu_event_handler_ref; const EventTypeSpec menu_events[] = { { kEventClassCommand, kEventCommandProcess }, { kEventClassMenu, kEventMenuTargetItem }, { kEventClassMenu, kEventMenuOpening }, { kEventClassMenu, kEventMenuClosed } }; if (is_setup) return; /* FIXME: We might have to install one per window? */ menu_event_handler_upp = NewEventHandlerUPP (menu_event_handler_func); InstallEventHandler (GetApplicationEventTarget (), menu_event_handler_upp, GetEventTypeCount (menu_events), menu_events, 0, &menu_event_handler_ref); #if 0 /* FIXME: Remove the handler with: */ RemoveEventHandler(menu_event_handler_ref); DisposeEventHandlerUPP(menu_event_handler_upp); #endif is_setup = TRUE; }
wxTaskBarIcon::~wxTaskBarIcon() { //clean up event handler RemoveEventHandler((EventHandlerRef&)m_pEventHandlerRef); //restore old icon and menu to the dock RemoveIcon(); }
bool unloadAboutWin() { HideWindow(g_refAboutWin); RemoveEventHandler(g_refAboutHdlr); DisposeWindow(g_refAboutWin); DisposeEventHandlerUPP(g_lpfnAboutProc); return true; }
void wxApp::CleanUp() { #if wxUSE_TOOLTIPS wxToolTip::RemoveToolTips() ; #endif #ifdef __WXMAC_OSX__ if (m_macEventPosted) { CFRelease(m_macEventPosted); } m_macEventPosted = NULL; #endif // One last chance for pending objects to be cleaned up wxTheApp->DeletePendingObjects(); wxMacDestroyNotifierTable() ; #ifndef __DARWIN__ # if __option(profile) ProfilerDump( (StringPtr)"\papp.prof" ) ; ProfilerTerm() ; # endif #endif UMACleanupToolbox() ; if (s_macCursorRgn) { ::DisposeRgn((RgnHandle)s_macCursorRgn); } if (!sm_isEmbedded) { RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) ); } if (!sm_isEmbedded) { AERemoveEventHandler( kCoreEventClass , kAEOpenDocuments , sODocHandler , FALSE ) ; AERemoveEventHandler( kCoreEventClass , kAEOpenApplication , sOAppHandler , FALSE ) ; AERemoveEventHandler( kCoreEventClass , kAEPrintDocuments , sPDocHandler , FALSE ) ; AERemoveEventHandler( kCoreEventClass , kAEReopenApplication , sRAppHandler , FALSE ) ; AERemoveEventHandler( kCoreEventClass , kAEQuitApplication , sQuitHandler , FALSE ) ; DisposeAEEventHandlerUPP( sODocHandler ) ; DisposeAEEventHandlerUPP( sOAppHandler ) ; DisposeAEEventHandlerUPP( sPDocHandler ) ; DisposeAEEventHandlerUPP( sRAppHandler ) ; DisposeAEEventHandlerUPP( sQuitHandler ) ; } wxAppBase::CleanUp(); }
void IGraphicsCarbon::EndUserInput(bool commit) { if (mTextEntryHandler) { RemoveEventHandler(mTextEntryHandler); mTextEntryHandler = 0; } else { return; } if (commit) { // Get the text CharsHandle textHandle; TXNGetDataEncoded(mTextEntryView, kTXNStartOffset, kTXNEndOffset, &textHandle, kTXNTextData); // Check that we have some worthwhile data if (textHandle != NULL && GetHandleSize(textHandle) > 0) { const long textLength = GetHandleSize(textHandle); char txt[257]; strncpy(txt, *textHandle, (textLength > 255) ? 255 : textLength); txt[(textLength > 255) ? 255 : textLength] = '\0'; if (mEdParam) mGraphicsMac->SetFromStringAfterPrompt(mEdControl, mEdParam, txt); else mEdControl->TextFromTextEntry(txt); } } if (mTextEntryView) { TXNFocus(mTextEntryView, false); TXNClear(mTextEntryView); TXNDeleteObject(mTextEntryView); mTextEntryView = 0; } if (mIsComposited) { HIViewSetNeedsDisplay(mView, true); } else { mEdControl->SetDirty(false); mEdControl->Redraw(); } SetThemeCursor(kThemeArrowCursor); SetUserFocusWindow(kUserFocusAuto); mEdControl = 0; mEdParam = 0; }
//----------------------------------------------------------------------------- // wxDockTaskBarIcon Destructor // // Cleans up mac events and restores the old icon to the dock //----------------------------------------------------------------------------- wxDockTaskBarIcon::~wxDockTaskBarIcon() { // clean up event handler and event UPP RemoveEventHandler(m_eventHandlerRef); DisposeEventHandlerUPP(m_eventupp); // restore old icon and menu to the dock RemoveIcon(); }
TabbedWindow::~TabbedWindow( void ) { // remove the event handler RemoveEventHandler( fHandler ); // dispose of the window DisposeWindow( fWindowRef ); }
bool8 NPServerDialog (void) { OSStatus err; IBNibRef nibRef; npserver.dialogcancel = true; err = CreateNibReference(kMacS9XCFString, &nibRef); if (err == noErr) { WindowRef tWindowRef; err = CreateWindowFromNib(nibRef, CFSTR("ClientList"), &tWindowRef); if (err == noErr) { EventHandlerRef eref; EventLoopTimerRef tref; EventHandlerUPP eventUPP; EventLoopTimerUPP timerUPP; EventTypeSpec windowEvents[] = { { kEventClassCommand, kEventCommandProcess }, { kEventClassCommand, kEventCommandUpdateStatus } }; HIViewRef ctl; HIViewID cid = { 'Chse', 0 }; npserver.dialogprocess = kNPSDialogInit; eventUPP = NewEventHandlerUPP(NPServerDialogEventHandler); err = InstallWindowEventHandler(tWindowRef, eventUPP, GetEventTypeCount(windowEvents), windowEvents, (void *) tWindowRef, &eref); timerUPP = NewEventLoopTimerUPP(NPServerDialogTimerHandler); err = InstallEventLoopTimer(GetCurrentEventLoop(), 0.0f, 0.1f, timerUPP, (void *) tWindowRef, &tref); HIViewFindByID(HIViewGetRoot(tWindowRef), cid, &ctl); HIViewSetVisible(ctl, false); MoveWindowPosition(tWindowRef, kWindowServer, false); ShowWindow(tWindowRef); err = RunAppModalLoopForWindow(tWindowRef); HideWindow(tWindowRef); SaveWindowPosition(tWindowRef, kWindowServer); err = RemoveEventLoopTimer(tref); DisposeEventLoopTimerUPP(timerUPP); err = RemoveEventHandler(eref); DisposeEventHandlerUPP(eventUPP); CFRelease(tWindowRef); } DisposeNibReference(nibRef); } return (!npserver.dialogcancel); }
//-------------------------------------------------------------------------------------------------// void OSXCarbonWindow::destroy(void) { if(!mCreated) return; if(mIsFullScreen) { // Handle fullscreen destruction destroyCGLFullscreen(); } else { // Handle windowed destruction // Destroy the Ogre context if(mCGLContext) { OGRE_DELETE mCGLContext; mCGLContext = NULL; } if(mCarbonContext) { OGRE_DELETE mCarbonContext; mCarbonContext = NULL; } if(mContext) { // mContext is a reference to either the AGL or CGL context, already deleted. // Just clear the variable mContext = NULL; } if(!mIsExternal) { // Remove the window from the Window listener WindowEventUtilities::_removeRenderWindow( this ); // Remove our event handler if(mEventHandlerRef) RemoveEventHandler(mEventHandlerRef); } if(mAGLContext) aglDestroyContext(mAGLContext); if(mWindow) DisposeWindow(mWindow); } mActive = false; mClosed = true; mCreated = false; }
void CL_DisplayWindow_OpenGL::install_event_handler(EventTargetRef targ_ref, int remove_only) { static EventHandlerUPP window_handler_proc = 0; if (window_handler_proc == 0) window_handler_proc = NewEventHandlerUPP(&CL_DisplayWindow_OpenGL::on_window_event); static EventHandlerRef current_handler = 0; if (current_handler != 0) RemoveEventHandler(current_handler); if (remove_only) return; EventTypeSpec events[20]; events[0].eventClass = kEventClassKeyboard; events[0].eventKind = kEventRawKeyDown; events[1].eventClass = kEventClassKeyboard; events[1].eventKind = kEventRawKeyRepeat; events[2].eventClass = kEventClassKeyboard; events[2].eventKind = kEventRawKeyUp; events[3].eventClass = kEventClassMouse; events[3].eventKind = kEventMouseDown; events[4].eventClass = kEventClassMouse; events[4].eventKind = kEventMouseUp; events[5].eventClass = kEventClassMouse; events[5].eventKind = kEventMouseMoved; events[6].eventClass = kEventClassMouse; events[6].eventKind = kEventMouseWheelMoved; events[7].eventClass = kEventClassWindow; events[7].eventKind = kEventWindowCollapsing; events[8].eventClass = kEventClassWindow; events[8].eventKind = kEventWindowDrawContent; events[9].eventClass = kEventClassWindow; events[9].eventKind = kEventWindowShown; events[10].eventClass = kEventClassWindow; events[10].eventKind = kEventWindowClose; events[11].eventClass = kEventClassWindow; events[11].eventKind = kEventWindowActivated; events[12].eventClass = kEventClassWindow; events[12].eventKind = kEventWindowDeactivated; events[13].eventClass = kEventClassWindow; events[13].eventKind = kEventWindowBoundsChanged; events[14].eventClass = kEventClassWindow; events[14].eventKind = kEventWindowZoomed; events[15].eventClass = kEventClassWindow; events[15].eventKind = kEventWindowFocusAcquired; events[16].eventClass = kEventClassWindow; events[16].eventKind = kEventWindowFocusRelinquish; events[17].eventClass = kEventClassMouse; events[17].eventKind = kEventMouseDragged; events[18].eventClass = kEventClassKeyboard; events[18].eventKind = kEventRawKeyModifiersChanged; InstallEventHandler(targ_ref, window_handler_proc, 19, events, this, ¤t_handler); }
MacOpMessageLoop::~MacOpMessageLoop() { if (mHandlerRef) { RemoveEventHandler(mHandlerRef); } if (mHandlerUPP) { DisposeEventHandlerUPP(mHandlerUPP); } }
CWindow::~CWindow() { if (mHandlerRef) { RemoveEventHandler(mHandlerRef); mHandlerRef=NULL; } windowLayer->RemoveWindow(this); windowLayer=0L; }
cbStyledTextCtrl::~cbStyledTextCtrl() { //dtor // remove remaining event-handlers to avoid asserts in wx2.9 // the ymight be added by plugins (at least keybinder does it), but can not // be removed by them, because the EditorCclose-event is sent from EditorBase // after destroying the underlying editors (e.g. cbStyledTextCtrl). // Doing this here should not harm. while(GetEventHandler() != this) RemoveEventHandler(GetEventHandler()); }
void exit_mouse( short type) { (void) (type); RemoveEventHandler(_CEMouseTracker); _CEMouseTracker = NULL; DisposeEventHandlerUPP(_CEMouseTrackerUPP); _CEMouseTrackerUPP = NULL; MPDeleteCriticalRegion(CE_MouseLock); CE_MouseLock = NULL; }
void QMacInputContext::cleanup() { if(input_proc_handler) { RemoveEventHandler(input_proc_handler); input_proc_handler = 0; } if(input_proc_handlerUPP) { DisposeEventHandlerUPP(input_proc_handlerUPP); input_proc_handlerUPP = 0; } }
void XtRemoveEventTypeHandler( Widget widget, int type, XtPointer select_data, XtEventHandler proc, XtPointer closure) { WIDGET_TO_APPCON(widget); LOCK_APP(app); RemoveEventHandler(widget, select_data, type, TRUE, FALSE, proc, closure, FALSE); UNLOCK_APP(app); }
void XtRemoveRawEventHandler( Widget widget, EventMask eventMask, _XtBoolean other, XtEventHandler proc, XtPointer closure) { WIDGET_TO_APPCON(widget); LOCK_APP(app); RemoveEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other, proc, closure, TRUE); UNLOCK_APP(app); }
void doloop(void) { EventHandlerRef menu_event; EventHandlerUPP menu_upp; EventTypeSpec app_menu_events[]={{kEventClassCommand,kEventProcessCommand}}; menu_upp=NewEventHandlerUPP(app_event_menu); InstallEventHandler(GetApplicationEventTarget(),menu_upp,GetEventTypeCount(app_menu_events),app_menu_events,NULL,&menu_event); RunApplicationEventLoop(); RemoveEventHandler(menu_event); DisposeEventHandlerUPP(menu_upp); }
void LWFCore::RemoveEventHandler(string eventName, int id) { if (id < 0) return; int eventId = SearchEventId(eventName); if (eventId >= 0 && eventId < (int)data->events.size()) { RemoveEventHandler(eventId, id); } else { GenericEventHandlerDictionary::iterator it = m_genericEventHandlerDictionary.find(eventName); if (it != m_genericEventHandlerDictionary.end()) remove_if(it->second.begin(), it->second.end(), Pred(id)); } }
void QMacInputContext::cleanup() { #ifndef QT_MAC_USE_COCOA if(input_proc_handler) { RemoveEventHandler(input_proc_handler); input_proc_handler = 0; } if(input_proc_handlerUPP) { DisposeEventHandlerUPP(input_proc_handlerUPP); input_proc_handlerUPP = 0; } #endif }
COSXScreen::~COSXScreen() { disable(); m_events->adoptBuffer(NULL); m_events->removeHandler(CEvent::kSystem, m_events->getSystemTarget()); if (m_pmWatchThread) { // make sure the thread has setup the runloop. { CLock lock(m_pmMutex); while (!(bool)*m_pmThreadReady) { m_pmThreadReady->wait(); } } // now exit the thread's runloop and wait for it to exit LOG((CLOG_DEBUG "stopping watchSystemPowerThread")); CFRunLoopStop(m_pmRunloop); m_pmWatchThread->wait(); delete m_pmWatchThread; m_pmWatchThread = NULL; } delete m_pmThreadReady; delete m_pmMutex; m_events->removeHandler(m_events->forCOSXScreen().confirmSleep(), getEventTarget()); RemoveEventHandler(m_switchEventHandlerRef); #if defined(MAC_OS_X_VERSION_10_5) CGDisplayRemoveReconfigurationCallback(displayReconfigurationCallback, this); #else DMRemoveExtendedNotifyProc(m_displayManagerNotificationUPP, NULL, &m_PSN, 0); if (m_hiddenWindow) { ReleaseWindow(m_hiddenWindow); m_hiddenWindow = NULL; } if (m_userInputWindow) { ReleaseWindow(m_userInputWindow); m_userInputWindow = NULL; } #endif delete m_keyState; delete m_screensaver; }
CarbonEventHandler::~CarbonEventHandler() { if (mHandlers != NULL) { int count = CFDictionaryGetCount(mHandlers); EventHandlerRef *theHandlers = (EventHandlerRef*) malloc(count * sizeof(EventHandlerRef)); CFDictionaryGetKeysAndValues(mHandlers, NULL, (const void **)theHandlers); for (int i = 0; i < count; i++) RemoveEventHandler(theHandlers[i]); CFDictionaryRemoveAllValues(mHandlers); CFRelease (mHandlers); free(theHandlers); } }