2006-05-10 17:30:15 +00:00
|
|
|
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2005-06-02 01:14:02 +00:00
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
/*
|
|
|
|
* Runs the main native Cocoa run loop, interrupting it as needed to process
|
2014-11-18 21:28:42 +00:00
|
|
|
* Gecko events.
|
2006-05-10 17:30:15 +00:00
|
|
|
*/
|
2005-06-02 01:14:02 +00:00
|
|
|
|
2007-01-18 06:34:07 +00:00
|
|
|
#ifndef nsAppShell_h_
|
|
|
|
#define nsAppShell_h_
|
2005-06-02 01:14:02 +00:00
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
#include "nsBaseAppShell.h"
|
2009-03-18 22:51:40 +00:00
|
|
|
#include "nsTArray.h"
|
2005-06-02 01:14:02 +00:00
|
|
|
|
2012-06-07 00:26:45 +00:00
|
|
|
// GeckoNSApplication
|
|
|
|
//
|
|
|
|
// Subclass of NSApplication for filtering out certain events.
|
|
|
|
@interface GeckoNSApplication : NSApplication
|
|
|
|
{
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
@class AppShellDelegate;
|
2005-06-02 01:14:02 +00:00
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
class nsAppShell : public nsBaseAppShell
|
|
|
|
{
|
|
|
|
public:
|
2017-11-06 03:37:28 +00:00
|
|
|
NS_IMETHOD ResumeNative(void) override;
|
2014-11-18 21:28:42 +00:00
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
nsAppShell();
|
2005-06-02 01:14:02 +00:00
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
nsresult Init();
|
2005-06-02 01:14:02 +00:00
|
|
|
|
2017-11-06 03:37:28 +00:00
|
|
|
NS_IMETHOD Run(void) override;
|
|
|
|
NS_IMETHOD Exit(void) override;
|
|
|
|
NS_IMETHOD OnProcessNextEvent(nsIThreadInternal *aThread, bool aMayWait) override;
|
2006-06-07 00:06:11 +00:00
|
|
|
NS_IMETHOD AfterProcessNextEvent(nsIThreadInternal *aThread,
|
2017-11-06 03:37:28 +00:00
|
|
|
bool aEventWasProcessed) override;
|
2006-06-01 18:35:47 +00:00
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
// public only to be visible to Objective-C code that must call it
|
2006-06-15 17:24:25 +00:00
|
|
|
void WillTerminate();
|
2006-05-10 17:30:15 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~nsAppShell();
|
|
|
|
|
2017-11-06 03:37:28 +00:00
|
|
|
virtual void ScheduleNativeEventCallback() override;
|
|
|
|
virtual bool ProcessNextNativeEvent(bool aMayWait) override;
|
2006-05-10 17:30:15 +00:00
|
|
|
|
2007-09-19 19:17:06 +00:00
|
|
|
static void ProcessGeckoEvents(void* aInfo);
|
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
protected:
|
2006-06-07 00:06:11 +00:00
|
|
|
CFMutableArrayRef mAutoreleasePools;
|
2006-05-10 17:30:15 +00:00
|
|
|
|
|
|
|
AppShellDelegate* mDelegate;
|
2007-09-19 19:17:06 +00:00
|
|
|
CFRunLoopRef mCFRunLoop;
|
|
|
|
CFRunLoopSourceRef mCFRunLoopSource;
|
2006-05-17 00:25:35 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mRunningEventLoop;
|
|
|
|
bool mStarted;
|
|
|
|
bool mTerminated;
|
|
|
|
bool mSkippedNativeCallback;
|
|
|
|
bool mRunningCocoaEmbedded;
|
2007-09-19 19:17:06 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mNativeEventCallbackDepth;
|
2009-06-17 15:30:46 +00:00
|
|
|
// Can be set from different threads, so must be modified atomically
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mNativeEventScheduledDepth;
|
2006-05-10 17:30:15 +00:00
|
|
|
};
|
|
|
|
|
2007-01-18 06:34:07 +00:00
|
|
|
#endif // nsAppShell_h_
|