Line data Source code
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_X11CompositorWidget_h
7 : #define widget_gtk_X11CompositorWidget_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 1 : class CompositorWidgetDelegate
19 : {
20 : public:
21 : virtual void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) = 0;
22 : };
23 :
24 : class X11CompositorWidget
25 : : public CompositorWidget
26 : , public CompositorWidgetDelegate
27 : {
28 : public:
29 : X11CompositorWidget(const CompositorWidgetInitData& aInitData,
30 : const layers::CompositorOptions& aOptions,
31 : nsWindow* aWindow = nullptr);
32 : ~X11CompositorWidget();
33 :
34 : // CompositorWidget Overrides
35 :
36 : already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override;
37 : void EndRemoteDrawing() override;
38 :
39 : already_AddRefed<gfx::DrawTarget>
40 : StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
41 : layers::BufferMode* aBufferMode) override;
42 : void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
43 : LayoutDeviceIntRegion& aInvalidRegion) override;
44 : uintptr_t GetWidgetKey() override;
45 :
46 : void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) override;
47 : LayoutDeviceIntSize GetClientSize() override;
48 :
49 : nsIWidget* RealWidget() override;
50 0 : X11CompositorWidget* AsX11() override { return this; }
51 1 : CompositorWidgetDelegate* AsDelegate() override { return this; }
52 :
53 0 : Display* XDisplay() const { return mXDisplay; }
54 0 : Window XWindow() const { return mXWindow; }
55 :
56 : protected:
57 : nsWindow* mWidget;
58 :
59 : private:
60 : LayoutDeviceIntSize mClientSize;
61 :
62 : Display* mXDisplay;
63 : Window mXWindow;
64 : WindowSurfaceProvider mProvider;
65 : };
66 :
67 : } // namespace widget
68 : } // namespace mozilla
69 :
70 : #endif // widget_gtk_X11CompositorWidget_h
|