1998-05-20 22:02:14 +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/. */
|
1998-05-20 22:02:14 +00:00
|
|
|
|
|
|
|
#ifndef nsAppShell_h__
|
|
|
|
#define nsAppShell_h__
|
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
#include "nsBaseAppShell.h"
|
|
|
|
#include <windows.h>
|
2011-08-09 14:48:10 +00:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2013-09-19 04:24:34 +00:00
|
|
|
#include "mozilla/Mutex.h"
|
1998-05-20 22:02:14 +00:00
|
|
|
|
2013-02-11 21:56:59 +00:00
|
|
|
// The maximum time we allow before forcing a native event callback.
|
|
|
|
// In seconds.
|
|
|
|
#define NATIVE_EVENT_STARVATION_LIMIT 1
|
2012-11-02 11:54:44 +00:00
|
|
|
|
1998-05-20 22:02:14 +00:00
|
|
|
/**
|
|
|
|
* Native Win32 Application shell wrapper
|
|
|
|
*/
|
2006-05-10 17:30:15 +00:00
|
|
|
class nsAppShell : public nsBaseAppShell
|
1998-05-20 22:02:14 +00:00
|
|
|
{
|
2006-05-10 17:30:15 +00:00
|
|
|
public:
|
2010-11-29 16:25:16 +00:00
|
|
|
nsAppShell() :
|
2013-10-08 18:48:02 +00:00
|
|
|
mEventWnd(nullptr),
|
2013-09-19 04:24:34 +00:00
|
|
|
mNativeCallbackPending(false),
|
|
|
|
mLastNativeEventScheduledMutex("nsAppShell::mLastNativeEventScheduledMutex")
|
2010-11-29 16:25:16 +00:00
|
|
|
{}
|
2011-08-09 14:48:10 +00:00
|
|
|
typedef mozilla::TimeStamp TimeStamp;
|
2013-09-19 04:24:34 +00:00
|
|
|
typedef mozilla::Mutex Mutex;
|
2006-05-10 17:30:15 +00:00
|
|
|
|
|
|
|
nsresult Init();
|
2010-11-29 16:25:16 +00:00
|
|
|
void DoProcessMoreGeckoEvents();
|
2006-05-10 17:30:15 +00:00
|
|
|
|
2009-10-06 02:26:54 +00:00
|
|
|
static UINT GetTaskbarButtonCreatedMessage();
|
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
protected:
|
2009-12-18 05:54:02 +00:00
|
|
|
NS_IMETHOD Run();
|
2012-11-02 11:54:44 +00:00
|
|
|
NS_IMETHOD Exit();
|
2006-05-10 17:30:15 +00:00
|
|
|
virtual void ScheduleNativeEventCallback();
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool ProcessNextNativeEvent(bool mayWait);
|
2006-05-10 17:30:15 +00:00
|
|
|
virtual ~nsAppShell();
|
1998-05-20 22:02:14 +00:00
|
|
|
|
2006-05-10 17:30:15 +00:00
|
|
|
static LRESULT CALLBACK EventWindowProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
HWND mEventWnd;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mNativeCallbackPending;
|
2013-09-19 04:24:34 +00:00
|
|
|
|
|
|
|
Mutex mLastNativeEventScheduledMutex;
|
2011-08-09 14:48:10 +00:00
|
|
|
TimeStamp mLastNativeEventScheduled;
|
1998-05-20 22:02:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsAppShell_h__
|