2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
2000-03-21 06:42:00 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef Window_h__
|
|
|
|
#define Window_h__
|
|
|
|
|
2009-06-30 10:00:16 +04:00
|
|
|
/*
|
|
|
|
* nsWindow - Native window management and event handling.
|
|
|
|
*/
|
|
|
|
|
2016-04-19 23:51:25 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
1998-09-23 23:19:23 +04:00
|
|
|
#include "nsBaseWidget.h"
|
Bug 1373739 - Make headless compositing Windows-compatible, in addition to Linux. r=dvander
To make the HeadlessCompositorWidget work under Windows as well as Linux, I had
to change the way that I hooked it into the existing CompositorWidget system.
Under GTK, the CompositorWidgetInitData and CompositorWidgetDelegate types
provided the information needed by the headless compositor widget already (the
widget client size). On Windows, however, the definitions of these types
differ, and the client size information is simply retrieved from the platform
APIs when needed.
After this patch, CompositorWidgetDelegate is renamed to
PlatformCompositorWidgetDelegate, and a new base class called
CompositorWidgetDelegate is added with "AsPlatformSpecificDelegate()" and
"AsHeadlessCompositorWidget()" methods. In non-headless mode, widgets use
AsPlatformSpecificDelegate() to access the Windows- and GTK-specific delegate
APIs. In headless mode, AsHeadlessCompositorWidget() is used to access the
singular CompositorWidget implementation for headless. Meanwhile, the
CompositorWidgetInitData IPDL type is made into a union which always contains a
headless-specific HeadlessCompositorWidgetInitData struct and under GTK and
Windows also contains an {X11,Win}CompositorWidgetInitData struct.
This also includes a small patch to ensure that the GPU process and
hardware-accelerated compositing are always disabled under headless mode. These
features weren't activated by default in the Linux environments I tested in, but
did end up activating (and then promptly crashing Firefox) when I tested on
Windows.
MozReview-Commit-ID: CocPoHBDV7H
--HG--
extra : rebase_source : 4581fa63aa3a9f32a8dc2672015a35b9be01b20f
2017-07-07 03:45:34 +03:00
|
|
|
#include "CompositorWidget.h"
|
2013-01-07 19:18:11 +04:00
|
|
|
#include "nsWindowBase.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsdefs.h"
|
2010-04-16 21:37:16 +04:00
|
|
|
#include "nsIdleService.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsToolkit.h"
|
1998-04-18 03:45:07 +04:00
|
|
|
#include "nsString.h"
|
2008-04-18 18:36:05 +04:00
|
|
|
#include "nsTArray.h"
|
2013-12-09 08:44:57 +04:00
|
|
|
#include "gfxWindowsPlatform.h"
|
2009-06-29 23:36:16 +04:00
|
|
|
#include "gfxWindowsSurface.h"
|
|
|
|
#include "nsWindowDbg.h"
|
2009-06-24 04:26:11 +04:00
|
|
|
#include "cairo.h"
|
2010-12-07 05:06:31 +03:00
|
|
|
#include "nsITimer.h"
|
2013-08-19 14:15:55 +04:00
|
|
|
#include "nsRegion.h"
|
2013-09-24 14:04:14 +04:00
|
|
|
#include "mozilla/EventForwards.h"
|
2013-09-25 15:21:18 +04:00
|
|
|
#include "mozilla/MouseEvents.h"
|
2012-01-14 05:29:22 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2013-09-07 06:15:49 +04:00
|
|
|
#include "nsMargin.h"
|
2015-11-04 19:49:49 +03:00
|
|
|
#include "nsRegionFwd.h"
|
2012-01-14 05:29:22 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
#include "nsWinGesture.h"
|
2016-11-20 05:24:46 +03:00
|
|
|
#include "WinPointerEvents.h"
|
2015-12-04 19:59:14 +03:00
|
|
|
#include "WinUtils.h"
|
2009-08-14 03:04:39 +04:00
|
|
|
#include "WindowHook.h"
|
2009-10-06 06:26:54 +04:00
|
|
|
#include "TaskbarWindowPreview.h"
|
2009-08-14 03:04:39 +04:00
|
|
|
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-10-04 12:33:24 +04:00
|
|
|
#include "oleacc.h"
|
2012-05-29 05:18:45 +04:00
|
|
|
#include "mozilla/a11y/Accessible.h"
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-04-18 03:06:38 +04:00
|
|
|
|
2010-03-18 01:56:00 +03:00
|
|
|
#include "nsUXThemeData.h"
|
2011-08-26 11:43:56 +04:00
|
|
|
#include "nsIDOMMouseEvent.h"
|
2012-06-29 12:32:21 +04:00
|
|
|
#include "nsIIdleServiceInternal.h"
|
|
|
|
|
2015-12-11 09:15:57 +03:00
|
|
|
#include "IMMHandler.h"
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Forward class definitions
|
2004-05-20 07:14:41 +04:00
|
|
|
*/
|
2009-06-29 23:36:16 +04:00
|
|
|
|
|
|
|
class nsNativeDragTarget;
|
|
|
|
class nsIRollupListener;
|
|
|
|
class imgIContainer;
|
2008-08-30 12:57:48 +04:00
|
|
|
|
2012-05-03 12:35:02 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
class NativeKey;
|
2016-07-01 11:15:16 +03:00
|
|
|
class WinCompositorWidget;
|
2016-07-01 11:15:16 +03:00
|
|
|
struct MSGResult;
|
2012-05-03 12:35:02 +04:00
|
|
|
} // namespace widget
|
|
|
|
} // namespacw mozilla;
|
|
|
|
|
1998-04-15 03:20:49 +04:00
|
|
|
/**
|
2004-09-03 12:44:23 +04:00
|
|
|
* Native WIN32 window wrapper.
|
1998-04-15 03:20:49 +04:00
|
|
|
*/
|
|
|
|
|
2017-07-06 00:14:48 +03:00
|
|
|
class nsWindow final : public nsWindowBase
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
2012-01-14 05:29:22 +04:00
|
|
|
typedef mozilla::TimeStamp TimeStamp;
|
|
|
|
typedef mozilla::TimeDuration TimeDuration;
|
2009-08-14 03:04:39 +04:00
|
|
|
typedef mozilla::widget::WindowHook WindowHook;
|
2009-10-06 06:26:54 +04:00
|
|
|
typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
|
2012-05-03 12:35:02 +04:00
|
|
|
typedef mozilla::widget::NativeKey NativeKey;
|
2013-07-18 12:12:31 +04:00
|
|
|
typedef mozilla::widget::MSGResult MSGResult;
|
2015-12-11 09:15:57 +03:00
|
|
|
typedef mozilla::widget::IMEContext IMEContext;
|
Bug 1373739 - Make headless compositing Windows-compatible, in addition to Linux. r=dvander
To make the HeadlessCompositorWidget work under Windows as well as Linux, I had
to change the way that I hooked it into the existing CompositorWidget system.
Under GTK, the CompositorWidgetInitData and CompositorWidgetDelegate types
provided the information needed by the headless compositor widget already (the
widget client size). On Windows, however, the definitions of these types
differ, and the client size information is simply retrieved from the platform
APIs when needed.
After this patch, CompositorWidgetDelegate is renamed to
PlatformCompositorWidgetDelegate, and a new base class called
CompositorWidgetDelegate is added with "AsPlatformSpecificDelegate()" and
"AsHeadlessCompositorWidget()" methods. In non-headless mode, widgets use
AsPlatformSpecificDelegate() to access the Windows- and GTK-specific delegate
APIs. In headless mode, AsHeadlessCompositorWidget() is used to access the
singular CompositorWidget implementation for headless. Meanwhile, the
CompositorWidgetInitData IPDL type is made into a union which always contains a
headless-specific HeadlessCompositorWidgetInitData struct and under GTK and
Windows also contains an {X11,Win}CompositorWidgetInitData struct.
This also includes a small patch to ensure that the GPU process and
hardware-accelerated compositing are always disabled under headless mode. These
features weren't activated by default in the Linux environments I tested in, but
did end up activating (and then promptly crashing Firefox) when I tested on
Windows.
MozReview-Commit-ID: CocPoHBDV7H
--HG--
extra : rebase_source : 4581fa63aa3a9f32a8dc2672015a35b9be01b20f
2017-07-07 03:45:34 +03:00
|
|
|
typedef mozilla::widget::PlatformCompositorWidgetDelegate PlatformCompositorWidgetDelegate;
|
2014-11-18 07:59:17 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
2017-07-06 00:14:48 +03:00
|
|
|
explicit nsWindow(bool aIsChildWindow = false);
|
2004-09-03 12:44:23 +04:00
|
|
|
|
2007-08-07 19:18:36 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2004-09-03 12:44:23 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
friend class nsWindowGfx;
|
|
|
|
|
2013-01-07 19:18:11 +04:00
|
|
|
// nsWindowBase
|
2013-10-02 07:46:03 +04:00
|
|
|
virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
|
2015-11-13 12:37:02 +03:00
|
|
|
LayoutDeviceIntPoint* aPoint = nullptr) override;
|
2016-03-16 07:47:48 +03:00
|
|
|
virtual WidgetEventTime CurrentMessageWidgetEventTime() const override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) override;
|
|
|
|
virtual bool DispatchKeyboardEvent(mozilla::WidgetKeyboardEvent* aEvent) override;
|
|
|
|
virtual bool DispatchWheelEvent(mozilla::WidgetWheelEvent* aEvent) override;
|
|
|
|
virtual bool DispatchContentCommandEvent(mozilla::WidgetContentCommandEvent* aEvent) override;
|
|
|
|
virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) override;
|
|
|
|
virtual bool IsTopLevelWidget() override { return mIsTopWidgetWindow; }
|
2013-01-07 19:18:11 +04:00
|
|
|
|
2015-02-23 14:15:53 +03:00
|
|
|
using nsWindowBase::DispatchPluginEvent;
|
|
|
|
|
2013-01-07 19:18:11 +04:00
|
|
|
// nsIWidget interface
|
2016-01-13 10:32:55 +03:00
|
|
|
using nsWindowBase::Create; // for Create signature not overridden here
|
2016-08-19 02:03:17 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
|
|
|
|
nsNativeWidget aNativeParent,
|
|
|
|
const LayoutDeviceIntRect& aRect,
|
|
|
|
nsWidgetInitData* aInitData = nullptr)
|
|
|
|
override;
|
2016-08-10 03:04:11 +03:00
|
|
|
virtual void Destroy() override;
|
2016-12-16 02:54:11 +03:00
|
|
|
virtual void SetParent(nsIWidget *aNewParent) override;
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual nsIWidget* GetParent(void) override;
|
|
|
|
virtual float GetDPI() override;
|
2015-12-04 19:59:14 +03:00
|
|
|
double GetDefaultScaleInternal() final;
|
|
|
|
int32_t LogToPhys(double aValue) final;
|
|
|
|
mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScale() final
|
|
|
|
{
|
|
|
|
if (mozilla::widget::WinUtils::IsPerMonitorDPIAware()) {
|
|
|
|
return mozilla::DesktopToLayoutDeviceScale(1.0);
|
|
|
|
} else {
|
|
|
|
return mozilla::DesktopToLayoutDeviceScale(GetDefaultScaleInternal());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-21 03:12:54 +03:00
|
|
|
virtual void Show(bool aState) override;
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual bool IsVisible() const override;
|
2016-08-25 06:43:27 +03:00
|
|
|
virtual void ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY) override;
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
|
2015-12-04 19:59:14 +03:00
|
|
|
virtual const SizeConstraints GetSizeConstraints() override;
|
2016-12-19 12:54:03 +03:00
|
|
|
virtual void Move(double aX, double aY) override;
|
|
|
|
virtual void Resize(double aWidth, double aHeight, bool aRepaint) override;
|
|
|
|
virtual void Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
2016-12-16 02:54:02 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult
|
|
|
|
BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
2013-10-02 07:46:03 +04:00
|
|
|
int32_t aHorizontal,
|
2015-12-16 19:58:46 +03:00
|
|
|
int32_t aVertical) override;
|
2016-08-25 06:43:27 +03:00
|
|
|
virtual void PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate) override;
|
2016-08-22 02:15:49 +03:00
|
|
|
virtual void SetSizeMode(nsSizeMode aMode) override;
|
2017-06-22 10:27:05 +03:00
|
|
|
virtual void SuppressAnimation(bool aSuppress) override;
|
2016-12-19 12:54:16 +03:00
|
|
|
virtual void Enable(bool aState) override;
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual bool IsEnabled() const override;
|
2016-12-21 03:13:08 +03:00
|
|
|
virtual nsresult SetFocus(bool aRaise) override;
|
2016-08-19 02:03:04 +03:00
|
|
|
virtual LayoutDeviceIntRect GetBounds() override;
|
|
|
|
virtual LayoutDeviceIntRect GetScreenBounds() override;
|
|
|
|
virtual MOZ_MUST_USE nsresult GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
|
|
|
|
virtual LayoutDeviceIntRect GetClientBounds() override;
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
2015-12-16 19:58:46 +03:00
|
|
|
void SetBackgroundColor(const nscolor& aColor) override;
|
2016-12-21 03:13:08 +03:00
|
|
|
virtual nsresult SetCursor(imgIContainer* aCursor,
|
2015-12-16 19:58:46 +03:00
|
|
|
uint32_t aHotspotX, uint32_t aHotspotY) override;
|
2016-12-21 03:13:08 +03:00
|
|
|
virtual void SetCursor(nsCursor aCursor) override;
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
|
2015-07-13 13:44:36 +03:00
|
|
|
virtual bool PrepareForFullscreenTransition(nsISupports** aData) override;
|
|
|
|
virtual void PerformFullscreenTransition(FullscreenTransitionStage aStage,
|
|
|
|
uint16_t aDuration,
|
|
|
|
nsISupports* aData,
|
|
|
|
nsIRunnable* aCallback) override;
|
2016-08-19 02:27:28 +03:00
|
|
|
virtual nsresult MakeFullScreen(bool aFullScreen,
|
|
|
|
nsIScreen* aScreen = nullptr) override;
|
2016-12-16 02:54:12 +03:00
|
|
|
virtual void HideWindowChrome(bool aShouldHide) override;
|
2016-12-20 01:55:32 +03:00
|
|
|
virtual void Invalidate(bool aEraseBackground = false,
|
2011-10-08 05:52:09 +04:00
|
|
|
bool aUpdateNCArea = false,
|
|
|
|
bool aIncludeChildren = false);
|
2016-12-20 01:55:32 +03:00
|
|
|
virtual void Invalidate(const LayoutDeviceIntRect& aRect);
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType) override;
|
2015-06-15 18:08:51 +03:00
|
|
|
void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual void FreeNativeData(void * data, uint32_t aDataType) override;
|
2016-12-21 03:13:08 +03:00
|
|
|
virtual nsresult SetTitle(const nsAString& aTitle) override;
|
2016-12-16 02:54:11 +03:00
|
|
|
virtual void SetIcon(const nsAString& aIconSpec) override;
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual LayoutDeviceIntSize ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override;
|
2016-12-21 03:18:40 +03:00
|
|
|
virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
2015-12-16 19:58:46 +03:00
|
|
|
nsEventStatus& aStatus) override;
|
2016-08-22 02:16:50 +03:00
|
|
|
virtual void EnableDragDrop(bool aEnable) override;
|
2016-08-25 07:10:02 +03:00
|
|
|
virtual void CaptureMouse(bool aCapture) override;
|
2016-08-25 06:43:27 +03:00
|
|
|
virtual void CaptureRollupEvents(nsIRollupListener* aListener,
|
2015-12-16 19:58:46 +03:00
|
|
|
bool aDoCapture) override;
|
2016-12-16 02:54:02 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override;
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual bool HasPendingInputEvent() override;
|
2013-04-24 22:42:40 +04:00
|
|
|
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
2014-01-23 22:26:41 +04:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
2016-06-24 03:53:27 +03:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT) override;
|
Bug 1373739 - Make headless compositing Windows-compatible, in addition to Linux. r=dvander
To make the HeadlessCompositorWidget work under Windows as well as Linux, I had
to change the way that I hooked it into the existing CompositorWidget system.
Under GTK, the CompositorWidgetInitData and CompositorWidgetDelegate types
provided the information needed by the headless compositor widget already (the
widget client size). On Windows, however, the definitions of these types
differ, and the client size information is simply retrieved from the platform
APIs when needed.
After this patch, CompositorWidgetDelegate is renamed to
PlatformCompositorWidgetDelegate, and a new base class called
CompositorWidgetDelegate is added with "AsPlatformSpecificDelegate()" and
"AsHeadlessCompositorWidget()" methods. In non-headless mode, widgets use
AsPlatformSpecificDelegate() to access the Windows- and GTK-specific delegate
APIs. In headless mode, AsHeadlessCompositorWidget() is used to access the
singular CompositorWidget implementation for headless. Meanwhile, the
CompositorWidgetInitData IPDL type is made into a union which always contains a
headless-specific HeadlessCompositorWidgetInitData struct and under GTK and
Windows also contains an {X11,Win}CompositorWidgetInitData struct.
This also includes a small patch to ensure that the GPU process and
hardware-accelerated compositing are always disabled under headless mode. These
features weren't activated by default in the Linux environments I tested in, but
did end up activating (and then promptly crashing Firefox) when I tested on
Windows.
MozReview-Commit-ID: CocPoHBDV7H
--HG--
extra : rebase_source : 4581fa63aa3a9f32a8dc2672015a35b9be01b20f
2017-07-07 03:45:34 +03:00
|
|
|
void SetCompositorWidgetDelegate(CompositorWidgetDelegate* delegate) override;
|
2016-12-16 02:54:02 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override;
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
|
|
|
int32_t aNativeKeyCode,
|
|
|
|
uint32_t aModifierFlags,
|
2009-06-29 23:36:16 +04:00
|
|
|
const nsAString& aCharacters,
|
2015-04-14 18:36:36 +03:00
|
|
|
const nsAString& aUnmodifiedCharacters,
|
|
|
|
nsIObserver* aObserver) override;
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aNativeMessage,
|
2015-04-14 18:36:36 +03:00
|
|
|
uint32_t aModifierFlags,
|
|
|
|
nsIObserver* aObserver) override;
|
2012-04-12 01:55:21 +04:00
|
|
|
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
2015-04-14 18:36:36 +03:00
|
|
|
nsIObserver* aObserver) override
|
|
|
|
{ return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0, aObserver); }
|
2012-04-12 01:55:21 +04:00
|
|
|
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aNativeMessage,
|
2012-03-22 04:59:12 +04:00
|
|
|
double aDeltaX,
|
|
|
|
double aDeltaY,
|
|
|
|
double aDeltaZ,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aModifierFlags,
|
2015-04-14 18:36:36 +03:00
|
|
|
uint32_t aAdditionalFlags,
|
|
|
|
nsIObserver* aObserver) override;
|
2016-12-21 07:27:20 +03:00
|
|
|
virtual void SetInputContext(const InputContext& aContext,
|
2015-12-16 19:58:46 +03:00
|
|
|
const InputContextAction& aAction) override;
|
2016-12-21 07:27:20 +03:00
|
|
|
virtual InputContext GetInputContext() override;
|
|
|
|
virtual TextEventDispatcherListener*
|
2016-03-16 07:47:48 +03:00
|
|
|
GetNativeTextEventDispatcherListener() override;
|
2004-07-27 23:14:44 +04:00
|
|
|
#ifdef MOZ_XUL
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
|
|
|
|
virtual nsTransparencyMode GetTransparencyMode() override;
|
|
|
|
virtual void UpdateOpaqueRegion(const LayoutDeviceIntRegion& aOpaqueRegion) override;
|
2009-06-29 23:36:16 +04:00
|
|
|
#endif // MOZ_XUL
|
2016-12-21 03:13:08 +03:00
|
|
|
virtual nsresult SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
2015-12-16 19:58:46 +03:00
|
|
|
void SetDrawsInTitlebar(bool aState) override;
|
2015-11-26 08:42:59 +03:00
|
|
|
virtual void UpdateWindowDraggingRegion(const LayoutDeviceIntRegion& aRegion) override;
|
2009-02-10 23:56:51 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
|
|
|
|
virtual uint32_t GetMaxTouchPoints() const override;
|
2014-03-17 12:42:48 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Event helpers
|
|
|
|
*/
|
2015-08-26 15:56:59 +03:00
|
|
|
virtual bool DispatchMouseEvent(
|
|
|
|
mozilla::EventMessage aEventMessage,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam,
|
|
|
|
bool aIsContextMenuKey = false,
|
|
|
|
int16_t aButton =
|
|
|
|
mozilla::WidgetMouseEvent::eLeftButton,
|
|
|
|
uint16_t aInputSource =
|
2016-09-01 11:12:15 +03:00
|
|
|
nsIDOMMouseEvent::MOZ_SOURCE_MOUSE,
|
2016-11-20 05:24:46 +03:00
|
|
|
WinPointerInfo* aPointerInfo = nullptr);
|
2013-10-02 07:46:03 +04:00
|
|
|
virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aStatus);
|
2010-08-08 13:23:25 +04:00
|
|
|
void DispatchPendingEvents();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool DispatchPluginEvent(UINT aMessage,
|
2010-08-08 13:23:25 +04:00
|
|
|
WPARAM aWParam,
|
|
|
|
LPARAM aLParam,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aDispatchPendingEvents);
|
2010-08-08 13:23:25 +04:00
|
|
|
|
2012-10-28 08:24:02 +04:00
|
|
|
void SuppressBlurEvents(bool aSuppress); // Called from nsFilePicker
|
|
|
|
bool BlurEventsSuppressed();
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2013-06-27 19:03:58 +04:00
|
|
|
/**
|
|
|
|
* Return an accessible associated with the window.
|
|
|
|
*/
|
|
|
|
mozilla::a11y::Accessible* GetAccessible();
|
2009-06-29 23:36:16 +04:00
|
|
|
#endif // ACCESSIBILITY
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Window utilities
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
nsWindow* GetTopLevelWindow(bool aStopOnDialogOrPopup);
|
2009-06-29 23:36:16 +04:00
|
|
|
WNDPROC GetPrevWindowProc() { return mPrevWndProc; }
|
2009-08-14 03:04:39 +04:00
|
|
|
WindowHook& GetWindowHook() { return mWindowHook; }
|
2011-09-29 10:19:26 +04:00
|
|
|
nsWindow* GetParentWindow(bool aIncludeOwner);
|
2010-12-07 05:05:48 +03:00
|
|
|
// Get an array of all nsWindow*s on the main thread.
|
2016-11-14 22:47:01 +03:00
|
|
|
static nsTArray<nsWindow*> EnumAllWindows();
|
2009-05-04 02:20:11 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Misc.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool AutoErase(HDC dc);
|
2016-10-07 12:08:32 +03:00
|
|
|
bool WidgetTypeSupportsAcceleration() override;
|
2013-08-09 14:12:38 +04:00
|
|
|
|
2016-02-24 06:50:09 +03:00
|
|
|
void ForcePresent();
|
|
|
|
|
2011-07-07 16:02:07 +04:00
|
|
|
/**
|
|
|
|
* AssociateDefaultIMC() associates or disassociates the default IMC for
|
|
|
|
* the window.
|
|
|
|
*
|
|
|
|
* @param aAssociate TRUE, associates the default IMC with the window.
|
|
|
|
* Otherwise, disassociates the default IMC from the
|
|
|
|
* window.
|
|
|
|
* @return TRUE if this method associated the default IMC with
|
|
|
|
* disassociated window or disassociated the default IMC
|
|
|
|
* from associated window.
|
|
|
|
* Otherwise, i.e., if this method did nothing actually,
|
|
|
|
* FALSE.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool AssociateDefaultIMC(bool aAssociate);
|
2011-07-07 16:02:07 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasTaskbarIconBeenCreated() { return mHasTaskbarIconBeenCreated; }
|
2009-10-06 06:26:54 +04:00
|
|
|
// Called when either the nsWindow or an nsITaskbarTabPreview receives the noticiation that this window
|
|
|
|
// has its icon placed on the taskbar.
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetHasTaskbarIconBeenCreated(bool created = true) { mHasTaskbarIconBeenCreated = created; }
|
2009-10-06 06:26:54 +04:00
|
|
|
|
|
|
|
// Getter/setter for the nsITaskbarWindowPreview for this nsWindow
|
|
|
|
already_AddRefed<nsITaskbarWindowPreview> GetTaskbarPreview() {
|
|
|
|
nsCOMPtr<nsITaskbarWindowPreview> preview(do_QueryReferent(mTaskbarPreview));
|
|
|
|
return preview.forget();
|
|
|
|
}
|
|
|
|
void SetTaskbarPreview(nsITaskbarWindowPreview *preview) { mTaskbarPreview = do_GetWeakReference(preview); }
|
|
|
|
|
2016-08-25 06:43:26 +03:00
|
|
|
virtual void ReparentNativeWidget(nsIWidget* aNewParent) override;
|
2011-12-07 23:01:48 +04:00
|
|
|
|
|
|
|
// Open file picker tracking
|
|
|
|
void PickerOpen();
|
|
|
|
void PickerClosed();
|
|
|
|
|
2011-12-15 01:22:28 +04:00
|
|
|
bool const DestroyCalled() { return mDestroyCalled; }
|
2012-03-22 04:59:12 +04:00
|
|
|
|
2015-04-08 16:08:34 +03:00
|
|
|
bool IsPopup();
|
2017-07-12 19:06:00 +03:00
|
|
|
virtual bool ShouldUseOffMainThreadCompositing() override;
|
2014-02-13 20:53:50 +04:00
|
|
|
|
2015-12-11 09:15:57 +03:00
|
|
|
const IMEContext& DefaultIMC() const { return mDefaultIMC; }
|
|
|
|
|
2016-02-02 11:05:56 +03:00
|
|
|
virtual void SetCandidateWindowForPlugin(
|
|
|
|
const mozilla::widget::CandidateWindowPosition&
|
|
|
|
aPosition) override;
|
2015-12-29 16:57:38 +03:00
|
|
|
virtual void DefaultProcOfPluginEvent(
|
|
|
|
const mozilla::WidgetPluginEvent& aEvent) override;
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
virtual nsresult OnWindowedPluginKeyEvent(
|
|
|
|
const mozilla::NativeEventData& aKeyEventData,
|
|
|
|
nsIKeyEventInPluginCallback* aCallback) override;
|
2015-12-29 16:57:38 +03:00
|
|
|
|
2016-07-01 11:15:16 +03:00
|
|
|
void GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData) override;
|
2016-08-31 00:32:08 +03:00
|
|
|
bool IsTouchWindow() const { return mTouchWindow; }
|
2017-05-10 20:48:16 +03:00
|
|
|
bool SynchronouslyRepaintOnResize() override;
|
2016-05-05 08:00:13 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
2014-07-16 00:37:58 +04:00
|
|
|
virtual ~nsWindow();
|
2005-02-23 10:07:51 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void WindowUsesOMTC() override;
|
2015-04-29 23:29:34 +03:00
|
|
|
virtual void RegisterTouchWindow() override;
|
2013-08-09 03:32:26 +04:00
|
|
|
|
2010-12-28 13:16:43 +03:00
|
|
|
// A magic number to identify the FAKETRACKPOINTSCROLLABLE window created
|
|
|
|
// when the trackpoint hack is enabled.
|
|
|
|
enum { eFakeTrackPointScrollableID = 0x46545053 };
|
|
|
|
|
2016-03-14 21:35:59 +03:00
|
|
|
// Used for displayport suppression during window resize
|
|
|
|
enum ResizeState {
|
|
|
|
NOT_RESIZING,
|
|
|
|
IN_SIZEMOVE,
|
|
|
|
RESIZING,
|
|
|
|
MOVING
|
|
|
|
};
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Callbacks
|
|
|
|
*/
|
|
|
|
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
2010-08-16 23:25:13 +04:00
|
|
|
static LRESULT CALLBACK WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
static BOOL CALLBACK BroadcastMsgToChildren(HWND aWnd, LPARAM aMsg);
|
|
|
|
static BOOL CALLBACK BroadcastMsg(HWND aTopWindow, LPARAM aMsg);
|
|
|
|
static BOOL CALLBACK DispatchStarvedPaints(HWND aTopWindow, LPARAM aMsg);
|
2010-08-02 17:34:54 +04:00
|
|
|
static BOOL CALLBACK RegisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
|
|
|
|
static BOOL CALLBACK UnregisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
|
2004-09-03 12:44:23 +04:00
|
|
|
static LRESULT CALLBACK MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM lParam);
|
|
|
|
static LRESULT CALLBACK MozSpecialWndProc(int code, WPARAM wParam, LPARAM lParam);
|
|
|
|
static LRESULT CALLBACK MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam);
|
|
|
|
static VOID CALLBACK HookTimerForPopups( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime );
|
2010-08-20 07:40:51 +04:00
|
|
|
static BOOL CALLBACK ClearResourcesCallback(HWND aChild, LPARAM aParam);
|
2010-12-07 05:05:48 +03:00
|
|
|
static BOOL CALLBACK EnumAllChildWindProc(HWND aWnd, LPARAM aParam);
|
|
|
|
static BOOL CALLBACK EnumAllThreadWindowProc(HWND aWnd, LPARAM aParam);
|
2004-09-03 12:44:23 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Window utilities
|
|
|
|
*/
|
|
|
|
LPARAM lParamToScreen(LPARAM lParam);
|
|
|
|
LPARAM lParamToClient(LPARAM lParam);
|
|
|
|
virtual void SubclassWindow(BOOL bState);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool CanTakeFocus();
|
2012-08-22 19:56:38 +04:00
|
|
|
bool UpdateNonClientMargins(int32_t aSizeMode = -1, bool aReflowWindow = true);
|
2011-09-29 10:19:26 +04:00
|
|
|
void UpdateGetWindowInfoCaptionStatus(bool aActiveCaption);
|
2010-07-16 10:20:02 +04:00
|
|
|
void ResetLayout();
|
2010-08-10 05:49:35 +04:00
|
|
|
void InvalidateNonClientRegion();
|
|
|
|
HRGN ExcludeNonClientFromPaintRegion(HRGN aRegion);
|
2015-07-10 03:15:48 +03:00
|
|
|
static const wchar_t* GetMainWindowClass();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasGlass() const {
|
2010-08-18 07:07:10 +04:00
|
|
|
return mTransparencyMode == eTransparencyGlass ||
|
|
|
|
mTransparencyMode == eTransparencyBorderlessGlass;
|
|
|
|
}
|
2013-12-31 04:41:37 +04:00
|
|
|
HWND GetOwnerWnd() const
|
|
|
|
{
|
|
|
|
return ::GetWindow(mWnd, GW_OWNER);
|
|
|
|
}
|
|
|
|
bool IsOwnerForegroundWindow() const
|
|
|
|
{
|
|
|
|
HWND owner = GetOwnerWnd();
|
|
|
|
return owner && owner == ::GetForegroundWindow();
|
|
|
|
}
|
|
|
|
bool IsPopup() const
|
|
|
|
{
|
|
|
|
return mWindowType == eWindowType_popup;
|
|
|
|
}
|
|
|
|
|
2004-09-03 12:44:23 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Event processing helpers
|
|
|
|
*/
|
2012-08-15 22:52:42 +04:00
|
|
|
void DispatchFocusToTopLevelWindow(bool aIsActivate);
|
2015-08-26 15:56:59 +03:00
|
|
|
bool DispatchStandardEvent(mozilla::EventMessage aMsg);
|
2009-06-29 23:36:16 +04:00
|
|
|
void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool ProcessMessage(UINT msg, WPARAM &wParam,
|
2009-05-04 02:20:11 +04:00
|
|
|
LPARAM &lParam, LRESULT *aRetValue);
|
2013-07-18 12:12:31 +04:00
|
|
|
bool ExternalHandlerProcessMessage(
|
|
|
|
UINT aMessage, WPARAM& aWParam,
|
|
|
|
LPARAM& aLParam, MSGResult& aResult);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ProcessMessageForPlugin(const MSG &aMsg,
|
2013-07-18 12:12:31 +04:00
|
|
|
MSGResult& aResult);
|
2008-12-15 06:54:54 +03:00
|
|
|
LRESULT ProcessCharMessage(const MSG &aMsg,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aEventDispatched);
|
2008-12-15 06:54:54 +03:00
|
|
|
LRESULT ProcessKeyUpMessage(const MSG &aMsg,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aEventDispatched);
|
2008-12-15 06:54:54 +03:00
|
|
|
LRESULT ProcessKeyDownMessage(const MSG &aMsg,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aEventDispatched);
|
2013-12-31 04:41:36 +04:00
|
|
|
static bool EventIsInsideWindow(nsWindow* aWindow);
|
2009-06-29 23:36:16 +04:00
|
|
|
// Convert nsEventStatus value to a windows boolean
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool ConvertStatus(nsEventStatus aStatus);
|
2011-11-08 23:59:09 +04:00
|
|
|
static void PostSleepWakeNotification(const bool aIsSleepMode);
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t ClientMarginHitTestPoint(int32_t mx, int32_t my);
|
2016-03-16 07:47:48 +03:00
|
|
|
TimeStamp GetMessageTimeStamp(LONG aEventTime) const;
|
2014-06-06 09:29:49 +04:00
|
|
|
static void UpdateFirstEventTime(DWORD aEventTime);
|
2016-03-14 21:35:59 +03:00
|
|
|
void FinishLiveResizing(ResizeState aNewState);
|
2017-02-24 16:32:00 +03:00
|
|
|
nsIntPoint GetTouchCoordinates(WPARAM wParam, LPARAM lParam);
|
2008-12-15 06:54:54 +03:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Event handlers
|
|
|
|
*/
|
2015-12-16 19:58:46 +03:00
|
|
|
virtual void OnDestroy() override;
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool OnResize(nsIntRect &aWindowRect);
|
|
|
|
bool OnGesture(WPARAM wParam, LPARAM lParam);
|
|
|
|
bool OnTouch(WPARAM wParam, LPARAM lParam);
|
|
|
|
bool OnHotKey(WPARAM wParam, LPARAM lParam);
|
2012-08-22 19:56:38 +04:00
|
|
|
bool OnPaint(HDC aDC, uint32_t aNestingLevel);
|
2013-09-27 22:46:59 +04:00
|
|
|
void OnWindowPosChanged(WINDOWPOS* wp);
|
2009-06-29 23:36:16 +04:00
|
|
|
void OnWindowPosChanging(LPWINDOWPOS& info);
|
2011-11-21 21:53:20 +04:00
|
|
|
void OnSysColorChanged();
|
2015-12-04 19:59:14 +03:00
|
|
|
void OnDPIChanged(int32_t x, int32_t y,
|
|
|
|
int32_t width, int32_t height);
|
2016-11-20 05:24:46 +03:00
|
|
|
bool OnPointerEvents(UINT msg, WPARAM wParam,
|
|
|
|
LPARAM lParam);
|
2004-09-03 12:44:23 +04:00
|
|
|
|
2010-04-16 21:37:16 +04:00
|
|
|
/**
|
|
|
|
* Function that registers when the user has been active (used for detecting
|
|
|
|
* when the user is idle).
|
|
|
|
*/
|
|
|
|
void UserActivity();
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetHeight(int32_t aProposedHeight);
|
2015-07-10 03:15:48 +03:00
|
|
|
const wchar_t* GetWindowClass() const;
|
|
|
|
const wchar_t* GetWindowPopupClass() const;
|
2009-06-29 23:36:16 +04:00
|
|
|
virtual DWORD WindowStyle();
|
2010-11-08 12:06:13 +03:00
|
|
|
DWORD WindowExStyle();
|
|
|
|
|
2015-07-10 03:15:48 +03:00
|
|
|
// This method registers the given window class, and returns the class name.
|
|
|
|
const wchar_t* RegisterWindowClass(const wchar_t* aClassName,
|
2010-11-08 12:06:13 +03:00
|
|
|
UINT aExtraStyle,
|
2015-07-10 03:15:48 +03:00
|
|
|
LPWSTR aIconID) const;
|
2008-05-07 08:46:37 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* XP and Vista theming support for windows with rounded edges
|
|
|
|
*/
|
|
|
|
void ClearThemeRegion();
|
|
|
|
void SetThemeRegion();
|
2009-03-25 03:51:57 +03:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Popup hooks
|
|
|
|
*/
|
|
|
|
static void ScheduleHookTimer(HWND aWnd, UINT aMsgId);
|
|
|
|
static void RegisterSpecialDropdownHooks();
|
|
|
|
static void UnregisterSpecialDropdownHooks();
|
2013-12-31 04:41:37 +04:00
|
|
|
static bool GetPopupsToRollup(nsIRollupListener* aRollupListener,
|
|
|
|
uint32_t* aPopupsToRollup);
|
2014-01-07 08:20:04 +04:00
|
|
|
static bool NeedsToHandleNCActivateDelayed(HWND aWnd);
|
2012-12-31 21:27:04 +04:00
|
|
|
static bool DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLParam, LRESULT* outResult);
|
1999-07-09 16:23:24 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Window transparency helpers
|
|
|
|
*/
|
|
|
|
#ifdef MOZ_XUL
|
2009-03-27 03:15:41 +03:00
|
|
|
private:
|
2009-06-29 23:36:16 +04:00
|
|
|
void SetWindowTranslucencyInner(nsTransparencyMode aMode);
|
|
|
|
nsTransparencyMode GetWindowTranslucencyInner() const { return mTransparencyMode; }
|
2010-03-18 01:56:00 +03:00
|
|
|
void UpdateGlass();
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
2009-06-29 23:36:16 +04:00
|
|
|
#endif // MOZ_XUL
|
2004-09-03 12:44:23 +04:00
|
|
|
|
2010-02-10 01:34:38 +03:00
|
|
|
static bool IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult);
|
2010-02-23 04:09:27 +03:00
|
|
|
void IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam);
|
2010-02-10 01:34:38 +03:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Misc.
|
|
|
|
*/
|
|
|
|
void StopFlashing();
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool IsTopLevelMouseExit(HWND aWnd);
|
2015-12-03 01:32:55 +03:00
|
|
|
virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aIntersectWithExisting) override;
|
2016-07-22 11:56:13 +03:00
|
|
|
nsIntRegion GetRegionToPaint(bool aForceFullRepaint,
|
2009-08-21 02:15:01 +04:00
|
|
|
PAINTSTRUCT ps, HDC aDC);
|
2010-08-20 07:40:51 +04:00
|
|
|
void ClearCachedResources();
|
2012-12-13 01:57:08 +04:00
|
|
|
nsIWidgetListener* GetPaintListener();
|
2016-04-30 02:23:17 +03:00
|
|
|
|
2016-07-18 11:54:02 +03:00
|
|
|
already_AddRefed<SourceSurface> CreateScrollSnapshot() override;
|
|
|
|
|
|
|
|
struct ScrollSnapshot
|
|
|
|
{
|
|
|
|
RefPtr<gfxWindowsSurface> surface;
|
|
|
|
bool surfaceHasSnapshot = false;
|
|
|
|
RECT clip;
|
|
|
|
};
|
|
|
|
|
|
|
|
ScrollSnapshot* EnsureSnapshotSurface(ScrollSnapshot& aSnapshotData,
|
|
|
|
const mozilla::gfx::IntSize& aSize);
|
|
|
|
|
|
|
|
ScrollSnapshot mFullSnapshot;
|
|
|
|
ScrollSnapshot mPartialSnapshot;
|
|
|
|
ScrollSnapshot* mCurrentSnapshot = nullptr;
|
|
|
|
|
|
|
|
already_AddRefed<SourceSurface>
|
|
|
|
GetFallbackScrollSnapshot(const RECT& aRequiredClip);
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
protected:
|
2010-06-02 17:02:05 +04:00
|
|
|
nsCOMPtr<nsIWidget> mParent;
|
2009-06-29 23:36:16 +04:00
|
|
|
nsIntSize mLastSize;
|
|
|
|
nsIntPoint mLastPoint;
|
|
|
|
HWND mWnd;
|
2015-07-13 13:44:36 +03:00
|
|
|
HWND mTransitionWnd;
|
2009-06-29 23:36:16 +04:00
|
|
|
WNDPROC mPrevWndProc;
|
|
|
|
HBRUSH mBrush;
|
2015-12-11 09:15:57 +03:00
|
|
|
IMEContext mDefaultIMC;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsTopWidgetWindow;
|
|
|
|
bool mInDtor;
|
|
|
|
bool mIsVisible;
|
|
|
|
bool mUnicodeWidget;
|
|
|
|
bool mPainting;
|
|
|
|
bool mTouchWindow;
|
|
|
|
bool mDisplayPanFeedback;
|
|
|
|
bool mHideChrome;
|
|
|
|
bool mIsRTL;
|
|
|
|
bool mFullscreenMode;
|
|
|
|
bool mMousePresent;
|
2011-12-07 23:01:48 +04:00
|
|
|
bool mDestroyCalled;
|
2017-02-04 01:37:37 +03:00
|
|
|
bool mOpeningAnimationSuppressed;
|
2012-10-28 08:24:02 +04:00
|
|
|
uint32_t mBlurSuppressLevel;
|
2009-06-29 23:36:16 +04:00
|
|
|
DWORD_PTR mOldStyle;
|
|
|
|
DWORD_PTR mOldExStyle;
|
|
|
|
nsNativeDragTarget* mNativeDragTarget;
|
|
|
|
HKL mLastKeyboardLayout;
|
2010-06-28 10:04:20 +04:00
|
|
|
nsSizeMode mOldSizeMode;
|
2012-05-05 06:46:35 +04:00
|
|
|
nsSizeMode mLastSizeMode;
|
2009-08-14 03:04:39 +04:00
|
|
|
WindowHook mWindowHook;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mPickerDisplayCount;
|
2012-07-06 03:06:13 +04:00
|
|
|
HICON mIconSmall;
|
|
|
|
HICON mIconBig;
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool sDropShadowEnabled;
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t sInstanceCount;
|
2009-06-29 23:36:16 +04:00
|
|
|
static TriStateBool sCanQuit;
|
|
|
|
static nsWindow* sCurrentWindow;
|
|
|
|
static BOOL sIsOleInitialized;
|
|
|
|
static HCURSOR sHCursor;
|
|
|
|
static imgIContainer* sCursorImgContainer;
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool sSwitchKeyboardLayout;
|
|
|
|
static bool sJustGotDeactivate;
|
|
|
|
static bool sJustGotActivate;
|
|
|
|
static bool sIsInMouseCapture;
|
2016-12-23 05:13:31 +03:00
|
|
|
static bool sHaveInitializedPrefs;
|
2011-03-02 14:53:55 +03:00
|
|
|
|
Bug 1373739 - Make headless compositing Windows-compatible, in addition to Linux. r=dvander
To make the HeadlessCompositorWidget work under Windows as well as Linux, I had
to change the way that I hooked it into the existing CompositorWidget system.
Under GTK, the CompositorWidgetInitData and CompositorWidgetDelegate types
provided the information needed by the headless compositor widget already (the
widget client size). On Windows, however, the definitions of these types
differ, and the client size information is simply retrieved from the platform
APIs when needed.
After this patch, CompositorWidgetDelegate is renamed to
PlatformCompositorWidgetDelegate, and a new base class called
CompositorWidgetDelegate is added with "AsPlatformSpecificDelegate()" and
"AsHeadlessCompositorWidget()" methods. In non-headless mode, widgets use
AsPlatformSpecificDelegate() to access the Windows- and GTK-specific delegate
APIs. In headless mode, AsHeadlessCompositorWidget() is used to access the
singular CompositorWidget implementation for headless. Meanwhile, the
CompositorWidgetInitData IPDL type is made into a union which always contains a
headless-specific HeadlessCompositorWidgetInitData struct and under GTK and
Windows also contains an {X11,Win}CompositorWidgetInitData struct.
This also includes a small patch to ensure that the GPU process and
hardware-accelerated compositing are always disabled under headless mode. These
features weren't activated by default in the Linux environments I tested in, but
did end up activating (and then promptly crashing Firefox) when I tested on
Windows.
MozReview-Commit-ID: CocPoHBDV7H
--HG--
extra : rebase_source : 4581fa63aa3a9f32a8dc2672015a35b9be01b20f
2017-07-07 03:45:34 +03:00
|
|
|
PlatformCompositorWidgetDelegate* mCompositorWidgetDelegate;
|
|
|
|
|
2011-03-02 14:53:55 +03:00
|
|
|
// Always use the helper method to read this property. See bug 603793.
|
|
|
|
static TriStateBool sHasBogusPopupsDropShadowOnMultiMonitor;
|
|
|
|
static bool HasBogusPopupsDropShadowOnMultiMonitor();
|
|
|
|
|
2010-06-25 06:01:07 +04:00
|
|
|
// Non-client margin settings
|
|
|
|
// Pre-calculated outward offset applied to default frames
|
2015-11-13 12:37:02 +03:00
|
|
|
LayoutDeviceIntMargin mNonClientOffset;
|
2010-06-25 06:01:07 +04:00
|
|
|
// Margins set by the owner
|
2015-11-13 12:37:02 +03:00
|
|
|
LayoutDeviceIntMargin mNonClientMargins;
|
2014-10-29 17:19:25 +03:00
|
|
|
// Margins we'd like to set once chrome is reshown:
|
2015-11-13 12:37:02 +03:00
|
|
|
LayoutDeviceIntMargin mFutureMarginsOnceChromeShows;
|
2014-10-29 17:19:25 +03:00
|
|
|
// Indicates we need to apply margins once toggling chrome into showing:
|
|
|
|
bool mFutureMarginsToUse;
|
2010-08-28 01:26:30 +04:00
|
|
|
|
2010-06-25 06:01:07 +04:00
|
|
|
// Indicates custom frames are enabled
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCustomNonClient;
|
2016-07-22 11:56:13 +03:00
|
|
|
// Cached copy of L&F's resize border
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mHorResizeMargin;
|
|
|
|
int32_t mVertResizeMargin;
|
2010-06-25 06:01:07 +04:00
|
|
|
// Height of the caption plus border
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mCaptionHeight;
|
2010-06-25 06:01:07 +04:00
|
|
|
|
2015-12-04 19:59:14 +03:00
|
|
|
double mDefaultScale;
|
|
|
|
|
2012-06-29 12:32:21 +04:00
|
|
|
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
|
2010-04-16 21:37:16 +04:00
|
|
|
|
2015-05-12 16:22:33 +03:00
|
|
|
// Draggable titlebar region maintained by UpdateWindowDraggingRegion
|
2015-11-26 08:42:59 +03:00
|
|
|
LayoutDeviceIntRegion mDraggableRegion;
|
2015-05-12 16:22:33 +03:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
// Hook Data Memebers for Dropdowns. sProcessHook Tells the
|
|
|
|
// hook methods whether they should be processing the hook
|
|
|
|
// messages.
|
|
|
|
static HHOOK sMsgFilterHook;
|
|
|
|
static HHOOK sCallProcHook;
|
|
|
|
static HHOOK sCallMouseHook;
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool sProcessHook;
|
2009-06-29 23:36:16 +04:00
|
|
|
static UINT sRollupMsgId;
|
|
|
|
static HWND sRollupMsgWnd;
|
|
|
|
static UINT sHookTimerId;
|
|
|
|
|
|
|
|
// Mouse Clicks - static variable definitions for figuring
|
|
|
|
// out 1 - 3 Clicks.
|
|
|
|
static POINT sLastMousePoint;
|
|
|
|
static POINT sLastMouseMovePoint;
|
|
|
|
static LONG sLastMouseDownTime;
|
|
|
|
static LONG sLastClickCount;
|
|
|
|
static BYTE sLastMouseButton;
|
|
|
|
|
|
|
|
// Graphics
|
|
|
|
HDC mPaintDC; // only set during painting
|
2009-07-09 03:34:02 +04:00
|
|
|
|
2015-11-23 07:32:29 +03:00
|
|
|
LayoutDeviceIntRect mLastPaintBounds;
|
2013-11-21 23:25:16 +04:00
|
|
|
|
2015-08-18 00:24:59 +03:00
|
|
|
ResizeState mResizeState;
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
// Transparency
|
|
|
|
#ifdef MOZ_XUL
|
|
|
|
nsTransparencyMode mTransparencyMode;
|
2010-03-18 01:56:00 +03:00
|
|
|
nsIntRegion mPossiblyTransparentRegion;
|
|
|
|
MARGINS mGlassMargins;
|
2009-06-29 23:36:16 +04:00
|
|
|
#endif // MOZ_XUL
|
2004-09-03 12:44:23 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
// Win7 Gesture processing and management
|
|
|
|
nsWinGesture mGesture;
|
2002-02-27 05:18:12 +03:00
|
|
|
|
2009-10-06 06:26:54 +04:00
|
|
|
// Weak ref to the nsITaskbarWindowPreview associated with this window
|
|
|
|
nsWeakPtr mTaskbarPreview;
|
|
|
|
// True if the taskbar (possibly through the tab preview) tells us that the
|
|
|
|
// icon has been created on the taskbar.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHasTaskbarIconBeenCreated;
|
2009-10-06 06:26:54 +04:00
|
|
|
|
2014-01-31 17:27:43 +04:00
|
|
|
// Indicates that mouse events should be ignored and pass through to the
|
|
|
|
// window below. This is currently only used for popups.
|
|
|
|
bool mMouseTransparent;
|
|
|
|
|
2015-06-09 22:18:36 +03:00
|
|
|
// Whether we're in the process of sending a WM_SETTEXT ourselves
|
|
|
|
bool mSendingSetText;
|
|
|
|
|
2017-07-06 00:14:48 +03:00
|
|
|
// Whether we we're created as a NS_CHILD_CID window (aka ChildWindow) or not.
|
|
|
|
bool mIsChildWindow : 1;
|
|
|
|
|
2012-01-14 05:29:22 +04:00
|
|
|
// The point in time at which the last paint completed. We use this to avoid
|
|
|
|
// painting too rapidly in response to frequent input events.
|
|
|
|
TimeStamp mLastPaintEndTime;
|
|
|
|
|
2013-07-29 15:19:34 +04:00
|
|
|
// Caching for hit test results
|
|
|
|
POINT mCachedHitTestPoint;
|
|
|
|
TimeStamp mCachedHitTestTime;
|
|
|
|
int32_t mCachedHitTestResult;
|
|
|
|
|
2016-07-01 11:15:16 +03:00
|
|
|
RefPtr<mozilla::widget::WinCompositorWidget> mBasicLayersSurface;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool sNeedsToInitMouseWheelSettings;
|
2011-05-17 04:23:23 +04:00
|
|
|
static void InitMouseWheelScrollData();
|
2015-05-13 23:05:35 +03:00
|
|
|
|
2015-12-04 19:59:14 +03:00
|
|
|
double mSizeConstraintsScale; // scale in effect when setting constraints
|
2016-11-28 21:46:15 +03:00
|
|
|
|
|
|
|
// Used to remember the wParam (i.e. currently pressed modifier keys)
|
|
|
|
// and lParam (i.e. last mouse position) in screen coordinates from
|
|
|
|
// the previous mouse-exit. Static since it is not
|
|
|
|
// associated with a particular widget (since we exited the widget).
|
|
|
|
static WPARAM sMouseExitwParam;
|
|
|
|
static LPARAM sMouseExitlParamScreen;
|
2016-11-20 05:24:46 +03:00
|
|
|
|
|
|
|
// Pointer events processing and management
|
|
|
|
WinPointerEvents mPointerEvents;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2009-07-08 20:13:13 +04:00
|
|
|
#endif // Window_h__
|