static pascal OSErr AErapp (const AppleEvent *theEvent, AppleEvent *theReply, long refCon) { if (running) return (noErr); if (!cartOpen) { if (startopendlog) { if (SNES9X_OpenCart(NULL)) { SNES9X_Go(); QuitApplicationEventLoop(); } else AdjustMenus(); } } else { SNES9X_Go(); QuitApplicationEventLoop(); } return (noErr); }
static pascal OSErr AErapp(const AppleEvent *theEvent, AppleEvent *theReply, long refCon) { #pragma unused (theEvent, theReply, refCon) if (running) return noErr; if (!cartOpen) { if (startopendlog) { if (SNES9X_OpenCart(nil)) { SNES9X_Go(); QuitApplicationEventLoop(); } } } else { SNES9X_Go(); QuitApplicationEventLoop(); } return noErr; }
void wxApp::ExitMainLoop() { m_keepGoing = FALSE; #if wxMAC_USE_RAEL QuitApplicationEventLoop() ; #endif }
// If we get an open app event, we didn't get any files to open, so just // leave gracefully and the java app will continue to run. static OSErr OpenAppEventHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon) { QuitApplicationEventLoop(); gRunAppManager = true; return noErr; }
pascal OSStatus DoWindowClose (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { QuitApplicationEventLoop(); return noErr; }
static OSStatus MainWindowEventHandler ( EventHandlerCallRef nextHandler, EventRef event, void *userData) { OSStatus err = noErr; CARBON_GUI *me = (CARBON_GUI *)userData; switch (GetEventKind (event)) { case kEventWindowClose: QuitApplicationEventLoop(); break; // case kEventWindowGetClickActivation: /* TODO - propagate activation click to the right control */ // /* XXX - still not handled */ // return CallNextEventHandler(nextHandler,event); // break; case kEventWindowActivated: me->bringToFront(); break; case CG_RMCH_EVENT: /* a channel window has been closed */ int idx; GetEventParameter(event,CG_RMCH_EVENT_PARAM,typeCFIndex,NULL,sizeof(int),NULL,&idx); me->remove_channel(idx); break; default: err = eventNotHandledErr; break; } return err; }
// --------------------------------- void USys::exit() { #ifdef __USE_CARBON__ QuitApplicationEventLoop(); #else ::exit(0); #endif }
void wxEventLoop::Exit(int rc) { m_exitcode = rc; QuitApplicationEventLoop(); OnExit(); }
//------------------------------------------------------------------------ pascal OSStatus DoWindowClose (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { userData; QuitApplicationEventLoop (); return CallNextEventHandler (nextHandler, theEvent); }
static OSStatus handleWindowEvent(EventHandlerCallRef nextHandler, EventRef event, void *userData) { OSStatus err; // Get the window WindowRef window; err = GetEventParameter(event, kEventParamDirectObject, typeWindowRef, 0, sizeof(window), 0, &window); if (err != noErr) return err; // Handle the different kinds of events ::UInt32 eventKind = GetEventKind(event); switch (eventKind) { // Quit the application when the user closes the window case kEventWindowClose: QuitApplicationEventLoop(); return noErr; // Draw the contents of the window case kEventWindowDrawContent: redraw(); return noErr; case kEventWindowBoundsChanged: { // Update the GL context aglUpdateContext(win->getContext()); // Find out if we have a move or a resize situation ::UInt32 attributes; GetEventParameter(event, kEventParamAttributes, typeUInt32, 0, sizeof(attributes), 0, &attributes); if ((attributes & kWindowBoundsChangeSizeChanged) != 0) { // Get the new bounds of the window Rect bounds; GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, 0, sizeof(Rect), 0, &bounds); // Resize the OpenSG Window GLsizei width = bounds.right - bounds.left; GLsizei height = bounds.bottom - bounds.top; win->resize(width, height); // Redraw the whole window Rect portRect; GetWindowPortBounds(window, &portRect); InvalWindowRect(window, &portRect); } return noErr; } default: return eventNotHandledErr; } }
void shoes_sigint() { #ifdef SHOES_GTK gtk_main_quit(); #endif #ifdef SHOES_QUARTZ QuitApplicationEventLoop(); #endif }
static pascal OSErr AEquit (const AppleEvent *theEvent, AppleEvent *theReply, long refCon) { if (running) return (noErr); SNES9X_Quit(); QuitApplicationEventLoop(); return (noErr); }
static pascal OSErr AEquit(const AppleEvent *theEvent, AppleEvent *theReply, long refCon) { #pragma unused (theEvent, theReply, refCon) if (running) return noErr; SNES9X_Quit(); QuitApplicationEventLoop(); return noErr; }
static OSStatus handleKeyEvent(EventHandlerCallRef nextHandler, EventRef event, void *userData) { OSStatus err; // Try to determine the size of the text input ::UInt32 actualSize; err = GetEventParameter(event, kEventParamTextInputSendText, typeUnicodeText, 0, 0, &actualSize, 0); if (err != noErr) return err; // The input can actually consist of more than one character. // We are only interested in single character input if (actualSize == sizeof(UniChar)) { // Get the character unicode UniChar c; err = GetEventParameter(event, kEventParamTextInputSendText, typeUnicodeText, 0, sizeof(UniChar), 0, &c); if (err != noErr) return err; // Handle different keyboard commands CGLSetCurrentContext(win->getContext()); switch (c) { case kEscapeCharCode: QuitApplicationEventLoop(); break; case 'a': glDisable( GL_LIGHTING ); redraw(); break; case 's': glEnable( GL_LIGHTING ); redraw(); break; case 'z': glPolygonMode( GL_FRONT_AND_BACK, GL_POINT); redraw(); break; case 'x': glPolygonMode( GL_FRONT_AND_BACK, GL_LINE); redraw(); break; case 'c': glPolygonMode( GL_FRONT_AND_BACK, GL_FILL); redraw(); break; } } return noErr; }
//----------------------------------------------------------------------------// OSStatus MacCEGuiRendererSelector::commandHandler(UInt32 command) { OSStatus status = noErr; switch (command) { case 'ok ': QuitApplicationEventLoop(); break; case 'not!': d_cancelled = true; QuitApplicationEventLoop(); break; default: status = eventNotHandledErr; break; } return status; }
static void HandleSIGTERMFromRunLoop(CFFileDescriptorRef f, CFOptionFlags callBackTypes, void *info) // Called from the runloop when the process receives a SIGTERM. We log // this occurence (which is safe to do because we're not in an actual signal // handler, courtesy of the 'magic' in InstallHandleSIGTERMFromRunLoop) // and then tell the app to quit. { #pragma unused(f) #pragma unused(callBackTypes) #pragma unused(info) (void) asl_log(gASLClient, gASLMessage, ASL_LEVEL_INFO, "Got SIGTERM"); QuitApplicationEventLoop(); }
/** ui_stop_loop : void -> void <doc> Stop the native UI event loop. This method can only be called from the main thread. </doc> **/ static value ui_stop_loop() { if( !val_bool(ui_is_main()) ) neko_error(); # if defined(NEKO_WINDOWS) while( !PostMessage(data.wnd,WM_QUIT,0,0) ) Sleep(100); # elif defined(NEKO_MAC) QuitApplicationEventLoop(); # else gtk_main_quit(); # endif return val_null; }
static void MyDRBurnSessionProgressFinishNotificationCallBack(DRBurnSessionRef burnSession) { #pragma unused(burnSession) OSStatus err; fprintf(stderr, "Finish Progress Dialog.\n"); err = MyChooseFolder(); if (err != noErr) { QuitApplicationEventLoop(); } return; }
void BaseApp::closeWindow(const bool quit, const bool callUnLoad){ done = quit; if (callUnLoad){ onClose(); unload(); } exitAPI(); Widget::clean(); #if defined(__APPLE__) QuitApplicationEventLoop(); #endif }
static void MyNavEventCallBack(NavEventCallbackMessage callBackSelector, NavCBRecPtr callBackParms, void *callBackUD) { #pragma unused(callBackUD) NavDialogRef dialog; NavReplyRecord reply; AEDescList selection; AEKeyword keyword; DescType type; FSRef folder; Size size; long count; OSStatus err; assert(callBackParms != NULL); if (callBackSelector == kNavCBUserAction) { dialog = callBackParms->context; switch (callBackParms->userAction) { case kNavUserActionChoose: err = NavDialogGetReply(dialog, &reply); assert(err == noErr); selection = reply.selection; err = AECountItems(&selection, &count); assert(err == noErr && count == 1); // only one folder should be selected. err = AEGetNthPtr(&selection, 1, typeFSRef, &keyword, &type, &folder, sizeof(folder), &size); assert(err == noErr); NavDialogDispose(dialog); MyBurnFolder(folder); break; case kNavUserActionCancel: NavDialogDispose(dialog); DisposeNavEventUPP(gNavEventUPP); QuitApplicationEventLoop(); break; } } }
void WindowBase::DisableEvent() { if( !mIsEventEnable ) return; OSXWindowData *windowData = (OSXWindowData *) GetWRefCon(mWindowHandle); if(windowData != NULL) { if( windowData->StartedApplicationLoop ) QuitApplicationEventLoop(); PRCORE_ASSERT_EXCEPTION( noErr != RemoveEventHandler (windowData->EventHandlerReference) ); PRCORE_ASSERT_EXCEPTION( noErr != RemoveEventLoopTimer (windowData->EventMainLoopReference) ); windowData->EventMainLoopReference = NULL; delete windowData; } mIsEventEnable=false; }
static pascal OSErr AEodoc(const AppleEvent *theEvent, AppleEvent *theReply, long refCon) { OSErr err; FSRef ref; AEDescList docList; AEKeyword keywd; DescType rtype; Size acsize; long count; #pragma unused (theReply, refCon) if (running) return noErr; err = AEGetParamDesc(theEvent, keyDirectObject, typeAEList, &docList); if (err) return noErr; err = AECountItems(&docList, &count); if (err || (count != 1)) { err = AEDisposeDesc(&docList); return noErr; } err = AEGetNthPtr(&docList, 1, typeFSRef, &keywd, &rtype, &ref, sizeof(FSRef), &acsize); if (err == noErr) { if (SNES9X_OpenCart(&ref)) { SNES9X_Go(); QuitApplicationEventLoop(); } } err = AEDisposeDesc(&docList); return noErr; }
// -------------------------------------------------------------------------------------- static pascal OSErr quitApplicationAEHandler(const AppleEvent *appleEvent, AppleEvent *reply, long refcon) { #pragma unused (reply, refcon) OSErr error; DescType returnedType; Size actualSize; error = AEGetAttributePtr(appleEvent, keyMissedKeywordAttr, typeWildCard, &returnedType, NULL, 0, &actualSize); if (error == noErr) error = errAEParamMissed; else if (error == errAEDescNotFound) { QuitApplicationEventLoop(); error = noErr; } return error; }
OSStatus WindowHandler(EventHandlerCallRef next, EventRef event, void *data) { WindowRef window; UInt32 kind; // Get the event kind kind = GetEventKind(event); // Get the window GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(window), NULL, &window); // Switch on event kind switch (kind) { // Window close event case kEventWindowClose: // Quit the application, as it only has one window QuitApplicationEventLoop(); break; default: return eventNotHandledErr; } // Return ok return noErr; }
/* Constructor for CARBON_GUI class. */ CARBON_GUI::CARBON_GUI(int argc, char **argv, Stream_mixer *mix) : GUI(argc,argv,mix) { /* initialization stuff */ jmix = mix; memset(myLcd,0,sizeof(myLcd)); memset(myPos,0,sizeof(myPos)); vumeter=0; vuband=0; selectedChannel=NULL; memset(channel,0,sizeof(channel)); playlistManager=new PlaylistManager(); msgList=new Linklist(); /* init mutex used when accessing the statusbox buffer ... * this is needed because other threads can try to write status messages concurrently */ if(pthread_mutex_init(&_statusLock,NULL) == -1) { error("error initializing POSIX thread mutex creating a new CarbonChannel"); QuitApplicationEventLoop(); } // Create a Nib reference err = CreateNibReference(CFSTR("main"), &nibRef); if(err != noErr) error("Can't get NIB reference to obtain gui controls!!"); // Create the MainWindow using nib resource file err = CreateWindowFromNib(nibRef, CFSTR("MainWindow"), &window); if(err != noErr) { error("Can't create MainWindow!!"); QuitApplicationEventLoop(); } else { msg = new CarbonMessage(nibRef); /* make the main window also the frontmost one */ BringToFront(window); init_controls(); /* now create the menu to use for the menubar ... it's stored in nib */ err=CreateMenuFromNib(nibRef,CFSTR("MenuBar"),&mainMenu); if(err!=noErr) { msg->error("Can't create main menu (%d)!!",err); } /* install vumeter controls */ setupVumeters(); /* and the status box */ setupStatusWindow(); bufferInspector = new BufferInspector(window,nibRef,jmix); /* now we have to group windows together so if all are visible they will also be layered together */ err=CreateWindowGroup(kWindowGroupAttrLayerTogether,&mainGroup); err=SetWindowGroup(window,mainGroup); err=SetWindowGroup(vumeterWindow,mainGroup); err=SetWindowGroup(statusWindow,mainGroup); err=SetWindowGroup(bufferInspector->window,mainGroup); SetWindowGroupOwner(mainGroup,window); /* let's create a channel window for each active input channel */ unsigned int i; bool cc=false; for (i=0;i<MAX_CHANNELS;i++) { strcpy(ch_lcd[i],"00:00:00"); if(jmix->chan[i]) { CarbonChannel *newChan = new CarbonChannel(jmix,this,nibRef,i); channel[i] = newChan; /* if(i > 0) { RepositionWindow(channel[i]->window,channel[i-1]->window,kWindowCascadeOnParentWindow); } else { RepositionWindow(channel[i],window,kWindowCascadeOnParentWindow); } */ cc=true; } else { channel[i] = NULL; } } /* Ok, once MainWindow has been created and we have instantiated all acrive input channels, * we need an instance of CarbonStream to control the stream option window */ streamHandler = new CarbonStream(jmix,window,nibRef); /* by default we want at leat one active channel */ if(!cc) new_channel(); aboutWindow = new AboutWindow(window,nibRef); // The window was created hidden so show it. ShowWindow( window ); } }
void wxGUIEventLoop::DoStop() { QuitApplicationEventLoop(); }
void IdleFunc(void) { QuitApplicationEventLoop(); }
static pascal OSStatus MyCloseHandler( EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData ) { QuitApplicationEventLoop(); return noErr; }
void killrl_timercb(EventLoopTimerRef inTimer, void *udata) { #pragma unused(inTimer, udata) LOG0("Quitting app event loop"); QuitApplicationEventLoop(); }
static pascal OSErr AppleEventHandlerProc(const AppleEvent *theAppleEvent, AppleEvent* reply, SInt32 handlerRefcon) { OSErr err=errAEEventNotHandled, res=noErr; AEDescList docList; long itemsInList; AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments, NULL, FALSE); if((res=AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList))==noErr) { if((res=AECountItems(&docList, &itemsInList))==noErr) { Size currentSize=0; int valid=0,i; char *parm=NULL; play_tree_t *last_entry=NULL; files=play_tree_new(); for(i=1;i<=itemsInList;++i) { for(;;) { OSErr e; Size actualSize=0; AEKeyword keywd; DescType returnedType; if((e=AEGetNthPtr(&docList, i, typeFileURL, &keywd, &returnedType, (Ptr)parm, currentSize, &actualSize))==noErr) { if(actualSize>=currentSize) { currentSize=actualSize+1; parm=realloc(parm, currentSize); } else { parm[actualSize]=0; valid=1; break; } } else { valid=0; break; } } if(valid) { URL_t *url=url_new(parm); if(url && !strcmp(url->protocol,"file") && !strcmp(url->hostname,"localhost")) { play_tree_t *entry=play_tree_new(); url_unescape_string(url->file, url->file); play_tree_add_file(entry, url->file); add_entry(&files, &last_entry, entry); } url_free(url); } } if(parm) free(parm); err=noErr; } else mp_msg(MSGT_CFGPARSER, MSGL_ERR, "AECountItems() error %d\n", res); AEDisposeDesc(&docList); } else mp_msg(MSGT_CFGPARSER, MSGL_ERR, "AEGetParamDesc() error %d\n", res); QuitApplicationEventLoop(); return err; }