1998-05-21 02:02:14 +04:00
|
|
|
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
2012-05-21 15:12:37 +04: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-21 02:02:14 +04:00
|
|
|
|
|
|
|
#ifndef nsAppShell_h__
|
|
|
|
#define nsAppShell_h__
|
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
#include "nsBaseAppShell.h"
|
|
|
|
#include <windows.h>
|
2017-03-15 18:55:50 +03:00
|
|
|
#include <vector>
|
2011-08-09 18:48:10 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2013-09-19 08:24:34 +04:00
|
|
|
#include "mozilla/Mutex.h"
|
1998-05-21 02:02:14 +04:00
|
|
|
|
2013-02-12 01:56:59 +04:00
|
|
|
// The maximum time we allow before forcing a native event callback.
|
|
|
|
// In seconds.
|
|
|
|
#define NATIVE_EVENT_STARVATION_LIMIT 1
|
2012-11-02 15:54:44 +04:00
|
|
|
|
1998-05-21 02:02:14 +04:00
|
|
|
/**
|
|
|
|
* Native Win32 Application shell wrapper
|
|
|
|
*/
|
2006-05-10 21:30:15 +04:00
|
|
|
class nsAppShell : public nsBaseAppShell {
|
|
|
|
public:
|
2010-11-29 19:25:16 +03:00
|
|
|
nsAppShell()
|
2013-10-08 22:48:02 +04:00
|
|
|
: mEventWnd(nullptr),
|
2013-09-19 08:24:34 +04:00
|
|
|
mNativeCallbackPending(false),
|
|
|
|
mLastNativeEventScheduledMutex(
|
|
|
|
"nsAppShell::mLastNativeEventScheduledMutex") {}
|
2011-08-09 18:48:10 +04:00
|
|
|
typedef mozilla::TimeStamp TimeStamp;
|
2013-09-19 08:24:34 +04:00
|
|
|
typedef mozilla::Mutex Mutex;
|
2006-05-10 21:30:15 +04:00
|
|
|
|
|
|
|
nsresult Init();
|
2010-11-29 19:25:16 +03:00
|
|
|
void DoProcessMoreGeckoEvents();
|
2006-05-10 21:30:15 +04:00
|
|
|
|
2009-10-06 06:26:54 +04:00
|
|
|
static UINT GetTaskbarButtonCreatedMessage();
|
|
|
|
|
2017-03-15 18:55:50 +03:00
|
|
|
NS_IMETHOD AfterProcessNextEvent(nsIThreadInternal* thread,
|
2018-02-06 09:46:57 +03:00
|
|
|
bool eventWasProcessed) final;
|
2017-03-15 18:55:50 +03:00
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
protected:
|
2017-11-06 06:37:28 +03:00
|
|
|
NS_IMETHOD Run() override;
|
|
|
|
NS_IMETHOD Exit() override;
|
2017-12-05 03:53:13 +03:00
|
|
|
|
|
|
|
#if defined(ACCESSIBILITY)
|
|
|
|
NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
|
|
|
|
const char16_t* aData) override;
|
|
|
|
#endif // defined(ACCESSIBILITY)
|
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
virtual void ScheduleNativeEventCallback();
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool ProcessNextNativeEvent(bool mayWait);
|
2006-05-10 21:30:15 +04:00
|
|
|
virtual ~nsAppShell();
|
1998-05-21 02:02:14 +04:00
|
|
|
|
2006-05-10 21:30:15 +04:00
|
|
|
static LRESULT CALLBACK EventWindowProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
HWND mEventWnd;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mNativeCallbackPending;
|
2013-09-19 08:24:34 +04:00
|
|
|
|
|
|
|
Mutex mLastNativeEventScheduledMutex;
|
2011-08-09 18:48:10 +04:00
|
|
|
TimeStamp mLastNativeEventScheduled;
|
2017-03-15 18:55:50 +03:00
|
|
|
std::vector<MSG> mMsgsToRepost;
|
1998-05-21 02:02:14 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsAppShell_h__
|