2012-07-20 13:10:44 +04: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-11 04:17:46 +04:00
|
|
|
|
|
|
|
#ifndef nsWindow_h
|
|
|
|
#define nsWindow_h
|
|
|
|
|
2015-01-15 18:37:54 +03:00
|
|
|
#include "InputData.h"
|
2016-04-19 23:51:25 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2011-11-11 04:17:46 +04:00
|
|
|
#include "nsBaseWidget.h"
|
2013-08-19 14:15:55 +04:00
|
|
|
#include "nsRegion.h"
|
2012-06-29 12:32:21 +04:00
|
|
|
#include "nsIIdleServiceInternal.h"
|
2014-10-17 00:57:10 +04:00
|
|
|
#include "Units.h"
|
2011-11-11 04:17:46 +04:00
|
|
|
|
2014-10-17 00:57:10 +04:00
|
|
|
class ANativeWindowBuffer;
|
|
|
|
|
2011-12-16 03:38:45 +04:00
|
|
|
namespace widget {
|
|
|
|
struct InputContext;
|
|
|
|
struct InputContextAction;
|
|
|
|
}
|
|
|
|
|
2015-06-24 18:51:00 +03:00
|
|
|
namespace mozilla {
|
|
|
|
class HwcComposer2D;
|
|
|
|
}
|
|
|
|
|
2015-04-30 06:17:57 +03:00
|
|
|
class nsScreenGonk;
|
|
|
|
|
2015-02-18 09:27:53 +03:00
|
|
|
class nsWindow : public nsBaseWidget
|
2011-11-11 04:17:46 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsWindow();
|
|
|
|
|
2015-02-09 21:50:51 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2011-11-11 04:17:46 +04:00
|
|
|
static void DoDraw(void);
|
2015-04-15 12:45:18 +03:00
|
|
|
static nsEventStatus DispatchKeyInput(mozilla::WidgetKeyboardEvent& aEvent);
|
2015-01-15 18:37:54 +03:00
|
|
|
static void DispatchTouchInput(mozilla::MultiTouchInput& aInput);
|
2011-11-11 04:17:46 +04:00
|
|
|
|
2016-01-13 10:32:55 +03:00
|
|
|
using nsBaseWidget::Create; // for Create signature not overridden here
|
2016-08-19 02:03:17 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
|
|
|
|
void* aNativeParent,
|
|
|
|
const LayoutDeviceIntRect& aRect,
|
|
|
|
nsWidgetInitData* aInitData) override;
|
2011-11-11 04:17:46 +04:00
|
|
|
NS_IMETHOD Destroy(void);
|
|
|
|
|
|
|
|
NS_IMETHOD Show(bool aState);
|
2012-07-19 12:57:50 +04:00
|
|
|
virtual bool IsVisible() const;
|
2011-11-11 04:17:46 +04:00
|
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t *aX,
|
|
|
|
int32_t *aY);
|
2012-12-12 13:57:38 +04:00
|
|
|
NS_IMETHOD Move(double aX,
|
|
|
|
double aY);
|
|
|
|
NS_IMETHOD Resize(double aWidth,
|
|
|
|
double aHeight,
|
2011-11-11 04:17:46 +04:00
|
|
|
bool aRepaint);
|
2012-12-12 13:57:38 +04:00
|
|
|
NS_IMETHOD Resize(double aX,
|
|
|
|
double aY,
|
|
|
|
double aWidth,
|
|
|
|
double aHeight,
|
2011-11-11 04:17:46 +04:00
|
|
|
bool aRepaint);
|
|
|
|
NS_IMETHOD Enable(bool aState);
|
2012-07-23 09:19:08 +04:00
|
|
|
virtual bool IsEnabled() const;
|
2011-11-11 04:17:46 +04:00
|
|
|
NS_IMETHOD SetFocus(bool aRaise = false);
|
|
|
|
NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&);
|
2015-11-17 08:18:31 +03:00
|
|
|
NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect);
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType);
|
2015-04-17 19:28:41 +03:00
|
|
|
virtual void SetNativeData(uint32_t aDataType, uintptr_t aVal);
|
2011-11-11 04:17:46 +04:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual LayoutDeviceIntPoint WidgetToScreenOffset();
|
2015-01-15 18:37:54 +03:00
|
|
|
void DispatchTouchInputViaAPZ(mozilla::MultiTouchInput& aInput);
|
2015-02-10 16:24:23 +03:00
|
|
|
void DispatchTouchEventForAPZ(const mozilla::MultiTouchInput& aInput,
|
|
|
|
const ScrollableLayerGuid& aGuid,
|
2015-03-25 19:20:20 +03:00
|
|
|
const uint64_t aInputBlockId,
|
|
|
|
nsEventStatus aApzResponse);
|
2013-10-02 07:46:03 +04:00
|
|
|
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aStatus);
|
2015-01-20 02:38:00 +03:00
|
|
|
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
|
|
|
TouchPointerState aPointerState,
|
2016-04-15 13:39:36 +03:00
|
|
|
LayoutDeviceIntPoint aPoint,
|
2015-01-20 02:38:00 +03:00
|
|
|
double aPointerPressure,
|
2015-04-14 18:36:36 +03:00
|
|
|
uint32_t aPointerOrientation,
|
|
|
|
nsIObserver* aObserver) override;
|
2015-01-20 02:38:00 +03:00
|
|
|
|
2011-11-11 04:17:46 +04:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
2012-10-26 17:15:22 +04:00
|
|
|
bool aDoCapture)
|
2011-11-11 04:17:46 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
|
|
|
|
2016-08-19 02:27:28 +03:00
|
|
|
virtual nsresult MakeFullScreen(
|
|
|
|
bool aFullScreen, nsIScreen* aTargetScreen = nullptr) override;
|
2012-08-15 10:13:48 +04:00
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<mozilla::gfx::DrawTarget>
|
2015-03-21 19:28:04 +03:00
|
|
|
StartRemoteDrawing() override;
|
|
|
|
virtual void EndRemoteDrawing() override;
|
2014-10-17 00:57:10 +04:00
|
|
|
|
2011-11-11 04:17:46 +04:00
|
|
|
virtual float GetDPI();
|
2013-05-02 00:04:56 +04:00
|
|
|
virtual double GetDefaultScaleInternal();
|
2011-11-11 04:17:46 +04:00
|
|
|
virtual mozilla::layers::LayerManager*
|
2013-04-24 22:42:40 +04:00
|
|
|
GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
2014-01-23 22:26:41 +04:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
2016-06-24 03:53:27 +03:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT);
|
2015-07-24 21:28:28 +03:00
|
|
|
virtual void DestroyCompositor();
|
2011-11-11 04:17:46 +04:00
|
|
|
|
2011-12-16 03:38:45 +04:00
|
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction);
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t GetGLFrameBufferFormat() override;
|
2012-01-26 06:05:34 +04:00
|
|
|
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual LayoutDeviceIntRect GetNaturalBounds() override;
|
2012-08-14 06:41:09 +04:00
|
|
|
virtual bool NeedsPaint();
|
2012-07-24 23:01:09 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual Composer2D* GetComposer2D() override;
|
2012-11-19 21:58:38 +04:00
|
|
|
|
2015-03-27 00:23:02 +03:00
|
|
|
void ConfigureAPZControllerThread() override;
|
|
|
|
|
2015-06-05 06:29:30 +03:00
|
|
|
nsScreenGonk* GetScreen();
|
|
|
|
|
2011-11-11 04:17:46 +04:00
|
|
|
protected:
|
|
|
|
nsWindow* mParent;
|
|
|
|
bool mVisible;
|
2011-12-30 03:01:51 +04:00
|
|
|
InputContext mInputContext;
|
2012-06-29 12:32:21 +04:00
|
|
|
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
|
2011-11-11 04:17:46 +04:00
|
|
|
|
2015-03-10 15:44:02 +03:00
|
|
|
virtual ~nsWindow();
|
|
|
|
|
2011-11-11 04:17:46 +04:00
|
|
|
void BringToTop();
|
2012-01-11 06:07:00 +04: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 02:38:00 +03:00
|
|
|
|
2016-05-18 08:33:21 +03:00
|
|
|
bool UseExternalCompositingSurface() const override {
|
|
|
|
return true;
|
|
|
|
}
|
2016-05-18 08:33:22 +03:00
|
|
|
CompositorBridgeParent* GetCompositorBridgeParent() const;
|
2016-05-18 08:33:21 +03:00
|
|
|
|
2015-01-20 02:38:00 +03:00
|
|
|
private:
|
|
|
|
// This is used by SynthesizeNativeTouchPoint to maintain state between
|
|
|
|
// multiple synthesized points
|
2016-04-19 23:51:25 +03:00
|
|
|
mozilla::UniquePtr<mozilla::MultiTouchInput> mSynthesizedTouchInput;
|
2015-04-30 06:17:57 +03:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsScreenGonk> mScreen;
|
2015-06-24 18:51:00 +03:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::HwcComposer2D> mComposer2D;
|
2011-11-11 04:17:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsWindow_h */
|