mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
b564bd67d3
- Use CompositorWidgetProxy for dispatching vsync to the compositor. (bug 1269037 part 1, r=mchang) (c8b7a4240c) - Remove unused null widget checks. (bug 1269037 part 2, r=mchang) (4f4cc9952b) - Bug 1269422: Wrap Gonk widget in |CompositorWidgetProxyWrapper|. r=dvander (4513035cbf) - Remove nsBaseWidget::NewCompositorBridgeParent. (bug 1272472 part 1, r=kats) (ca813c1f2b) - Use IPDL to schedule composites on GTK. (bug 1272472 part 2, r=nical) (7402cf834e) - Use IPC to schedule composites on Windows. (bug 1272472 part 3, r=jimm) (e5d7281dd7) - Don't use nsIWidget to check APZ in LayerManagerComposite. (bug 1269653 part 1, r=kats) (79a1644111) - Restrict SetDispAcquireFence's nsIWidget access to Gonk. (bug 1269653 part 2, r=kats) (72110b7bc7) - Bug 1264764 - Move PTexture under PCompositorBridge r=nical,dvander (17e6ec7fc1) - Move CompositorThreadHolder into its own file. (bug 1273017 part 1, r=mattwoodrow) (464ede8be1) - Move CompositorBridgeParent::CompositorLoop to CompositorThreadHolder. (bug 1273017 part 2, r=mattwoodrow) (85708f3cde) - Bug 1268313: Part 1 - Be explicit about which NewRunnableMethod callers want to be able to cancel. r=froydnj (faa07aa139) - Bug 1268313: Part 2 - Replace some NewRunnableMethods with NS_NewNonOwningRunnableMethod. r=froydnj (010c43d000) - Bug 1268313: Part 3 - Replace some NewCancelableRunnableMethod with NS_NewNonOwningCancelableRunnableMethod. r=froydnj (55018ef234) - Bug 1268313: Part 4 - Replace NewCancelableRunnableMethod with NS_NewCancelableRunnableMethod. r=froydnj (c22711b35d) - Bug 1268313: Part 5 - Make NS_NewRunnableMethod able to call const functions. r=froydnj (b0f60963a3) - Bug 1268313: Part 6 - Replace NewRunnableMethod with NS_NewRunnableMethod. r=froydnj (18d40def2c) - Bug 1260950 - Set mInitialSizeFound to true when the initial size id found. r=jesup, r=pehrsons a=kwierso (5d6abe57e0) - Bug 1237176 - Notify synth start if we get a finished event without a blocking-changed event. r=roc (c1aebe903a) - Bug 911546, use a runnable so that popups don't rollup during a grab, r=karlt (a06bd44e6c) - Bug 1237617 - Call nsWindow::ForcePresent during going active r=bas.schouten (066cad8f89) - Bug 1268313: Part 7 - Move NS_NewRunnableMethod and friends to mozilla::NewRunnableMethod. r=froydnj (8b4bf34961) - Bug 1266595: Followup to fix IPDL tests. r=billm (216f2dcff5) - Bug 1268313: Fix up IPDL tests. r=billm (228348d642) - Add WinCompositorWidgetProxy. (bug 1265975 part 1, r=jimm) (bfafe7a8e2) - Implement WinCompositorWidgetProxy::GetClientSize. (bug 1265975 part 2, r=jimm) (a8710a3259) - Move the WM_SETTEXT present lock to CompositorWidgetProxy. (bug 1265975 part 3, r=jimm) (297ce28c8a) - Move transparency handling to WinCompositorWigetProxy. (bug 1265975 part 4, r=jimm) (46ba0c6d01) - Remove Windows-specific compositor calls to nsIWidget. (bug 1265975 part 5, r=jimm) (3ef157c160) - Remove plugin-related CompositorBridgeParent use of nsIWidget. (bug 1265975 part 6, r=jimm) (6d80cdd6fd) - Hide top-level CompositorBridgeParents behind a new API. (bug 1272472 part 4, r=mattwoodrow,kats,gwagner) (228c0efdb7) - Bug 1253424 - part 1 - add a already_AddRefed nsTransactionStack::Push overload; r=erahm (7059e20914) - Bug 1253424 - part 2 - add nsTransactionStack::IsEmpty; r=erahm (7e9764a146) - Bug 1254618 - modify nsTransactionStack to use nsDeque rather than std::deque; r=ehsan (5e47ea431e) - Bug 1136857 - Make DOMStorageCache::mLoaded flag atomic to prevent potential races, r=nfroyd (39aaea1de3) - Bug 1265408 - Add webidl for IIRFilterNode; r=smaug (040ce9aa43) - Bug 1265408 - Implement IIRFilterNode; r=padenot (6bf569a412) - Bug 1265408 - Import IIRFilter from blink; r=padenot (71b28c0ad2) - Bug 1265408 - Use IIRFilter from blink; r=padenot (5d058d8568) - Bug 1265408 - Add buffersAreZero to IIRFilter; r=karlt (45edba3e13) - Bug 1265408 - Avoid subnormals in IIRFilter; r=karlt (0e1ae93f0b) - Bug 1265408 - Add LogToDeveloperConsole to WebAudioUtils; r=padenot (88d5f0222a) - Bug 1268984 - Store GMPStorage on GMPServiceParent so that it persists inside the same PB session. r=gerald (17d4d0abaf) - Bug 1267905 - Replace uses of ScopedCERTCertList with UniqueCERTCertList. r=keeler (783bf11b2a) - Bug 1270005 - Replace uses of ScopedPK11SlotInfo with UniquePK11SlotInfo in PSM. r=keeler (ea9a4011aa) - Bug 1271501 - Remove unnecessary uses of reinterpret_cast in PSM. r=keeler (6be40f0a85) - Bug 1271501 - Downgrade unnecessarily strong reinterpret_casts in PSM. r=keeler (95245f00ce) - Bug 1082346 - 01. Convert PKCS12 password endian using copyAndSwapToBigEndian. r=keeler (9cc58fc550) - Bug 1082346 - 02. Test case. r=keeler r=Cykesiopka (7fb0e8abc4) - Bug 160122 - Stop using PR_smprintf in PSM. r=keeler (1e5b68819c) - Bug 1271501 - Use mozilla::BitwiseCast instead of reinterpret_cast in PSM. r=keeler (894966a2ef) - Bug 1273855: TraceLogger - Include PID in the log names in order to support browser with e10s, r=bbouvier (8cf2233db3) - Bug 1274189. Part 1 - rename some functions to be consistent with other MediaDataDecoder sub-classes. r=jya. (4511b3d3f7) - Bug 1274189. Part 2 - remove use of FlushableTaskQueue::Flush(). r=jya. (77e745fdd1) - Bug 1274189. Part 3 - remove use of FlushableTaskQueue. r=jya (aac61dcd02) - Bug 1269963. Part 1 - Add a SyncRunnable::DispatchToThread() overload for AbstractThread. r=bobbyholley. (839752aff4) - Bug 1269672 - part1 : revert sampling rate changing of the bug1235612. (9015782e13) - Bug 1270698 - check if we need to enter buffering periodically to ensure we start buffering when running out of decoded audio/video data. r=cpearce. (16734549b7) - Bug 1271581 - use newCurrentTime, instead of GetMediaTime() to decide the nextState; r=jwwang (9c5075eada) - Bug 1224973 - Part 1: Remove MediaDecoderOwner->IsHidden(). r=cpearce,jwwang (4fde3ede5a) - Bug 1224973 - Part 2: Set MediaDecoder visibility via NotifyOwnerActivityChanged. r=cpearce,jwwang (be917202eb) - Bug 1224973 - Part 3: Plumb element visibility into MDSM. r=jya,jwwang (9ec83fa243) - Bug 1224973 - Part 4: Pref media.suspend-bkgnd-video.enabled. r=cpearce,jwwang (43413a025f) - Bug 1269408: P1. Retry InternalSeek if previous attempt failed once more data is available. r=gerald (05db58dc7c) - crude fix (0097068989) - Bug 1269408: P2. Update mochitest. r=gerald (464b4c0724) - Bug 1269408: P3. Ensure a new seek request will cancel the previous internal seek. r=gerald (6ed4b8dc95) - Bug 1269408: P4. Ensure the decoders are flushed prior performing an internal seek. r=gerald (074234067b) - Bug 1269408: P5. Only drop the seek target if it's exactly the seek target. r=gerald (88701eb05a) - Bug 1269408: P6. Add debugging information, useful when a mochitest timeout. r=gerald (ef0270ab0d) - Bug 1269408: P7. Start skip to next keyframe logic when resume point is behind current time. r=gerald (bd40ebf3bc) - Bug 1269408: P8. Add debugging log. r=gerald (e6dbd1f0a6) - Bug 1269408: P9. Move handling logic of skip to next keyframe to its own function. r=gerald (3c8039e417) - Bug 1269408: P10. Reject promise early if in error state. r=me (8af54c574e) - Bug 1224973 - Part 5: Implement suspend decoding for background video. r=cpearce,jwwang,jya (22081521e3) - Bug 1242874 - part1 : create suspened types. r=baku (d3ac9548e5) - Bug 1242874 - part2 : window's suspend attribute. r=baku, r=ehsan (1fd9dc2647) - remove allowscirpted (39ab523036) - Bug 1242874 - part3 : implement different suspended methods. r=baku, r=jwwang (25d1f27a03) - Bug 1242874 - part4 : wrap the volume/mute/suspend for notifyStartedPlaying. r=baku (b8ba3238c2) - bug 1242874 - part5 : add test. r=baku, r=ehsan (f840139b5a) - Bug 1235612 - Part 1: Implement notify media-playback. r=baku (b5ec29da20) - Bug 1235612 - Part 2: Notify audible state in NotifyStartedPlaying. r=baku (dc38583a62) - Bug 1235612 - Part 3: Implement the logic of audible state notification for agent owners. r=baku (f65b3952fa) - Bug 1235612 - Part 4: Modify check audible method. r=jwwang (73457e39eb) - Bug 1269672 - part2 : move audible data checking from MDSM to DecodedAudioDataSink. (d2c3b6874c) - Bug 1269936 - Introduce and call a runtime-wide servo initialization hook. r=heycam (d4d505d4c2) - Bug 1263778 - Rename a bunch of low-level [[Prototype]] access methods to make their interactions with statically-known and dynamically-computed [[Prototype]]s clearer. r=efaust (66bbe8e7db) - Bug 888969 - Permit a cyclic [[Prototype]] chain to be created through a Location object. r=bz, r=efaust (3e3b9cbb16) - re-apply Bug 1054906 - Implement ES6 Symbol.hasInstance 2/2; r=jandem (8d5c7573ff) - Bug 1054906 - Implement ES6 Symbol.hasInstance 1/2; r=evilpie,bz (a836904e5d) - fix misspatch (54a5f2d708) - Bug 1270349 part 1. Add IDL parser support for [LegacyUnenumerableNamedProperties]. r=peterv (8c836bc74a) - Bug 1270349 part 2. Add [LegacyUnenumerableNamedProperties] to the interfaces that specify it in DOM and HTML. r=peterv (25d3cc1377) - Bug 1270349 part 3. Add a way to ask an interface descriptor for a proxy whether its named props should be enumerable. r=peterv (0a9f804867) - Bug 1270349 part 4. Use LegacyUnenumerableNamedProperties instead of NameIsEnumerable() calls to determine whether named props on DOM proxies should be enumerable. r=peterv (82f5158963) - Bug 1270349 part 5. Use LegacyUnenumerableNamedProperties instead of passing flags to GetSupportedNames to determine whether named props on DOM proxies should be reflected in ownPropertyKeys. r=peterv (3984176834) - Bug 1270349 followup to address a review comment. r=peterv (b49f4c5335)
627 lines
27 KiB
C++
627 lines
27 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* 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 Window_h__
|
|
#define Window_h__
|
|
|
|
/*
|
|
* nsWindow - Native window management and event handling.
|
|
*/
|
|
|
|
#include "mozilla/RefPtr.h"
|
|
#include "nsBaseWidget.h"
|
|
#include "nsWindowBase.h"
|
|
#include "nsdefs.h"
|
|
#include "nsIdleService.h"
|
|
#include "nsToolkit.h"
|
|
#include "nsString.h"
|
|
#include "nsTArray.h"
|
|
#include "gfxWindowsPlatform.h"
|
|
#include "gfxWindowsSurface.h"
|
|
#include "nsWindowDbg.h"
|
|
#include "cairo.h"
|
|
#include "nsITimer.h"
|
|
#include "nsRegion.h"
|
|
#include "mozilla/EventForwards.h"
|
|
#include "mozilla/MouseEvents.h"
|
|
#include "mozilla/TimeStamp.h"
|
|
#include "nsMargin.h"
|
|
#include "nsRegionFwd.h"
|
|
|
|
#include "nsWinGesture.h"
|
|
#include "WinUtils.h"
|
|
#include "WindowHook.h"
|
|
#include "TaskbarWindowPreview.h"
|
|
|
|
#ifdef ACCESSIBILITY
|
|
#include "oleacc.h"
|
|
#include "mozilla/a11y/Accessible.h"
|
|
#endif
|
|
|
|
#include "nsUXThemeData.h"
|
|
#include "nsIDOMMouseEvent.h"
|
|
#include "nsIIdleServiceInternal.h"
|
|
|
|
#include "IMMHandler.h"
|
|
|
|
/**
|
|
* Forward class definitions
|
|
*/
|
|
|
|
class nsNativeDragTarget;
|
|
class nsIRollupListener;
|
|
class imgIContainer;
|
|
|
|
namespace mozilla {
|
|
namespace widget {
|
|
class NativeKey;
|
|
struct MSGResult;
|
|
class WinCompositorWidgetProxy;
|
|
} // namespace widget
|
|
} // namespacw mozilla;
|
|
|
|
/**
|
|
* Native WIN32 window wrapper.
|
|
*/
|
|
|
|
class nsWindow : public nsWindowBase
|
|
{
|
|
typedef mozilla::TimeStamp TimeStamp;
|
|
typedef mozilla::TimeDuration TimeDuration;
|
|
typedef mozilla::widget::WindowHook WindowHook;
|
|
typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
|
|
typedef mozilla::widget::NativeKey NativeKey;
|
|
typedef mozilla::widget::MSGResult MSGResult;
|
|
typedef mozilla::widget::IMEContext IMEContext;
|
|
|
|
public:
|
|
nsWindow();
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
friend class nsWindowGfx;
|
|
|
|
// nsWindowBase
|
|
virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
|
|
LayoutDeviceIntPoint* aPoint = nullptr) override;
|
|
virtual WidgetEventTime CurrentMessageWidgetEventTime() const override;
|
|
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; }
|
|
|
|
using nsWindowBase::DispatchPluginEvent;
|
|
|
|
// nsIWidget interface
|
|
using nsWindowBase::Create; // for Create signature not overridden here
|
|
NS_IMETHOD Create(nsIWidget* aParent,
|
|
nsNativeWidget aNativeParent,
|
|
const LayoutDeviceIntRect& aRect,
|
|
nsWidgetInitData* aInitData = nullptr) override;
|
|
NS_IMETHOD Destroy() override;
|
|
NS_IMETHOD SetParent(nsIWidget *aNewParent) override;
|
|
virtual nsIWidget* GetParent(void) override;
|
|
virtual float GetDPI() override;
|
|
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());
|
|
}
|
|
}
|
|
|
|
NS_IMETHOD Show(bool bState) override;
|
|
virtual bool IsVisible() const override;
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY) override;
|
|
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
|
|
virtual const SizeConstraints GetSizeConstraints() override;
|
|
NS_IMETHOD Move(double aX, double aY) override;
|
|
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
|
|
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint);
|
|
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
|
int32_t aHorizontal,
|
|
int32_t aVertical) override;
|
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate) override;
|
|
NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
|
|
NS_IMETHOD Enable(bool aState) override;
|
|
virtual bool IsEnabled() const override;
|
|
NS_IMETHOD SetFocus(bool aRaise) override;
|
|
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override;
|
|
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
|
|
NS_IMETHOD GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
|
|
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
|
|
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
|
void SetBackgroundColor(const nscolor& aColor) override;
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
|
uint32_t aHotspotX, uint32_t aHotspotY) override;
|
|
NS_IMETHOD SetCursor(nsCursor aCursor) override;
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
|
|
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aScreen = nullptr) override;
|
|
NS_IMETHOD HideWindowChrome(bool aShouldHide) override;
|
|
NS_IMETHOD Invalidate(bool aEraseBackground = false,
|
|
bool aUpdateNCArea = false,
|
|
bool aIncludeChildren = false);
|
|
NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect);
|
|
virtual void* GetNativeData(uint32_t aDataType) override;
|
|
void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
|
|
virtual void FreeNativeData(void * data, uint32_t aDataType) override;
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle) override;
|
|
NS_IMETHOD SetIcon(const nsAString& aIconSpec) override;
|
|
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
|
virtual LayoutDeviceIntSize ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override;
|
|
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
|
nsEventStatus& aStatus) override;
|
|
NS_IMETHOD EnableDragDrop(bool aEnable) override;
|
|
NS_IMETHOD CaptureMouse(bool aCapture) override;
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener,
|
|
bool aDoCapture) override;
|
|
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
|
virtual bool HasPendingInputEvent() override;
|
|
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
|
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
|
bool* aAllowRetaining = nullptr) override;
|
|
NS_IMETHOD OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override;
|
|
virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
|
int32_t aNativeKeyCode,
|
|
uint32_t aModifierFlags,
|
|
const nsAString& aCharacters,
|
|
const nsAString& aUnmodifiedCharacters,
|
|
nsIObserver* aObserver) override;
|
|
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
|
uint32_t aNativeMessage,
|
|
uint32_t aModifierFlags,
|
|
nsIObserver* aObserver) override;
|
|
|
|
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
|
nsIObserver* aObserver) override
|
|
{ return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0, aObserver); }
|
|
|
|
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
|
uint32_t aNativeMessage,
|
|
double aDeltaX,
|
|
double aDeltaY,
|
|
double aDeltaZ,
|
|
uint32_t aModifierFlags,
|
|
uint32_t aAdditionalFlags,
|
|
nsIObserver* aObserver) override;
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
|
const InputContextAction& aAction) override;
|
|
NS_IMETHOD_(InputContext) GetInputContext() override;
|
|
NS_IMETHOD_(TextEventDispatcherListener*)
|
|
GetNativeTextEventDispatcherListener() override;
|
|
#ifdef MOZ_XUL
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
|
|
virtual nsTransparencyMode GetTransparencyMode() override;
|
|
virtual void UpdateOpaqueRegion(const LayoutDeviceIntRegion& aOpaqueRegion) override;
|
|
#endif // MOZ_XUL
|
|
virtual nsIMEUpdatePreference GetIMEUpdatePreference() override;
|
|
NS_IMETHOD GetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
|
NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
|
void SetDrawsInTitlebar(bool aState) override;
|
|
virtual void UpdateWindowDraggingRegion(const LayoutDeviceIntRegion& aRegion) override;
|
|
|
|
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
|
|
virtual uint32_t GetMaxTouchPoints() const override;
|
|
|
|
/**
|
|
* Event helpers
|
|
*/
|
|
virtual bool DispatchMouseEvent(
|
|
mozilla::EventMessage aEventMessage,
|
|
WPARAM wParam,
|
|
LPARAM lParam,
|
|
bool aIsContextMenuKey = false,
|
|
int16_t aButton =
|
|
mozilla::WidgetMouseEvent::eLeftButton,
|
|
uint16_t aInputSource =
|
|
nsIDOMMouseEvent::MOZ_SOURCE_MOUSE);
|
|
virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent,
|
|
nsEventStatus& aStatus);
|
|
void DispatchPendingEvents();
|
|
bool DispatchPluginEvent(UINT aMessage,
|
|
WPARAM aWParam,
|
|
LPARAM aLParam,
|
|
bool aDispatchPendingEvents);
|
|
|
|
void SuppressBlurEvents(bool aSuppress); // Called from nsFilePicker
|
|
bool BlurEventsSuppressed();
|
|
#ifdef ACCESSIBILITY
|
|
/**
|
|
* Return an accessible associated with the window.
|
|
*/
|
|
mozilla::a11y::Accessible* GetAccessible();
|
|
#endif // ACCESSIBILITY
|
|
|
|
/**
|
|
* Window utilities
|
|
*/
|
|
nsWindow* GetTopLevelWindow(bool aStopOnDialogOrPopup);
|
|
WNDPROC GetPrevWindowProc() { return mPrevWndProc; }
|
|
WindowHook& GetWindowHook() { return mWindowHook; }
|
|
nsWindow* GetParentWindow(bool aIncludeOwner);
|
|
// Get an array of all nsWindow*s on the main thread.
|
|
typedef void (WindowEnumCallback)(nsWindow*);
|
|
static void EnumAllWindows(WindowEnumCallback aCallback);
|
|
|
|
/**
|
|
* Misc.
|
|
*/
|
|
virtual bool AutoErase(HDC dc);
|
|
bool ComputeShouldAccelerate() override;
|
|
|
|
void ForcePresent();
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
bool AssociateDefaultIMC(bool aAssociate);
|
|
|
|
bool HasTaskbarIconBeenCreated() { return mHasTaskbarIconBeenCreated; }
|
|
// Called when either the nsWindow or an nsITaskbarTabPreview receives the noticiation that this window
|
|
// has its icon placed on the taskbar.
|
|
void SetHasTaskbarIconBeenCreated(bool created = true) { mHasTaskbarIconBeenCreated = created; }
|
|
|
|
// 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); }
|
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) override;
|
|
|
|
// Open file picker tracking
|
|
void PickerOpen();
|
|
void PickerClosed();
|
|
|
|
bool const DestroyCalled() { return mDestroyCalled; }
|
|
|
|
bool IsPopup();
|
|
virtual bool ShouldUseOffMainThreadCompositing() override;
|
|
|
|
const IMEContext& DefaultIMC() const { return mDefaultIMC; }
|
|
|
|
virtual void SetCandidateWindowForPlugin(
|
|
const mozilla::widget::CandidateWindowPosition&
|
|
aPosition) override;
|
|
virtual void DefaultProcOfPluginEvent(
|
|
const mozilla::WidgetPluginEvent& aEvent) override;
|
|
virtual nsresult OnWindowedPluginKeyEvent(
|
|
const mozilla::NativeEventData& aKeyEventData,
|
|
nsIKeyEventInPluginCallback* aCallback) override;
|
|
|
|
mozilla::widget::CompositorWidgetProxy* NewCompositorWidgetProxy() override;
|
|
|
|
protected:
|
|
virtual ~nsWindow();
|
|
|
|
virtual void WindowUsesOMTC() override;
|
|
virtual void RegisterTouchWindow() override;
|
|
|
|
// A magic number to identify the FAKETRACKPOINTSCROLLABLE window created
|
|
// when the trackpoint hack is enabled.
|
|
enum { eFakeTrackPointScrollableID = 0x46545053 };
|
|
|
|
/**
|
|
* Callbacks
|
|
*/
|
|
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
static LRESULT CALLBACK WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
static BOOL CALLBACK BroadcastMsgToChildren(HWND aWnd, LPARAM aMsg);
|
|
static BOOL CALLBACK BroadcastMsg(HWND aTopWindow, LPARAM aMsg);
|
|
static BOOL CALLBACK DispatchStarvedPaints(HWND aTopWindow, LPARAM aMsg);
|
|
static BOOL CALLBACK RegisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
|
|
static BOOL CALLBACK UnregisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
|
|
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 );
|
|
static BOOL CALLBACK ClearResourcesCallback(HWND aChild, LPARAM aParam);
|
|
static BOOL CALLBACK EnumAllChildWindProc(HWND aWnd, LPARAM aParam);
|
|
static BOOL CALLBACK EnumAllThreadWindowProc(HWND aWnd, LPARAM aParam);
|
|
|
|
/**
|
|
* Window utilities
|
|
*/
|
|
LPARAM lParamToScreen(LPARAM lParam);
|
|
LPARAM lParamToClient(LPARAM lParam);
|
|
virtual void SubclassWindow(BOOL bState);
|
|
bool CanTakeFocus();
|
|
bool UpdateNonClientMargins(int32_t aSizeMode = -1, bool aReflowWindow = true);
|
|
void UpdateGetWindowInfoCaptionStatus(bool aActiveCaption);
|
|
void ResetLayout();
|
|
void InvalidateNonClientRegion();
|
|
HRGN ExcludeNonClientFromPaintRegion(HRGN aRegion);
|
|
static const wchar_t* GetMainWindowClass();
|
|
bool HasGlass() const {
|
|
return mTransparencyMode == eTransparencyGlass ||
|
|
mTransparencyMode == eTransparencyBorderlessGlass;
|
|
}
|
|
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;
|
|
}
|
|
|
|
|
|
/**
|
|
* Event processing helpers
|
|
*/
|
|
void DispatchFocusToTopLevelWindow(bool aIsActivate);
|
|
bool DispatchStandardEvent(mozilla::EventMessage aMsg);
|
|
void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
|
|
virtual bool ProcessMessage(UINT msg, WPARAM &wParam,
|
|
LPARAM &lParam, LRESULT *aRetValue);
|
|
bool ExternalHandlerProcessMessage(
|
|
UINT aMessage, WPARAM& aWParam,
|
|
LPARAM& aLParam, MSGResult& aResult);
|
|
bool ProcessMessageForPlugin(const MSG &aMsg,
|
|
MSGResult& aResult);
|
|
LRESULT ProcessCharMessage(const MSG &aMsg,
|
|
bool *aEventDispatched);
|
|
LRESULT ProcessKeyUpMessage(const MSG &aMsg,
|
|
bool *aEventDispatched);
|
|
LRESULT ProcessKeyDownMessage(const MSG &aMsg,
|
|
bool *aEventDispatched);
|
|
static bool EventIsInsideWindow(nsWindow* aWindow);
|
|
// Convert nsEventStatus value to a windows boolean
|
|
static bool ConvertStatus(nsEventStatus aStatus);
|
|
static void PostSleepWakeNotification(const bool aIsSleepMode);
|
|
int32_t ClientMarginHitTestPoint(int32_t mx, int32_t my);
|
|
TimeStamp GetMessageTimeStamp(LONG aEventTime) const;
|
|
static void UpdateFirstEventTime(DWORD aEventTime);
|
|
|
|
/**
|
|
* Event handlers
|
|
*/
|
|
virtual void OnDestroy() override;
|
|
virtual bool OnResize(nsIntRect &aWindowRect);
|
|
bool OnGesture(WPARAM wParam, LPARAM lParam);
|
|
bool OnTouch(WPARAM wParam, LPARAM lParam);
|
|
bool OnHotKey(WPARAM wParam, LPARAM lParam);
|
|
bool OnPaint(HDC aDC, uint32_t aNestingLevel);
|
|
void OnWindowPosChanged(WINDOWPOS* wp);
|
|
void OnWindowPosChanging(LPWINDOWPOS& info);
|
|
void OnSysColorChanged();
|
|
void OnDPIChanged(int32_t x, int32_t y,
|
|
int32_t width, int32_t height);
|
|
|
|
/**
|
|
* Function that registers when the user has been active (used for detecting
|
|
* when the user is idle).
|
|
*/
|
|
void UserActivity();
|
|
|
|
int32_t GetHeight(int32_t aProposedHeight);
|
|
const wchar_t* GetWindowClass() const;
|
|
const wchar_t* GetWindowPopupClass() const;
|
|
virtual DWORD WindowStyle();
|
|
DWORD WindowExStyle();
|
|
|
|
// This method registers the given window class, and returns the class name.
|
|
const wchar_t* RegisterWindowClass(const wchar_t* aClassName,
|
|
UINT aExtraStyle,
|
|
LPWSTR aIconID) const;
|
|
|
|
/**
|
|
* XP and Vista theming support for windows with rounded edges
|
|
*/
|
|
void ClearThemeRegion();
|
|
void SetThemeRegion();
|
|
|
|
/**
|
|
* Popup hooks
|
|
*/
|
|
static void ScheduleHookTimer(HWND aWnd, UINT aMsgId);
|
|
static void RegisterSpecialDropdownHooks();
|
|
static void UnregisterSpecialDropdownHooks();
|
|
static bool GetPopupsToRollup(nsIRollupListener* aRollupListener,
|
|
uint32_t* aPopupsToRollup);
|
|
static bool NeedsToHandleNCActivateDelayed(HWND aWnd);
|
|
static bool DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLParam, LRESULT* outResult);
|
|
|
|
/**
|
|
* Window transparency helpers
|
|
*/
|
|
#ifdef MOZ_XUL
|
|
private:
|
|
void SetWindowTranslucencyInner(nsTransparencyMode aMode);
|
|
nsTransparencyMode GetWindowTranslucencyInner() const { return mTransparencyMode; }
|
|
void UpdateGlass();
|
|
protected:
|
|
#endif // MOZ_XUL
|
|
|
|
static bool IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult);
|
|
void IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam);
|
|
|
|
/**
|
|
* Misc.
|
|
*/
|
|
void StopFlashing();
|
|
static bool IsTopLevelMouseExit(HWND aWnd);
|
|
virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
|
bool aIntersectWithExisting) override;
|
|
nsIntRegion GetRegionToPaint(bool aForceFullRepaint,
|
|
PAINTSTRUCT ps, HDC aDC);
|
|
static void ActivateOtherWindowHelper(HWND aWnd);
|
|
void ClearCachedResources();
|
|
nsIWidgetListener* GetPaintListener();
|
|
|
|
mozilla::widget::WinCompositorWidgetProxy* GetCompositorWidgetProxy();
|
|
|
|
protected:
|
|
nsCOMPtr<nsIWidget> mParent;
|
|
nsIntSize mLastSize;
|
|
nsIntPoint mLastPoint;
|
|
HWND mWnd;
|
|
WNDPROC mPrevWndProc;
|
|
HBRUSH mBrush;
|
|
IMEContext mDefaultIMC;
|
|
bool mIsTopWidgetWindow;
|
|
bool mInDtor;
|
|
bool mIsVisible;
|
|
bool mUnicodeWidget;
|
|
bool mPainting;
|
|
bool mTouchWindow;
|
|
bool mDisplayPanFeedback;
|
|
bool mHideChrome;
|
|
bool mIsRTL;
|
|
bool mFullscreenMode;
|
|
bool mMousePresent;
|
|
bool mDestroyCalled;
|
|
uint32_t mBlurSuppressLevel;
|
|
DWORD_PTR mOldStyle;
|
|
DWORD_PTR mOldExStyle;
|
|
nsNativeDragTarget* mNativeDragTarget;
|
|
HKL mLastKeyboardLayout;
|
|
nsSizeMode mOldSizeMode;
|
|
nsSizeMode mLastSizeMode;
|
|
WindowHook mWindowHook;
|
|
uint32_t mPickerDisplayCount;
|
|
HICON mIconSmall;
|
|
HICON mIconBig;
|
|
static bool sDropShadowEnabled;
|
|
static uint32_t sInstanceCount;
|
|
static TriStateBool sCanQuit;
|
|
static nsWindow* sCurrentWindow;
|
|
static BOOL sIsOleInitialized;
|
|
static HCURSOR sHCursor;
|
|
static imgIContainer* sCursorImgContainer;
|
|
static bool sSwitchKeyboardLayout;
|
|
static bool sJustGotDeactivate;
|
|
static bool sJustGotActivate;
|
|
static bool sIsInMouseCapture;
|
|
static int sTrimOnMinimize;
|
|
|
|
// Always use the helper method to read this property. See bug 603793.
|
|
static TriStateBool sHasBogusPopupsDropShadowOnMultiMonitor;
|
|
static bool HasBogusPopupsDropShadowOnMultiMonitor();
|
|
|
|
// Non-client margin settings
|
|
// Pre-calculated outward offset applied to default frames
|
|
LayoutDeviceIntMargin mNonClientOffset;
|
|
// Margins set by the owner
|
|
LayoutDeviceIntMargin mNonClientMargins;
|
|
// Margins we'd like to set once chrome is reshown:
|
|
LayoutDeviceIntMargin mFutureMarginsOnceChromeShows;
|
|
// Indicates we need to apply margins once toggling chrome into showing:
|
|
bool mFutureMarginsToUse;
|
|
|
|
// Indicates custom frames are enabled
|
|
bool mCustomNonClient;
|
|
// Cached copy of L&F's resize border
|
|
int32_t mHorResizeMargin;
|
|
int32_t mVertResizeMargin;
|
|
// Height of the caption plus border
|
|
int32_t mCaptionHeight;
|
|
|
|
double mDefaultScale;
|
|
|
|
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
|
|
|
|
// Draggable titlebar region maintained by UpdateWindowDraggingRegion
|
|
LayoutDeviceIntRegion mDraggableRegion;
|
|
|
|
// 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;
|
|
static bool sProcessHook;
|
|
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
|
|
|
|
LayoutDeviceIntRect mLastPaintBounds;
|
|
|
|
// Transparency
|
|
#ifdef MOZ_XUL
|
|
nsTransparencyMode mTransparencyMode;
|
|
nsIntRegion mPossiblyTransparentRegion;
|
|
MARGINS mGlassMargins;
|
|
#endif // MOZ_XUL
|
|
|
|
// Win7 Gesture processing and management
|
|
nsWinGesture mGesture;
|
|
|
|
// 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.
|
|
bool mHasTaskbarIconBeenCreated;
|
|
|
|
// Indicates that mouse events should be ignored and pass through to the
|
|
// window below. This is currently only used for popups.
|
|
bool mMouseTransparent;
|
|
|
|
// Whether we're in the process of sending a WM_SETTEXT ourselves
|
|
bool mSendingSetText;
|
|
|
|
// 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;
|
|
|
|
// Caching for hit test results
|
|
POINT mCachedHitTestPoint;
|
|
TimeStamp mCachedHitTestTime;
|
|
int32_t mCachedHitTestResult;
|
|
|
|
static bool sNeedsToInitMouseWheelSettings;
|
|
static void InitMouseWheelScrollData();
|
|
|
|
double mSizeConstraintsScale; // scale in effect when setting constraints
|
|
};
|
|
|
|
/**
|
|
* A child window is a window with different style.
|
|
*/
|
|
class ChildWindow : public nsWindow {
|
|
|
|
public:
|
|
ChildWindow() {}
|
|
|
|
protected:
|
|
virtual DWORD WindowStyle();
|
|
};
|
|
|
|
#endif // Window_h__
|