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