forked from mirrors/gecko-dev
When we call nsWindow::Show but Firefox is not foreground, we show the window and also flash it on the taskbar to get the user's attention. This is really annoying when restoring a session with `N` windows, as the user's taskbar ends up with all `N` of them stuck in a flashed state until the user goes through and manually activates every single window. There are several ways I thought of to address this, but I think the simplest one is just to track whether or not we're in the middle of restoring a session and skip flashing when we are doing so. Differential Revision: https://phabricator.services.mozilla.com/D76406
61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
|
/* 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/. */
|
|
|
|
#ifndef nsAppShell_h__
|
|
#define nsAppShell_h__
|
|
|
|
#include "nsBaseAppShell.h"
|
|
#include <windows.h>
|
|
#include <vector>
|
|
#include "mozilla/TimeStamp.h"
|
|
#include "mozilla/Mutex.h"
|
|
|
|
// The maximum time we allow before forcing a native event callback.
|
|
// In seconds.
|
|
#define NATIVE_EVENT_STARVATION_LIMIT 1
|
|
|
|
/**
|
|
* Native Win32 Application shell wrapper
|
|
*/
|
|
class nsAppShell : public nsBaseAppShell {
|
|
public:
|
|
nsAppShell()
|
|
: mEventWnd(nullptr),
|
|
mNativeCallbackPending(false),
|
|
mLastNativeEventScheduledMutex(
|
|
"nsAppShell::mLastNativeEventScheduledMutex") {}
|
|
typedef mozilla::TimeStamp TimeStamp;
|
|
typedef mozilla::Mutex Mutex;
|
|
|
|
nsresult Init();
|
|
void DoProcessMoreGeckoEvents();
|
|
|
|
static UINT GetTaskbarButtonCreatedMessage();
|
|
|
|
NS_IMETHOD AfterProcessNextEvent(nsIThreadInternal* thread,
|
|
bool eventWasProcessed) final;
|
|
|
|
protected:
|
|
NS_IMETHOD Run() override;
|
|
NS_IMETHOD Exit() override;
|
|
NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
|
|
const char16_t* aData) override;
|
|
|
|
virtual void ScheduleNativeEventCallback();
|
|
virtual bool ProcessNextNativeEvent(bool mayWait);
|
|
virtual ~nsAppShell();
|
|
|
|
static LRESULT CALLBACK EventWindowProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
protected:
|
|
HWND mEventWnd;
|
|
bool mNativeCallbackPending;
|
|
|
|
Mutex mLastNativeEventScheduledMutex;
|
|
TimeStamp mLastNativeEventScheduled;
|
|
std::vector<MSG> mMsgsToRepost;
|
|
};
|
|
|
|
#endif // nsAppShell_h__
|