2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Runs the main native Cocoa run loop, interrupting it as needed to process
|
2014-11-18 13:28:42 -08:00
|
|
|
* Gecko events.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsAppShell_h_
|
|
|
|
#define nsAppShell_h_
|
|
|
|
|
2009-03-18 15:51:40 -07:00
|
|
|
class nsCocoaWindow;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsBaseAppShell.h"
|
2009-03-18 15:51:40 -07:00
|
|
|
#include "nsTArray.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-06 17:26:45 -07:00
|
|
|
// GeckoNSApplication
|
|
|
|
//
|
|
|
|
// Subclass of NSApplication for filtering out certain events.
|
|
|
|
@interface GeckoNSApplication : NSApplication
|
|
|
|
{
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
@class AppShellDelegate;
|
|
|
|
|
|
|
|
class nsAppShell : public nsBaseAppShell
|
|
|
|
{
|
|
|
|
public:
|
2007-09-19 12:17:06 -07:00
|
|
|
NS_IMETHOD ResumeNative(void);
|
2014-11-18 13:28:42 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAppShell();
|
|
|
|
|
|
|
|
nsresult Init();
|
|
|
|
|
|
|
|
NS_IMETHOD Run(void);
|
2007-09-19 12:17:06 -07:00
|
|
|
NS_IMETHOD Exit(void);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD OnProcessNextEvent(nsIThreadInternal *aThread, bool aMayWait,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aRecursionDepth);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD AfterProcessNextEvent(nsIThreadInternal *aThread,
|
2013-10-23 05:01:20 -07:00
|
|
|
uint32_t aRecursionDepth,
|
|
|
|
bool aEventWasProcessed);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// public only to be visible to Objective-C code that must call it
|
|
|
|
void WillTerminate();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~nsAppShell();
|
|
|
|
|
|
|
|
virtual void ScheduleNativeEventCallback();
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool ProcessNextNativeEvent(bool aMayWait);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-09-19 12:17:06 -07:00
|
|
|
static void ProcessGeckoEvents(void* aInfo);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
CFMutableArrayRef mAutoreleasePools;
|
|
|
|
|
|
|
|
AppShellDelegate* mDelegate;
|
2007-09-19 12:17:06 -07:00
|
|
|
CFRunLoopRef mCFRunLoop;
|
|
|
|
CFRunLoopSourceRef mCFRunLoopSource;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mRunningEventLoop;
|
|
|
|
bool mStarted;
|
|
|
|
bool mTerminated;
|
|
|
|
bool mSkippedNativeCallback;
|
|
|
|
bool mRunningCocoaEmbedded;
|
2007-09-19 12:17:06 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mNativeEventCallbackDepth;
|
2009-06-17 08:30:46 -07:00
|
|
|
// Can be set from different threads, so must be modified atomically
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mNativeEventScheduledDepth;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsAppShell_h_
|