2012-07-20 10:10:44 +01:00
|
|
|
/* Copyright 2012 Mozilla Foundation and Mozilla contributors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
#ifndef nsWindow_h
|
|
|
|
#define nsWindow_h
|
|
|
|
|
2015-01-15 10:37:54 -05:00
|
|
|
#include "InputData.h"
|
2016-04-19 21:51:25 +01:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2011-11-10 16:17:46 -08:00
|
|
|
#include "nsBaseWidget.h"
|
2013-08-19 06:15:55 -04:00
|
|
|
#include "nsRegion.h"
|
2012-06-29 01:32:21 -07:00
|
|
|
#include "nsIIdleServiceInternal.h"
|
2014-10-16 13:57:10 -07:00
|
|
|
#include "Units.h"
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2014-10-16 13:57:10 -07:00
|
|
|
class ANativeWindowBuffer;
|
|
|
|
|
2011-12-15 15:38:45 -08:00
|
|
|
namespace widget {
|
|
|
|
struct InputContext;
|
|
|
|
struct InputContextAction;
|
|
|
|
}
|
|
|
|
|
2015-06-24 17:51:00 +02:00
|
|
|
namespace mozilla {
|
|
|
|
class HwcComposer2D;
|
|
|
|
}
|
|
|
|
|
2015-04-29 20:17:57 -07:00
|
|
|
class nsScreenGonk;
|
|
|
|
|
2015-02-17 22:27:53 -08:00
|
|
|
class nsWindow : public nsBaseWidget
|
2011-11-10 16:17:46 -08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsWindow();
|
|
|
|
|
2015-02-09 13:50:51 -05:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
static void DoDraw(void);
|
2015-04-15 17:45:18 +08:00
|
|
|
static nsEventStatus DispatchKeyInput(mozilla::WidgetKeyboardEvent& aEvent);
|
2015-01-15 10:37:54 -05:00
|
|
|
static void DispatchTouchInput(mozilla::MultiTouchInput& aInput);
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2016-01-13 07:32:55 +00:00
|
|
|
using nsBaseWidget::Create; // for Create signature not overridden here
|
2016-08-19 09:03:17 +10:00
|
|
|
virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
|
|
|
|
void* aNativeParent,
|
|
|
|
const LayoutDeviceIntRect& aRect,
|
|
|
|
nsWidgetInitData* aInitData) override;
|
2016-08-10 10:04:11 +10:00
|
|
|
virtual void Destroy();
|
2011-11-10 16:17:46 -08:00
|
|
|
|
|
|
|
NS_IMETHOD Show(bool aState);
|
2012-07-19 04:57:50 -04:00
|
|
|
virtual bool IsVisible() const;
|
2016-12-19 20:54:03 +11:00
|
|
|
virtual void Move(double aX,
|
|
|
|
double aY);
|
|
|
|
virtual void Resize(double aWidth,
|
|
|
|
double aHeight,
|
|
|
|
bool aRepaint);
|
|
|
|
virtual void Resize(double aX,
|
|
|
|
double aY,
|
|
|
|
double aWidth,
|
|
|
|
double aHeight,
|
|
|
|
bool aRepaint);
|
2016-12-19 20:54:16 +11:00
|
|
|
virtual void Enable(bool aState);
|
2012-07-23 01:19:08 -04:00
|
|
|
virtual bool IsEnabled() const;
|
2011-11-10 16:17:46 -08:00
|
|
|
NS_IMETHOD SetFocus(bool aRaise = false);
|
|
|
|
NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&);
|
2015-11-16 21:18:31 -08:00
|
|
|
NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect);
|
2012-08-22 11:56:38 -04:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType);
|
2015-04-17 09:28:41 -07:00
|
|
|
virtual void SetNativeData(uint32_t aDataType, uintptr_t aVal);
|
2011-11-10 16:17:46 -08:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-11-13 01:37:02 -08:00
|
|
|
virtual LayoutDeviceIntPoint WidgetToScreenOffset();
|
2015-01-15 10:37:54 -05:00
|
|
|
void DispatchTouchInputViaAPZ(mozilla::MultiTouchInput& aInput);
|
2015-02-10 08:24:23 -05:00
|
|
|
void DispatchTouchEventForAPZ(const mozilla::MultiTouchInput& aInput,
|
|
|
|
const ScrollableLayerGuid& aGuid,
|
2015-03-25 12:20:20 -04:00
|
|
|
const uint64_t aInputBlockId,
|
|
|
|
nsEventStatus aApzResponse);
|
2013-10-02 12:46:03 +09:00
|
|
|
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aStatus);
|
2015-01-20 00:38:00 +01:00
|
|
|
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
|
|
|
TouchPointerState aPointerState,
|
2016-04-15 06:39:36 -04:00
|
|
|
LayoutDeviceIntPoint aPoint,
|
2015-01-20 00:38:00 +01:00
|
|
|
double aPointerPressure,
|
2015-04-14 11:36:36 -04:00
|
|
|
uint32_t aPointerOrientation,
|
|
|
|
nsIObserver* aObserver) override;
|
2015-01-20 00:38:00 +01:00
|
|
|
|
2016-08-19 09:27:28 +10:00
|
|
|
virtual nsresult MakeFullScreen(
|
|
|
|
bool aFullScreen, nsIScreen* aTargetScreen = nullptr) override;
|
2012-08-14 23:13:48 -07:00
|
|
|
|
2015-06-17 10:00:52 -04:00
|
|
|
virtual already_AddRefed<mozilla::gfx::DrawTarget>
|
2015-03-21 12:28:04 -04:00
|
|
|
StartRemoteDrawing() override;
|
|
|
|
virtual void EndRemoteDrawing() override;
|
2014-10-16 13:57:10 -07:00
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
virtual float GetDPI();
|
2013-05-01 16:04:56 -04:00
|
|
|
virtual double GetDefaultScaleInternal();
|
2011-11-10 16:17:46 -08:00
|
|
|
virtual mozilla::layers::LayerManager*
|
2013-04-24 14:42:40 -04:00
|
|
|
GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
2014-01-23 13:26:41 -05:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
2016-06-23 17:53:27 -07:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT);
|
2015-07-24 11:28:28 -07:00
|
|
|
virtual void DestroyCompositor();
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2011-12-15 15:38:45 -08:00
|
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction);
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext();
|
|
|
|
|
2015-03-21 12:28:04 -04:00
|
|
|
virtual uint32_t GetGLFrameBufferFormat() override;
|
2012-01-25 18:05:34 -08:00
|
|
|
|
2015-11-13 01:37:02 -08:00
|
|
|
virtual LayoutDeviceIntRect GetNaturalBounds() override;
|
2012-08-13 19:41:09 -07:00
|
|
|
virtual bool NeedsPaint();
|
2012-07-24 12:01:09 -07:00
|
|
|
|
2015-03-21 12:28:04 -04:00
|
|
|
virtual Composer2D* GetComposer2D() override;
|
2012-11-19 09:58:38 -08:00
|
|
|
|
2015-03-26 14:23:02 -07:00
|
|
|
void ConfigureAPZControllerThread() override;
|
|
|
|
|
2015-06-05 11:29:30 +08:00
|
|
|
nsScreenGonk* GetScreen();
|
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
protected:
|
|
|
|
nsWindow* mParent;
|
|
|
|
bool mVisible;
|
2011-12-29 15:01:51 -08:00
|
|
|
InputContext mInputContext;
|
2012-06-29 01:32:21 -07:00
|
|
|
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
|
2011-11-10 16:17:46 -08:00
|
|
|
|
2015-03-10 13:44:02 +01:00
|
|
|
virtual ~nsWindow();
|
|
|
|
|
2011-11-10 16:17:46 -08:00
|
|
|
void BringToTop();
|
2012-01-11 02:07:00 +00:00
|
|
|
|
|
|
|
// Call this function when the users activity is the direct cause of an
|
|
|
|
// event (like a keypress or mouse click).
|
|
|
|
void UserActivity();
|
2015-01-20 00:38:00 +01:00
|
|
|
|
2016-05-17 22:33:21 -07:00
|
|
|
bool UseExternalCompositingSurface() const override {
|
|
|
|
return true;
|
|
|
|
}
|
2016-05-17 22:33:22 -07:00
|
|
|
CompositorBridgeParent* GetCompositorBridgeParent() const;
|
2016-05-17 22:33:21 -07:00
|
|
|
|
2015-01-20 00:38:00 +01:00
|
|
|
private:
|
|
|
|
// This is used by SynthesizeNativeTouchPoint to maintain state between
|
|
|
|
// multiple synthesized points
|
2016-04-19 21:51:25 +01:00
|
|
|
mozilla::UniquePtr<mozilla::MultiTouchInput> mSynthesizedTouchInput;
|
2015-04-29 20:17:57 -07:00
|
|
|
|
2015-10-18 01:24:48 -04:00
|
|
|
RefPtr<nsScreenGonk> mScreen;
|
2015-06-24 17:51:00 +02:00
|
|
|
|
2015-10-18 01:24:48 -04:00
|
|
|
RefPtr<mozilla::HwcComposer2D> mComposer2D;
|
2011-11-10 16:17:46 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsWindow_h */
|