2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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 Window_h__
|
|
|
|
#define Window_h__
|
|
|
|
|
2009-06-29 23:00:16 -07:00
|
|
|
/*
|
|
|
|
* nsWindow - Native window management and event handling.
|
|
|
|
*/
|
|
|
|
|
2011-01-17 19:07:29 -08:00
|
|
|
#include "nsAutoPtr.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsBaseWidget.h"
|
2013-01-07 07:18:11 -08:00
|
|
|
#include "nsWindowBase.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsdefs.h"
|
2010-04-16 10:37:16 -07:00
|
|
|
#include "nsIdleService.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsToolkit.h"
|
|
|
|
#include "nsString.h"
|
2008-04-18 07:36:05 -07:00
|
|
|
#include "nsTArray.h"
|
2012-12-15 17:26:04 -08:00
|
|
|
#include "nsEvent.h"
|
2009-06-29 12:36:16 -07:00
|
|
|
#include "gfxWindowsSurface.h"
|
|
|
|
#include "nsWindowDbg.h"
|
2009-06-23 17:26:11 -07:00
|
|
|
#include "cairo.h"
|
2010-12-06 18:06:31 -08:00
|
|
|
#include "nsITimer.h"
|
2012-01-13 17:29:22 -08:00
|
|
|
#include "mozilla/TimeStamp.h"
|
|
|
|
|
2010-02-25 22:36:07 -08:00
|
|
|
#ifdef CAIRO_HAS_D2D_SURFACE
|
|
|
|
#include "gfxD2DSurface.h"
|
|
|
|
#endif
|
2009-06-23 17:26:11 -07:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
#include "nsWinGesture.h"
|
2009-05-03 15:20:11 -07:00
|
|
|
|
2009-08-13 16:04:39 -07:00
|
|
|
#include "WindowHook.h"
|
2009-10-05 19:26:54 -07:00
|
|
|
#include "TaskbarWindowPreview.h"
|
2009-08-13 16:04:39 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-10-04 01:33:24 -07:00
|
|
|
#include "oleacc.h"
|
2012-05-28 18:18:45 -07:00
|
|
|
#include "mozilla/a11y/Accessible.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2010-03-17 15:56:00 -07:00
|
|
|
#include "nsUXThemeData.h"
|
2011-04-24 20:10:12 -07:00
|
|
|
|
2011-08-26 00:43:56 -07:00
|
|
|
#include "nsIDOMMouseEvent.h"
|
|
|
|
|
2012-06-29 01:32:21 -07:00
|
|
|
#include "nsIIdleServiceInternal.h"
|
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* Forward class definitions
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-06-29 12:36:16 -07:00
|
|
|
|
|
|
|
class nsNativeDragTarget;
|
|
|
|
class nsIRollupListener;
|
|
|
|
class nsIFile;
|
|
|
|
class imgIContainer;
|
2008-08-30 01:57:48 -07:00
|
|
|
|
2012-05-03 01:35:02 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
class NativeKey;
|
2012-06-15 02:52:50 -07:00
|
|
|
class ModifierKeyState;
|
2013-07-18 01:12:31 -07:00
|
|
|
struct MSGResult;
|
2012-05-03 01:35:02 -07:00
|
|
|
} // namespace widget
|
|
|
|
} // namespacw mozilla;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Native WIN32 window wrapper.
|
|
|
|
*/
|
|
|
|
|
2013-01-07 07:18:11 -08:00
|
|
|
class nsWindow : public nsWindowBase
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-01-13 17:29:22 -08:00
|
|
|
typedef mozilla::TimeStamp TimeStamp;
|
|
|
|
typedef mozilla::TimeDuration TimeDuration;
|
2009-08-13 16:04:39 -07:00
|
|
|
typedef mozilla::widget::WindowHook WindowHook;
|
2009-10-05 19:26:54 -07:00
|
|
|
typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
|
2012-05-03 01:35:02 -07:00
|
|
|
typedef mozilla::widget::NativeKey NativeKey;
|
2013-07-18 01:12:31 -07:00
|
|
|
typedef mozilla::widget::MSGResult MSGResult;
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
|
|
|
nsWindow();
|
|
|
|
virtual ~nsWindow();
|
|
|
|
|
2007-08-07 08:18:36 -07:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
friend class nsWindowGfx;
|
|
|
|
|
2013-01-07 07:18:11 -08:00
|
|
|
// nsWindowBase
|
|
|
|
virtual void InitEvent(nsGUIEvent& aEvent, nsIntPoint* aPoint = nullptr) MOZ_OVERRIDE;
|
|
|
|
virtual bool DispatchWindowEvent(nsGUIEvent* aEvent) MOZ_OVERRIDE;
|
2013-08-09 03:12:38 -07:00
|
|
|
virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) MOZ_OVERRIDE;
|
|
|
|
virtual bool IsTopLevelWidget() MOZ_OVERRIDE { return mIsTopWidgetWindow; }
|
2013-01-07 07:18:11 -08:00
|
|
|
|
|
|
|
// nsIWidget interface
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD Create(nsIWidget *aParent,
|
2009-09-23 23:18:10 -07:00
|
|
|
nsNativeWidget aNativeParent,
|
2009-01-14 19:27:09 -08:00
|
|
|
const nsIntRect &aRect,
|
2011-04-16 18:22:44 -07:00
|
|
|
nsDeviceContext *aContext,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsWidgetInitData *aInitData = nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD Destroy();
|
|
|
|
NS_IMETHOD SetParent(nsIWidget *aNewParent);
|
|
|
|
virtual nsIWidget* GetParent(void);
|
2010-08-13 02:57:55 -07:00
|
|
|
virtual float GetDPI();
|
2012-10-30 17:31:35 -07:00
|
|
|
virtual double GetDefaultScaleInternal();
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD Show(bool bState);
|
2012-07-19 01:57:50 -07:00
|
|
|
virtual bool IsVisible() const;
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY);
|
2012-07-30 17:43:29 -07:00
|
|
|
virtual void SetSizeConstraints(const SizeConstraints& aConstraints);
|
2012-12-12 01:57:38 -08:00
|
|
|
NS_IMETHOD Move(double aX, double aY);
|
|
|
|
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint);
|
|
|
|
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, int32_t aHorizontal, int32_t aVertical);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD SetSizeMode(int32_t aMode);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD Enable(bool aState);
|
2012-07-22 22:19:08 -07:00
|
|
|
virtual bool IsEnabled() const;
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD SetFocus(bool aRaise);
|
2009-01-14 19:27:09 -08:00
|
|
|
NS_IMETHOD GetBounds(nsIntRect &aRect);
|
|
|
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
2009-06-29 12:36:16 -07:00
|
|
|
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
2010-07-27 06:38:03 -07:00
|
|
|
virtual nsIntPoint GetClientOffset();
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
|
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aHotspotX, uint32_t aHotspotY);
|
2009-06-29 12:36:16 -07:00
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
2009-07-21 17:44:55 -07:00
|
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD MakeFullScreen(bool aFullScreen);
|
|
|
|
NS_IMETHOD HideWindowChrome(bool aShouldHide);
|
2011-12-23 19:52:21 -08:00
|
|
|
NS_IMETHOD Invalidate(bool aEraseBackground = false,
|
2011-10-07 18:52:09 -07:00
|
|
|
bool aUpdateNCArea = false,
|
|
|
|
bool aIncludeChildren = false);
|
2011-12-23 19:52:21 -08:00
|
|
|
NS_IMETHOD Invalidate(const nsIntRect & aRect);
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType);
|
|
|
|
virtual void FreeNativeData(void * data, uint32_t aDataType);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle);
|
|
|
|
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
|
2009-02-18 16:11:49 -08:00
|
|
|
virtual nsIntPoint WidgetToScreenOffset();
|
2010-07-27 06:38:03 -07:00
|
|
|
virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD EnableDragDrop(bool aEnable);
|
|
|
|
NS_IMETHOD CaptureMouse(bool aCapture);
|
2011-11-08 11:59:07 -08:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener,
|
2012-10-26 06:15:22 -07:00
|
|
|
bool aDoCapture);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetAttention(int32_t aCycleCount);
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool HasPendingInputEvent();
|
2013-04-24 11:42:40 -07:00
|
|
|
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
2012-07-18 09:31:40 -07:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
|
2011-08-09 12:38:26 -07:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
2012-07-30 07:20:58 -07:00
|
|
|
bool* aAllowRetaining = nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
gfxASurface *GetThebesSurface();
|
2009-07-15 02:54:30 -07:00
|
|
|
NS_IMETHOD OnDefaultButtonLoaded(const nsIntRect &aButtonRect);
|
2013-03-15 02:03:16 -07:00
|
|
|
NS_IMETHOD OverrideSystemMouseScrollSpeed(double aOriginalDeltaX,
|
|
|
|
double aOriginalDeltaY,
|
|
|
|
double& aOverriddenDeltaX,
|
|
|
|
double& aOverriddenDeltaY);
|
2009-09-24 03:58:04 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
|
|
|
int32_t aNativeKeyCode,
|
|
|
|
uint32_t aModifierFlags,
|
2009-06-29 12:36:16 -07:00
|
|
|
const nsAString& aCharacters,
|
|
|
|
const nsAString& aUnmodifiedCharacters);
|
2009-10-07 04:14:12 -07:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aNativeMessage,
|
|
|
|
uint32_t aModifierFlags);
|
2012-04-11 14:55:21 -07:00
|
|
|
|
|
|
|
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
|
|
|
{ return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0); }
|
|
|
|
|
2012-03-21 17:59:12 -07:00
|
|
|
virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aNativeMessage,
|
2012-03-21 17:59:12 -07:00
|
|
|
double aDeltaX,
|
|
|
|
double aDeltaY,
|
|
|
|
double aDeltaZ,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aModifierFlags,
|
|
|
|
uint32_t aAdditionalFlags);
|
2013-03-05 22:14:32 -08:00
|
|
|
NS_IMETHOD NotifyIME(NotificationToIME aNotification) MOZ_OVERRIDE;
|
2011-11-27 03:51:52 -08:00
|
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction);
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext();
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState);
|
2010-08-02 06:34:54 -07:00
|
|
|
NS_IMETHOD RegisterTouchWindow();
|
|
|
|
NS_IMETHOD UnregisterTouchWindow();
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef MOZ_XUL
|
2008-08-12 17:44:14 -07:00
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
|
|
|
virtual nsTransparencyMode GetTransparencyMode();
|
2011-05-13 09:40:46 -07:00
|
|
|
virtual void UpdateOpaqueRegion(const nsIntRegion& aOpaqueRegion);
|
2009-06-29 12:36:16 -07:00
|
|
|
#endif // MOZ_XUL
|
2013-03-05 22:14:34 -08:00
|
|
|
NS_IMETHOD NotifyIMEOfTextChange(uint32_t aStart,
|
|
|
|
uint32_t aOldEnd,
|
|
|
|
uint32_t aNewEnd) MOZ_OVERRIDE;
|
2012-11-13 05:04:45 -08:00
|
|
|
virtual nsIMEUpdatePreference GetIMEUpdatePreference();
|
2010-06-24 19:01:07 -07:00
|
|
|
NS_IMETHOD GetNonClientMargins(nsIntMargin &margins);
|
|
|
|
NS_IMETHOD SetNonClientMargins(nsIntMargin &margins);
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetDrawsInTitlebar(bool aState);
|
2009-02-10 12:56:51 -08:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* Event helpers
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool DispatchMouseEvent(uint32_t aEventType, WPARAM wParam,
|
2007-03-22 10:30:00 -07:00
|
|
|
LPARAM lParam,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aIsContextMenuKey = false,
|
2012-08-22 08:56:38 -07:00
|
|
|
int16_t aButton = nsMouseEvent::eLeftButton,
|
|
|
|
uint16_t aInputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE);
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool DispatchWindowEvent(nsGUIEvent*event, nsEventStatus &aStatus);
|
2010-08-08 02:23:25 -07:00
|
|
|
void DispatchPendingEvents();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool DispatchPluginEvent(UINT aMessage,
|
2010-08-08 02:23:25 -07:00
|
|
|
WPARAM aWParam,
|
|
|
|
LPARAM aLParam,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aDispatchPendingEvents);
|
2010-08-08 02:23:25 -07:00
|
|
|
|
2012-10-27 21:24:02 -07:00
|
|
|
void SuppressBlurEvents(bool aSuppress); // Called from nsFilePicker
|
|
|
|
bool BlurEventsSuppressed();
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef ACCESSIBILITY
|
2013-06-27 08:03:58 -07:00
|
|
|
/**
|
|
|
|
* Return an accessible associated with the window.
|
|
|
|
*/
|
|
|
|
mozilla::a11y::Accessible* GetAccessible();
|
2009-06-29 12:36:16 -07:00
|
|
|
#endif // ACCESSIBILITY
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Window utilities
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
nsWindow* GetTopLevelWindow(bool aStopOnDialogOrPopup);
|
2009-06-29 12:36:16 -07:00
|
|
|
WNDPROC GetPrevWindowProc() { return mPrevWndProc; }
|
2009-08-13 16:04:39 -07:00
|
|
|
WindowHook& GetWindowHook() { return mWindowHook; }
|
2011-09-28 23:19:26 -07:00
|
|
|
nsWindow* GetParentWindow(bool aIncludeOwner);
|
2010-12-06 18:05:48 -08:00
|
|
|
// Get an array of all nsWindow*s on the main thread.
|
|
|
|
typedef void (WindowEnumCallback)(nsWindow*);
|
|
|
|
static void EnumAllWindows(WindowEnumCallback aCallback);
|
2009-05-03 15:20:11 -07:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* Misc.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool AutoErase(HDC dc);
|
2013-08-09 03:12:38 -07:00
|
|
|
|
2010-12-06 18:06:31 -08:00
|
|
|
/**
|
|
|
|
* Start allowing Direct3D9 to be used by widgets when GetLayerManager is
|
|
|
|
* called.
|
|
|
|
*
|
|
|
|
* @param aReinitialize Call GetLayerManager on widgets to ensure D3D9 is
|
|
|
|
* initialized, this is usually called when this function
|
|
|
|
* is triggered by timeout and not user/web interaction.
|
|
|
|
*/
|
|
|
|
static void StartAllowingD3D9(bool aReinitialize);
|
2009-05-03 15:20:11 -07:00
|
|
|
|
2011-07-07 05:02:07 -07: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-28 23:19:26 -07:00
|
|
|
bool AssociateDefaultIMC(bool aAssociate);
|
2011-07-07 05:02:07 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HasTaskbarIconBeenCreated() { return mHasTaskbarIconBeenCreated; }
|
2009-10-05 19:26:54 -07:00
|
|
|
// Called when either the nsWindow or an nsITaskbarTabPreview receives the noticiation that this window
|
|
|
|
// has its icon placed on the taskbar.
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetHasTaskbarIconBeenCreated(bool created = true) { mHasTaskbarIconBeenCreated = created; }
|
2009-10-05 19:26:54 -07: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); }
|
|
|
|
|
2010-09-18 04:28:50 -07:00
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
2011-12-07 11:01:48 -08:00
|
|
|
|
|
|
|
// Open file picker tracking
|
|
|
|
void PickerOpen();
|
|
|
|
void PickerClosed();
|
|
|
|
|
2011-12-14 13:22:28 -08:00
|
|
|
bool const DestroyCalled() { return mDestroyCalled; }
|
2012-03-21 17:59:12 -07:00
|
|
|
|
2013-08-04 00:46:17 -07:00
|
|
|
virtual mozilla::layers::LayersBackend GetPreferredCompositorBackend();
|
2013-05-03 10:34:33 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
2013-08-08 16:32:26 -07:00
|
|
|
virtual void WindowUsesOMTC() MOZ_OVERRIDE;
|
|
|
|
|
2010-12-28 02:16:43 -08:00
|
|
|
// A magic number to identify the FAKETRACKPOINTSCROLLABLE window created
|
|
|
|
// when the trackpoint hack is enabled.
|
|
|
|
enum { eFakeTrackPointScrollableID = 0x46545053 };
|
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* Callbacks
|
|
|
|
*/
|
|
|
|
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
2010-08-16 12:25:13 -07:00
|
|
|
static LRESULT CALLBACK WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
2009-06-29 12:36:16 -07: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 06:34:54 -07:00
|
|
|
static BOOL CALLBACK RegisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
|
|
|
|
static BOOL CALLBACK UnregisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
|
2007-03-22 10:30:00 -07: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-19 20:40:51 -07:00
|
|
|
static BOOL CALLBACK ClearResourcesCallback(HWND aChild, LPARAM aParam);
|
2010-12-06 18:05:48 -08:00
|
|
|
static BOOL CALLBACK EnumAllChildWindProc(HWND aWnd, LPARAM aParam);
|
|
|
|
static BOOL CALLBACK EnumAllThreadWindowProc(HWND aWnd, LPARAM aParam);
|
2010-12-06 18:06:31 -08:00
|
|
|
static void AllowD3D9Callback(nsWindow *aWindow);
|
|
|
|
static void AllowD3D9WithReinitializeCallback(nsWindow *aWindow);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* Window utilities
|
|
|
|
*/
|
|
|
|
LPARAM lParamToScreen(LPARAM lParam);
|
|
|
|
LPARAM lParamToClient(LPARAM lParam);
|
|
|
|
virtual void SubclassWindow(BOOL bState);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool CanTakeFocus();
|
2012-08-22 08:56:38 -07:00
|
|
|
bool UpdateNonClientMargins(int32_t aSizeMode = -1, bool aReflowWindow = true);
|
2011-09-28 23:19:26 -07:00
|
|
|
void UpdateGetWindowInfoCaptionStatus(bool aActiveCaption);
|
2010-07-15 23:20:02 -07:00
|
|
|
void ResetLayout();
|
2010-08-09 18:49:35 -07:00
|
|
|
void InvalidateNonClientRegion();
|
|
|
|
HRGN ExcludeNonClientFromPaintRegion(HRGN aRegion);
|
2010-11-08 01:06:13 -08:00
|
|
|
static void GetMainWindowClass(nsAString& aClass);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HasGlass() const {
|
2010-08-17 20:07:10 -07:00
|
|
|
return mTransparencyMode == eTransparencyGlass ||
|
|
|
|
mTransparencyMode == eTransparencyBorderlessGlass;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* Event processing helpers
|
|
|
|
*/
|
2012-08-15 11:52:42 -07:00
|
|
|
void DispatchFocusToTopLevelWindow(bool aIsActivate);
|
2012-08-22 08:56:38 -07:00
|
|
|
bool DispatchStandardEvent(uint32_t aMsg);
|
|
|
|
bool DispatchCommandEvent(uint32_t aEventCommand);
|
2009-06-29 12:36:16 -07:00
|
|
|
void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool ProcessMessage(UINT msg, WPARAM &wParam,
|
2009-05-03 15:20:11 -07:00
|
|
|
LPARAM &lParam, LRESULT *aRetValue);
|
2013-07-18 01:12:31 -07:00
|
|
|
bool ExternalHandlerProcessMessage(
|
|
|
|
UINT aMessage, WPARAM& aWParam,
|
|
|
|
LPARAM& aLParam, MSGResult& aResult);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ProcessMessageForPlugin(const MSG &aMsg,
|
2013-07-18 01:12:31 -07:00
|
|
|
MSGResult& aResult);
|
2008-12-14 19:54:54 -08:00
|
|
|
LRESULT ProcessCharMessage(const MSG &aMsg,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool *aEventDispatched);
|
2008-12-14 19:54:54 -08:00
|
|
|
LRESULT ProcessKeyUpMessage(const MSG &aMsg,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool *aEventDispatched);
|
2008-12-14 19:54:54 -08:00
|
|
|
LRESULT ProcessKeyDownMessage(const MSG &aMsg,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool *aEventDispatched);
|
|
|
|
static bool EventIsInsideWindow(UINT Msg, nsWindow* aWindow);
|
2009-06-29 12:36:16 -07:00
|
|
|
// Convert nsEventStatus value to a windows boolean
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool ConvertStatus(nsEventStatus aStatus);
|
2011-11-08 11:59:09 -08:00
|
|
|
static void PostSleepWakeNotification(const bool aIsSleepMode);
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t ClientMarginHitTestPoint(int32_t mx, int32_t my);
|
2008-12-14 19:54:54 -08:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* Event handlers
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual void OnDestroy();
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool OnMove(int32_t aX, int32_t aY);
|
2011-09-28 23:19:26 -07: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 08:56:38 -07:00
|
|
|
bool OnPaint(HDC aDC, uint32_t aNestingLevel);
|
2011-09-28 23:19:26 -07:00
|
|
|
void OnWindowPosChanged(WINDOWPOS *wp, bool& aResult);
|
2009-06-29 12:36:16 -07:00
|
|
|
void OnWindowPosChanging(LPWINDOWPOS& info);
|
2011-11-21 09:53:20 -08:00
|
|
|
void OnSysColorChanged();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-16 10:37:16 -07:00
|
|
|
/**
|
|
|
|
* Function that registers when the user has been active (used for detecting
|
|
|
|
* when the user is idle).
|
|
|
|
*/
|
|
|
|
void UserActivity();
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetHeight(int32_t aProposedHeight);
|
2010-11-08 01:06:13 -08:00
|
|
|
void GetWindowClass(nsString& aWindowClass);
|
|
|
|
void GetWindowPopupClass(nsString& aWindowClass);
|
2009-06-29 12:36:16 -07:00
|
|
|
virtual DWORD WindowStyle();
|
2010-11-08 01:06:13 -08:00
|
|
|
DWORD WindowExStyle();
|
|
|
|
|
|
|
|
void RegisterWindowClass(const nsString& aClassName,
|
|
|
|
UINT aExtraStyle,
|
|
|
|
LPWSTR aIconID);
|
2008-05-06 21:46:37 -07:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* XP and Vista theming support for windows with rounded edges
|
|
|
|
*/
|
|
|
|
void ClearThemeRegion();
|
|
|
|
void SetThemeRegion();
|
2009-03-24 17:51:57 -07:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* Popup hooks
|
|
|
|
*/
|
|
|
|
static void ScheduleHookTimer(HWND aWnd, UINT aMsgId);
|
|
|
|
static void RegisterSpecialDropdownHooks();
|
|
|
|
static void UnregisterSpecialDropdownHooks();
|
2012-12-31 09:27:04 -08:00
|
|
|
static bool DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLParam, LRESULT* outResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* Window transparency helpers
|
|
|
|
*/
|
|
|
|
#ifdef MOZ_XUL
|
2009-03-26 17:15:41 -07:00
|
|
|
private:
|
2009-06-29 12:36:16 -07:00
|
|
|
void SetWindowTranslucencyInner(nsTransparencyMode aMode);
|
|
|
|
nsTransparencyMode GetWindowTranslucencyInner() const { return mTransparencyMode; }
|
2012-08-22 08:56:38 -07:00
|
|
|
void ResizeTranslucentWindow(int32_t aNewWidth, int32_t aNewHeight, bool force = false);
|
2009-06-29 12:36:16 -07:00
|
|
|
nsresult UpdateTranslucentWindow();
|
2012-07-12 04:39:21 -07:00
|
|
|
void ClearTranslucentWindow();
|
2009-06-29 12:36:16 -07:00
|
|
|
void SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode);
|
2010-03-17 15:56:00 -07:00
|
|
|
void UpdateGlass();
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2009-06-29 12:36:16 -07:00
|
|
|
#endif // MOZ_XUL
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-02-09 14:34:38 -08:00
|
|
|
static bool IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult);
|
2010-02-22 17:09:27 -08:00
|
|
|
void IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam);
|
2010-02-09 14:34:38 -08:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* Misc.
|
|
|
|
*/
|
|
|
|
void StopFlashing();
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool IsTopLevelMouseExit(HWND aWnd);
|
2009-07-21 17:44:55 -07:00
|
|
|
nsresult SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aIntersectWithExisting);
|
|
|
|
nsIntRegion GetRegionToPaint(bool aForceFullRepaint,
|
2009-08-20 15:15:01 -07:00
|
|
|
PAINTSTRUCT ps, HDC aDC);
|
2009-11-11 17:11:57 -08:00
|
|
|
static void ActivateOtherWindowHelper(HWND aWnd);
|
2010-08-19 20:40:51 -07:00
|
|
|
void ClearCachedResources();
|
2012-12-12 13:57:08 -08:00
|
|
|
nsIWidgetListener* GetPaintListener();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
protected:
|
2010-06-02 06:02:05 -07:00
|
|
|
nsCOMPtr<nsIWidget> mParent;
|
2009-06-29 12:36:16 -07:00
|
|
|
nsIntSize mLastSize;
|
|
|
|
nsIntPoint mLastPoint;
|
|
|
|
HWND mWnd;
|
|
|
|
WNDPROC mPrevWndProc;
|
|
|
|
HBRUSH mBrush;
|
2011-09-28 23:19:26 -07: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 11:01:48 -08:00
|
|
|
bool mDestroyCalled;
|
2012-10-27 21:24:02 -07:00
|
|
|
uint32_t mBlurSuppressLevel;
|
2009-06-29 12:36:16 -07:00
|
|
|
DWORD_PTR mOldStyle;
|
|
|
|
DWORD_PTR mOldExStyle;
|
|
|
|
nsNativeDragTarget* mNativeDragTarget;
|
|
|
|
HKL mLastKeyboardLayout;
|
2010-06-27 23:04:20 -07:00
|
|
|
nsSizeMode mOldSizeMode;
|
2012-05-04 19:46:35 -07:00
|
|
|
nsSizeMode mLastSizeMode;
|
2009-08-13 16:04:39 -07:00
|
|
|
WindowHook mWindowHook;
|
2011-02-11 17:56:13 -08:00
|
|
|
DWORD mAssumeWheelIsZoomUntil;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mPickerDisplayCount;
|
2012-07-05 16:06:13 -07:00
|
|
|
HICON mIconSmall;
|
|
|
|
HICON mIconBig;
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool sDropShadowEnabled;
|
2012-08-22 08:56:38 -07:00
|
|
|
static uint32_t sInstanceCount;
|
2009-06-29 12:36:16 -07:00
|
|
|
static TriStateBool sCanQuit;
|
|
|
|
static nsWindow* sCurrentWindow;
|
|
|
|
static BOOL sIsOleInitialized;
|
|
|
|
static HCURSOR sHCursor;
|
|
|
|
static imgIContainer* sCursorImgContainer;
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool sSwitchKeyboardLayout;
|
|
|
|
static bool sJustGotDeactivate;
|
|
|
|
static bool sJustGotActivate;
|
|
|
|
static bool sIsInMouseCapture;
|
2009-06-29 12:36:16 -07:00
|
|
|
static int sTrimOnMinimize;
|
2010-11-08 01:06:13 -08:00
|
|
|
static const char* sDefaultMainWindowClass;
|
2010-12-06 18:06:31 -08:00
|
|
|
static bool sAllowD3D9;
|
2011-03-02 03:53:55 -08:00
|
|
|
|
|
|
|
// Always use the helper method to read this property. See bug 603793.
|
|
|
|
static TriStateBool sHasBogusPopupsDropShadowOnMultiMonitor;
|
|
|
|
static bool HasBogusPopupsDropShadowOnMultiMonitor();
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
static uint32_t sOOPPPluginFocusEvent;
|
2009-06-29 12:36:16 -07:00
|
|
|
|
2010-06-24 19:01:07 -07:00
|
|
|
// Non-client margin settings
|
|
|
|
// Pre-calculated outward offset applied to default frames
|
|
|
|
nsIntMargin mNonClientOffset;
|
|
|
|
// Margins set by the owner
|
|
|
|
nsIntMargin mNonClientMargins;
|
2010-08-27 14:26:30 -07:00
|
|
|
|
2010-06-24 19:01:07 -07:00
|
|
|
// Indicates custom frames are enabled
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCustomNonClient;
|
2010-06-24 19:01:07 -07:00
|
|
|
// Cached copy of L&F's resize border
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mHorResizeMargin;
|
|
|
|
int32_t mVertResizeMargin;
|
2010-06-24 19:01:07 -07:00
|
|
|
// Height of the caption plus border
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mCaptionHeight;
|
2010-06-24 19:01:07 -07:00
|
|
|
|
2012-06-29 01:32:21 -07:00
|
|
|
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
|
2010-04-16 10:37:16 -07:00
|
|
|
|
2009-06-29 12:36:16 -07: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-28 23:19:26 -07:00
|
|
|
static bool sProcessHook;
|
2009-06-29 12:36:16 -07: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-08 16:34:02 -07:00
|
|
|
|
2010-02-25 22:36:07 -08:00
|
|
|
#ifdef CAIRO_HAS_D2D_SURFACE
|
|
|
|
nsRefPtr<gfxD2DSurface> mD2DWindowSurface; // Surface for this window.
|
|
|
|
#endif
|
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
// Transparency
|
|
|
|
#ifdef MOZ_XUL
|
|
|
|
// Use layered windows to support full 256 level alpha translucency
|
2010-06-21 18:10:36 -07:00
|
|
|
nsRefPtr<gfxASurface> mTransparentSurface;
|
2009-06-29 12:36:16 -07:00
|
|
|
HDC mMemoryDC;
|
|
|
|
nsTransparencyMode mTransparencyMode;
|
2010-03-17 15:56:00 -07:00
|
|
|
nsIntRegion mPossiblyTransparentRegion;
|
|
|
|
MARGINS mGlassMargins;
|
2009-06-29 12:36:16 -07:00
|
|
|
#endif // MOZ_XUL
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
// Win7 Gesture processing and management
|
|
|
|
nsWinGesture mGesture;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-10-05 19:26:54 -07: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-28 23:19:26 -07:00
|
|
|
bool mHasTaskbarIconBeenCreated;
|
2009-10-05 19:26:54 -07:00
|
|
|
|
2012-01-13 17:29:22 -08: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 04:19:34 -07:00
|
|
|
// Caching for hit test results
|
|
|
|
POINT mCachedHitTestPoint;
|
|
|
|
TimeStamp mCachedHitTestTime;
|
|
|
|
int32_t mCachedHitTestResult;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool sNeedsToInitMouseWheelSettings;
|
2011-05-16 17:23:23 -07:00
|
|
|
static void InitMouseWheelScrollData();
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2009-06-29 12:36:16 -07:00
|
|
|
/**
|
|
|
|
* A child window is a window with different style.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
class ChildWindow : public nsWindow {
|
|
|
|
|
|
|
|
public:
|
|
|
|
ChildWindow() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual DWORD WindowStyle();
|
|
|
|
};
|
|
|
|
|
2009-07-08 09:13:13 -07:00
|
|
|
#endif // Window_h__
|