/src/mozilla-central/widget/gtk/GtkCompositorWidget.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
3 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | | |
6 | | #ifndef widget_gtk_GtkCompositorWidget_h |
7 | | #define widget_gtk_GtkCompositorWidget_h |
8 | | |
9 | | #include "mozilla/widget/CompositorWidget.h" |
10 | | #include "WindowSurfaceProvider.h" |
11 | | |
12 | | class nsIWidget; |
13 | | class nsWindow; |
14 | | |
15 | | namespace mozilla { |
16 | | namespace widget { |
17 | | |
18 | | class PlatformCompositorWidgetDelegate |
19 | | : public CompositorWidgetDelegate |
20 | | { |
21 | | public: |
22 | | virtual void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) = 0; |
23 | | |
24 | | // CompositorWidgetDelegate Overrides |
25 | | |
26 | 0 | PlatformCompositorWidgetDelegate* AsPlatformSpecificDelegate() override { |
27 | 0 | return this; |
28 | 0 | } |
29 | | }; |
30 | | |
31 | | class GtkCompositorWidgetInitData; |
32 | | |
33 | | class GtkCompositorWidget |
34 | | : public CompositorWidget |
35 | | , public PlatformCompositorWidgetDelegate |
36 | | { |
37 | | public: |
38 | | GtkCompositorWidget(const GtkCompositorWidgetInitData& aInitData, |
39 | | const layers::CompositorOptions& aOptions, |
40 | | nsWindow* aWindow = nullptr); |
41 | | ~GtkCompositorWidget(); |
42 | | |
43 | | // CompositorWidget Overrides |
44 | | |
45 | | already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override; |
46 | | void EndRemoteDrawing() override; |
47 | | |
48 | | already_AddRefed<gfx::DrawTarget> |
49 | | StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion, |
50 | | layers::BufferMode* aBufferMode) override; |
51 | | void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget, |
52 | | LayoutDeviceIntRegion& aInvalidRegion) override; |
53 | | uintptr_t GetWidgetKey() override; |
54 | | |
55 | | LayoutDeviceIntSize GetClientSize() override; |
56 | | |
57 | | nsIWidget* RealWidget() override; |
58 | 0 | GtkCompositorWidget* AsX11() override { return this; } |
59 | 0 | CompositorWidgetDelegate* AsDelegate() override { return this; } |
60 | | |
61 | | Display* XDisplay() const { return mXDisplay; } |
62 | | Window XWindow() const { return mXWindow; } |
63 | | |
64 | | // PlatformCompositorWidgetDelegate Overrides |
65 | | |
66 | | void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) override; |
67 | | |
68 | | protected: |
69 | | nsWindow* mWidget; |
70 | | |
71 | | private: |
72 | | LayoutDeviceIntSize mClientSize; |
73 | | |
74 | | Display* mXDisplay; |
75 | | Window mXWindow; |
76 | | WindowSurfaceProvider mProvider; |
77 | | }; |
78 | | |
79 | | } // namespace widget |
80 | | } // namespace mozilla |
81 | | |
82 | | #endif // widget_gtk_GtkCompositorWidget_h |