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.
|
|
|
|
*/
|
|
|
|
|
2011-01-18 06:07:29 +03:00
|
|
|
#include "nsAutoPtr.h"
|
1998-09-23 23:19:23 +04:00
|
|
|
#include "nsBaseWidget.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"
|
2012-12-16 05:26:04 +04:00
|
|
|
#include "nsEvent.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"
|
2012-01-14 05:29:22 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
|
|
|
|
2010-02-26 09:36:07 +03:00
|
|
|
#ifdef CAIRO_HAS_D2D_SURFACE
|
|
|
|
#include "gfxD2DSurface.h"
|
|
|
|
#endif
|
2009-06-24 04:26:11 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
#include "nsWinGesture.h"
|
2009-05-04 02:20:11 +04:00
|
|
|
|
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-04-25 07:10:12 +04:00
|
|
|
|
2011-08-26 11:43:56 +04:00
|
|
|
#include "nsIDOMMouseEvent.h"
|
|
|
|
|
2012-06-29 12:32:21 +04:00
|
|
|
#include "nsIIdleServiceInternal.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 nsIFile;
|
|
|
|
class imgIContainer;
|
2008-08-30 12:57:48 +04:00
|
|
|
|
2012-05-03 12:35:02 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
class NativeKey;
|
2012-06-15 13:52:50 +04:00
|
|
|
class ModifierKeyState;
|
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
|
|
|
*/
|
|
|
|
|
2009-08-05 02:15:19 +04:00
|
|
|
class nsWindow : public nsBaseWidget
|
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;
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
2004-09-03 12:44:23 +04:00
|
|
|
nsWindow();
|
|
|
|
virtual ~nsWindow();
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* nsIWidget interface
|
|
|
|
*/
|
2004-09-03 12:44:23 +04:00
|
|
|
NS_IMETHOD Create(nsIWidget *aParent,
|
2009-09-24 10:18:10 +04:00
|
|
|
nsNativeWidget aNativeParent,
|
2009-01-15 06:27:09 +03:00
|
|
|
const nsIntRect &aRect,
|
2011-04-17 05:22:44 +04:00
|
|
|
nsDeviceContext *aContext,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsWidgetInitData *aInitData = nullptr);
|
2004-09-03 12:44:23 +04:00
|
|
|
NS_IMETHOD Destroy();
|
|
|
|
NS_IMETHOD SetParent(nsIWidget *aNewParent);
|
|
|
|
virtual nsIWidget* GetParent(void);
|
2010-08-13 13:57:55 +04:00
|
|
|
virtual float GetDPI();
|
2012-10-31 04:31:35 +04:00
|
|
|
virtual double GetDefaultScaleInternal();
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD Show(bool bState);
|
2012-07-19 12:57:50 +04:00
|
|
|
virtual bool IsVisible() const;
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY);
|
2012-07-31 04:43:29 +04:00
|
|
|
virtual void SetSizeConstraints(const SizeConstraints& aConstraints);
|
2012-12-12 13:57:38 +04: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 19:56:38 +04:00
|
|
|
NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, int32_t aHorizontal, int32_t aVertical);
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate);
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD SetSizeMode(int32_t aMode);
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD Enable(bool aState);
|
2012-07-23 09:19:08 +04:00
|
|
|
virtual bool IsEnabled() const;
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD SetFocus(bool aRaise);
|
2009-01-15 06:27:09 +03:00
|
|
|
NS_IMETHOD GetBounds(nsIntRect &aRect);
|
|
|
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
2009-06-29 23:36:16 +04:00
|
|
|
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
2010-07-27 17:38:03 +04:00
|
|
|
virtual nsIntPoint GetClientOffset();
|
2004-09-03 12:44:23 +04:00
|
|
|
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
2005-07-01 08:29:42 +04:00
|
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aHotspotX, uint32_t aHotspotY);
|
2009-06-29 23:36:16 +04:00
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
2009-07-22 04:44:55 +04:00
|
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD MakeFullScreen(bool aFullScreen);
|
|
|
|
NS_IMETHOD HideWindowChrome(bool aShouldHide);
|
2011-12-24 07:52:21 +04:00
|
|
|
NS_IMETHOD Invalidate(bool aEraseBackground = false,
|
2011-10-08 05:52:09 +04:00
|
|
|
bool aUpdateNCArea = false,
|
|
|
|
bool aIncludeChildren = false);
|
2011-12-24 07:52:21 +04:00
|
|
|
NS_IMETHOD Invalidate(const nsIntRect & aRect);
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType);
|
|
|
|
virtual void FreeNativeData(void * data, uint32_t aDataType);
|
2004-09-03 12:44:23 +04:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle);
|
|
|
|
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
|
2009-02-19 03:11:49 +03:00
|
|
|
virtual nsIntPoint WidgetToScreenOffset();
|
2010-07-27 17:38:03 +04:00
|
|
|
virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize);
|
2004-09-03 12:44:23 +04:00
|
|
|
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD EnableDragDrop(bool aEnable);
|
|
|
|
NS_IMETHOD CaptureMouse(bool aCapture);
|
2011-11-08 23:59:07 +04:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener,
|
2012-10-26 17:15:22 +04:00
|
|
|
bool aDoCapture);
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD GetAttention(int32_t aCycleCount);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool HasPendingInputEvent();
|
2012-07-30 18:20:58 +04:00
|
|
|
virtual LayerManager* GetLayerManager(PLayersChild* aShadowManager = nullptr,
|
2012-07-18 20:31:40 +04:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE,
|
2011-08-09 23:38:26 +04:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
2012-07-30 18:20:58 +04:00
|
|
|
bool* aAllowRetaining = nullptr);
|
2006-01-31 04:04:41 +03:00
|
|
|
gfxASurface *GetThebesSurface();
|
2009-07-15 13:54:30 +04:00
|
|
|
NS_IMETHOD OnDefaultButtonLoaded(const nsIntRect &aButtonRect);
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD OverrideSystemMouseScrollSpeed(int32_t aOriginalDelta, bool aIsHorizontal, int32_t &aOverriddenDelta);
|
2009-09-24 14:58:04 +04:00
|
|
|
|
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,
|
|
|
|
const nsAString& aUnmodifiedCharacters);
|
2009-10-07 15:14:12 +04:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aNativeMessage,
|
|
|
|
uint32_t aModifierFlags);
|
2012-04-12 01:55:21 +04:00
|
|
|
|
|
|
|
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
|
|
|
{ return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0); }
|
|
|
|
|
2012-03-22 04:59:12 +04:00
|
|
|
virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint 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,
|
|
|
|
uint32_t aAdditionalFlags);
|
2009-06-29 23:36:16 +04:00
|
|
|
NS_IMETHOD ResetInputState();
|
2011-11-27 15:51:52 +04:00
|
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction);
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext();
|
2009-06-29 23:36:16 +04:00
|
|
|
NS_IMETHOD CancelIMEComposition();
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState);
|
2010-08-02 17:34:54 +04:00
|
|
|
NS_IMETHOD RegisterTouchWindow();
|
|
|
|
NS_IMETHOD UnregisterTouchWindow();
|
2004-07-27 23:14:44 +04:00
|
|
|
#ifdef MOZ_XUL
|
2008-08-13 04:44:14 +04:00
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
|
|
|
virtual nsTransparencyMode GetTransparencyMode();
|
2011-05-13 20:40:46 +04:00
|
|
|
virtual void UpdateOpaqueRegion(const nsIntRegion& aOpaqueRegion);
|
2009-06-29 23:36:16 +04:00
|
|
|
#endif // MOZ_XUL
|
2009-02-10 23:56:51 +03:00
|
|
|
#ifdef NS_ENABLE_TSF
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD OnIMEFocusChange(bool aFocus);
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD OnIMETextChange(uint32_t aStart, uint32_t aOldEnd, uint32_t aNewEnd);
|
2009-06-29 23:36:16 +04:00
|
|
|
NS_IMETHOD OnIMESelectionChange(void);
|
2012-11-13 17:04:45 +04:00
|
|
|
virtual nsIMEUpdatePreference GetIMEUpdatePreference();
|
2009-06-29 23:36:16 +04:00
|
|
|
#endif // NS_ENABLE_TSF
|
2010-06-25 06:01:07 +04:00
|
|
|
NS_IMETHOD GetNonClientMargins(nsIntMargin &margins);
|
|
|
|
NS_IMETHOD SetNonClientMargins(nsIntMargin &margins);
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetDrawsInTitlebar(bool aState);
|
2009-02-10 23:56:51 +03:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Event helpers
|
|
|
|
*/
|
2012-07-30 18:20:58 +04:00
|
|
|
void InitEvent(nsGUIEvent& event, nsIntPoint* aPoint = nullptr);
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool DispatchMouseEvent(uint32_t aEventType, WPARAM wParam,
|
2006-11-17 00:35:39 +03:00
|
|
|
LPARAM lParam,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIsContextMenuKey = false,
|
2012-08-22 19:56:38 +04:00
|
|
|
int16_t aButton = nsMouseEvent::eLeftButton,
|
|
|
|
uint16_t aInputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool DispatchWindowEvent(nsGUIEvent* event);
|
|
|
|
virtual bool DispatchWindowEvent(nsGUIEvent*event, nsEventStatus &aStatus);
|
2012-05-03 12:35:02 +04:00
|
|
|
void InitKeyEvent(nsKeyEvent& aKeyEvent,
|
|
|
|
const NativeKey& aNativeKey,
|
2012-06-15 13:52:50 +04:00
|
|
|
const mozilla::widget::ModifierKeyState &aModKeyState);
|
2012-05-03 12:35:02 +04:00
|
|
|
virtual bool DispatchKeyEvent(nsKeyEvent& aKeyEvent,
|
|
|
|
const MSG *aMsgSentToPlugin);
|
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
|
2012-11-18 06:01:44 +04:00
|
|
|
mozilla::a11y::Accessible* GetRootAccessible();
|
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
|
|
|
HWND GetWindowHandle() { return mWnd; }
|
|
|
|
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.
|
|
|
|
typedef void (WindowEnumCallback)(nsWindow*);
|
|
|
|
static void EnumAllWindows(WindowEnumCallback aCallback);
|
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);
|
2009-01-15 06:27:09 +03:00
|
|
|
nsIntPoint* GetLastPoint() { return &mLastPoint; }
|
2009-06-29 23:36:16 +04:00
|
|
|
// needed in nsIMM32Handler.cpp
|
2011-11-27 15:51:52 +04:00
|
|
|
bool PluginHasFocus()
|
|
|
|
{
|
2011-11-27 15:51:53 +04:00
|
|
|
return (mInputContext.mIMEState.mEnabled == IMEState::PLUGIN);
|
2011-11-27 15:51:52 +04:00
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsTopLevelWidget() { return mIsTopWidgetWindow; }
|
2010-12-07 05:06:31 +03: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-04 02:20:11 +04:00
|
|
|
|
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); }
|
|
|
|
|
2010-09-18 15:28:50 +04:00
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
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
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static void SetupKeyModifiersSequence(nsTArray<KeyPair>* aArray, uint32_t aModifiers);
|
2012-06-13 23:53:38 +04:00
|
|
|
|
|
|
|
virtual bool UseOffMainThreadCompositing();
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
2005-02-23 10:07:51 +03: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 };
|
|
|
|
|
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);
|
2010-12-07 05:06:31 +03:00
|
|
|
static void AllowD3D9Callback(nsWindow *aWindow);
|
|
|
|
static void AllowD3D9WithReinitializeCallback(nsWindow *aWindow);
|
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);
|
2010-11-08 12:06:13 +03:00
|
|
|
static void GetMainWindowClass(nsAString& aClass);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasGlass() const {
|
2010-08-18 07:07:10 +04:00
|
|
|
return mTransparencyMode == eTransparencyGlass ||
|
|
|
|
mTransparencyMode == eTransparencyBorderlessGlass;
|
|
|
|
}
|
2004-09-03 12:44:23 +04:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Event processing helpers
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool DispatchPluginEvent(const MSG &aMsg);
|
2012-08-15 22:52:42 +04:00
|
|
|
void DispatchFocusToTopLevelWindow(bool aIsActivate);
|
2012-08-22 19:56:38 +04:00
|
|
|
bool DispatchStandardEvent(uint32_t aMsg);
|
|
|
|
bool DispatchCommandEvent(uint32_t aEventCommand);
|
2009-06-29 23:36:16 +04:00
|
|
|
void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
|
2011-01-14 16:38:57 +03:00
|
|
|
static void RemoveNextCharMessage(HWND aWnd);
|
2011-04-21 03:54:43 +04:00
|
|
|
void RemoveMessageAndDispatchPluginEvent(UINT aFirstMsg,
|
|
|
|
UINT aLastMsg,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsFakeCharMessage* aFakeCharMessage = nullptr);
|
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);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ProcessMessageForPlugin(const MSG &aMsg,
|
|
|
|
LRESULT *aRetValue, bool &aCallDefWndProc);
|
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);
|
|
|
|
static bool EventIsInsideWindow(UINT Msg, 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);
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool IsRedirectedKeyDownMessage(const MSG &aMsg);
|
2011-01-14 16:38:57 +03:00
|
|
|
static void ForgetRedirectedKeyDownMessage()
|
|
|
|
{
|
|
|
|
sRedirectedKeyDown.message = WM_NULL;
|
|
|
|
}
|
2008-12-15 06:54:54 +03:00
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* Event handlers
|
|
|
|
*/
|
2004-09-03 12:44:23 +04:00
|
|
|
virtual void OnDestroy();
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool OnMove(int32_t aX, int32_t aY);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool OnResize(nsIntRect &aWindowRect);
|
2012-05-03 12:35:02 +04:00
|
|
|
/**
|
|
|
|
* @param aVirtualKeyCode If caller knows which key exactly caused the
|
|
|
|
* aMsg, set the virtual key code.
|
|
|
|
* Otherwise, 0.
|
|
|
|
* @param aScanCode If aVirutalKeyCode isn't 0, set the scan code.
|
|
|
|
*/
|
2009-05-04 02:20:11 +04:00
|
|
|
LRESULT OnChar(const MSG &aMsg,
|
2012-05-03 12:35:02 +04:00
|
|
|
const NativeKey& aNativeKey,
|
2012-06-15 13:52:50 +04:00
|
|
|
const mozilla::widget::ModifierKeyState &aModKeyState,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aEventDispatched,
|
2012-12-16 05:26:04 +04:00
|
|
|
const mozilla::widget::EventFlags* aExtraFlags = nullptr);
|
2009-05-04 02:20:11 +04:00
|
|
|
LRESULT OnKeyDown(const MSG &aMsg,
|
2012-06-15 13:52:50 +04:00
|
|
|
const mozilla::widget::ModifierKeyState &aModKeyState,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aEventDispatched,
|
2008-12-15 06:54:54 +03:00
|
|
|
nsFakeCharMessage* aFakeCharMessage);
|
2009-05-04 02:20:11 +04:00
|
|
|
LRESULT OnKeyUp(const MSG &aMsg,
|
2012-06-15 13:52:50 +04:00
|
|
|
const mozilla::widget::ModifierKeyState &aModKeyState,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aEventDispatched);
|
|
|
|
bool OnGesture(WPARAM wParam, LPARAM lParam);
|
|
|
|
bool OnTouch(WPARAM wParam, LPARAM lParam);
|
|
|
|
bool OnHotKey(WPARAM wParam, LPARAM lParam);
|
2009-06-29 23:36:16 +04:00
|
|
|
BOOL OnInputLangChange(HKL aHKL);
|
2012-08-22 19:56:38 +04:00
|
|
|
bool OnPaint(HDC aDC, uint32_t aNestingLevel);
|
2011-09-29 10:19:26 +04:00
|
|
|
void OnWindowPosChanged(WINDOWPOS *wp, bool& aResult);
|
2009-06-29 23:36:16 +04:00
|
|
|
void OnWindowPosChanging(LPWINDOWPOS& info);
|
2011-11-21 21:53:20 +04:00
|
|
|
void OnSysColorChanged();
|
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);
|
2010-11-08 12:06:13 +03:00
|
|
|
void GetWindowClass(nsString& aWindowClass);
|
|
|
|
void GetWindowPopupClass(nsString& aWindowClass);
|
2009-06-29 23:36:16 +04:00
|
|
|
virtual DWORD WindowStyle();
|
2010-11-08 12:06:13 +03:00
|
|
|
DWORD WindowExStyle();
|
|
|
|
|
|
|
|
void RegisterWindowClass(const nsString& aClassName,
|
|
|
|
UINT aExtraStyle,
|
|
|
|
LPWSTR aIconID);
|
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();
|
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; }
|
2012-08-22 19:56:38 +04:00
|
|
|
void ResizeTranslucentWindow(int32_t aNewWidth, int32_t aNewHeight, bool force = false);
|
2009-06-29 23:36:16 +04:00
|
|
|
nsresult UpdateTranslucentWindow();
|
2012-07-12 15:39:21 +04:00
|
|
|
void ClearTranslucentWindow();
|
2009-06-29 23:36:16 +04:00
|
|
|
void SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode);
|
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);
|
2009-07-22 04:44:55 +04:00
|
|
|
nsresult SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIntersectWithExisting);
|
|
|
|
nsIntRegion GetRegionToPaint(bool aForceFullRepaint,
|
2009-08-21 02:15:01 +04:00
|
|
|
PAINTSTRUCT ps, HDC aDC);
|
2009-11-12 04:11:57 +03:00
|
|
|
static void ActivateOtherWindowHelper(HWND aWnd);
|
2010-08-20 07:40:51 +04:00
|
|
|
void ClearCachedResources();
|
2012-12-13 01:57:08 +04:00
|
|
|
nsIWidgetListener* GetPaintListener();
|
2004-09-03 12:44:23 +04:00
|
|
|
|
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;
|
|
|
|
WNDPROC mPrevWndProc;
|
|
|
|
HBRUSH mBrush;
|
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;
|
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;
|
2011-11-27 15:51:52 +04:00
|
|
|
InputContext mInputContext;
|
2009-06-29 23:36:16 +04:00
|
|
|
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;
|
2011-02-12 04:56:13 +03:00
|
|
|
DWORD mAssumeWheelIsZoomUntil;
|
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;
|
2009-06-29 23:36:16 +04:00
|
|
|
static int sTrimOnMinimize;
|
2010-11-08 12:06:13 +03:00
|
|
|
static const char* sDefaultMainWindowClass;
|
2010-12-07 05:06:31 +03:00
|
|
|
static bool sAllowD3D9;
|
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();
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t sOOPPPluginFocusEvent;
|
2009-06-29 23:36:16 +04:00
|
|
|
|
2010-06-25 06:01:07 +04:00
|
|
|
// Non-client margin settings
|
|
|
|
// Pre-calculated outward offset applied to default frames
|
|
|
|
nsIntMargin mNonClientOffset;
|
|
|
|
// Margins set by the owner
|
|
|
|
nsIntMargin mNonClientMargins;
|
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;
|
2010-06-25 06:01:07 +04: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
|
|
|
|
2012-06-29 12:32:21 +04:00
|
|
|
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
|
2010-04-16 21:37:16 +04: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
|
|
|
|
2010-02-26 09:36:07 +03:00
|
|
|
#ifdef CAIRO_HAS_D2D_SURFACE
|
|
|
|
nsRefPtr<gfxD2DSurface> mD2DWindowSurface; // Surface for this window.
|
|
|
|
#endif
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
// Transparency
|
|
|
|
#ifdef MOZ_XUL
|
|
|
|
// Use layered windows to support full 256 level alpha translucency
|
2010-06-22 05:10:36 +04:00
|
|
|
nsRefPtr<gfxASurface> mTransparentSurface;
|
2009-06-29 23:36:16 +04:00
|
|
|
HDC mMemoryDC;
|
|
|
|
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
|
|
|
|
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;
|
|
|
|
|
2011-01-14 16:38:57 +03:00
|
|
|
// sRedirectedKeyDown is WM_KEYDOWN message or WM_SYSKEYDOWN message which
|
|
|
|
// was reirected to SendInput() API by OnKeyDown().
|
|
|
|
static MSG sRedirectedKeyDown;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool sNeedsToInitMouseWheelSettings;
|
2011-05-17 04:23:23 +04:00
|
|
|
static void InitMouseWheelScrollData();
|
|
|
|
|
2011-01-14 16:38:57 +03:00
|
|
|
// If a window receives WM_KEYDOWN message or WM_SYSKEYDOWM message which is
|
|
|
|
// redirected message, OnKeyDowm() prevents to dispatch NS_KEY_DOWN event
|
|
|
|
// because it has been dispatched before the message was redirected.
|
|
|
|
// However, in some cases, ProcessKeyDownMessage() doesn't call OnKeyDown().
|
|
|
|
// Then, ProcessKeyDownMessage() needs to forget the redirected message and
|
|
|
|
// remove WM_CHAR message or WM_SYSCHAR message for the redirected keydown
|
|
|
|
// message. AutoForgetRedirectedKeyDownMessage struct is a helper struct
|
|
|
|
// for doing that. This must be created in stack.
|
|
|
|
struct AutoForgetRedirectedKeyDownMessage
|
|
|
|
{
|
|
|
|
AutoForgetRedirectedKeyDownMessage(nsWindow* aWindow, const MSG &aMsg) :
|
|
|
|
mCancel(!nsWindow::IsRedirectedKeyDownMessage(aMsg)),
|
|
|
|
mWindow(aWindow), mMsg(aMsg)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~AutoForgetRedirectedKeyDownMessage()
|
|
|
|
{
|
|
|
|
if (mCancel) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Prevent unnecessary keypress event
|
|
|
|
if (!mWindow->mOnDestroyCalled) {
|
|
|
|
nsWindow::RemoveNextCharMessage(mWindow->mWnd);
|
|
|
|
}
|
|
|
|
// Foreget the redirected message
|
|
|
|
nsWindow::ForgetRedirectedKeyDownMessage();
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCancel;
|
2011-01-18 06:07:29 +03:00
|
|
|
nsRefPtr<nsWindow> mWindow;
|
2011-01-14 16:38:57 +03:00
|
|
|
const MSG &mMsg;
|
|
|
|
};
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
/**
|
|
|
|
* A child window is a window with different style.
|
|
|
|
*/
|
1998-04-14 00:24:54 +04:00
|
|
|
class ChildWindow : public nsWindow {
|
|
|
|
|
|
|
|
public:
|
2004-09-03 12:44:23 +04:00
|
|
|
ChildWindow() {}
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
protected:
|
2004-09-03 12:44:23 +04:00
|
|
|
virtual DWORD WindowStyle();
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2009-07-08 20:13:13 +04:00
|
|
|
#endif // Window_h__
|