OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/compositor/test/test_compositor_host.h" | 5 #include "ui/compositor/test/test_compositor_host.h" |
6 | 6 |
| 7 #include <X11/Xlib.h> |
| 8 |
7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
8 #include "base/bind.h" | 10 #include "base/bind.h" |
9 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/message_loop.h" |
13 #include "ui/base/x/x11_util.h" | 16 #include "ui/base/x/x11_util.h" |
14 #include "ui/compositor/compositor.h" | 17 #include "ui/compositor/compositor.h" |
15 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
16 | 19 |
17 #include <X11/Xlib.h> | |
18 | |
19 namespace ui { | 20 namespace ui { |
20 | 21 |
21 class TestCompositorHostLinux : public TestCompositorHost, | 22 class TestCompositorHostLinux : public TestCompositorHost, |
22 public CompositorDelegate { | 23 public CompositorDelegate { |
23 public: | 24 public: |
24 TestCompositorHostLinux(const gfx::Rect& bounds); | 25 TestCompositorHostLinux(const gfx::Rect& bounds); |
25 virtual ~TestCompositorHostLinux(); | 26 virtual ~TestCompositorHostLinux(); |
26 | 27 |
27 private: | 28 private: |
28 // Overridden from TestCompositorHost: | 29 // Overridden from TestCompositorHost: |
(...skipping 18 matching lines...) Expand all Loading... |
47 | 48 |
48 TestCompositorHostLinux::TestCompositorHostLinux(const gfx::Rect& bounds) | 49 TestCompositorHostLinux::TestCompositorHostLinux(const gfx::Rect& bounds) |
49 : bounds_(bounds), | 50 : bounds_(bounds), |
50 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | 51 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
51 } | 52 } |
52 | 53 |
53 TestCompositorHostLinux::~TestCompositorHostLinux() { | 54 TestCompositorHostLinux::~TestCompositorHostLinux() { |
54 } | 55 } |
55 | 56 |
56 void TestCompositorHostLinux::Show() { | 57 void TestCompositorHostLinux::Show() { |
57 Display* display = base::MessagePumpForUI::GetDefaultXDisplay(); | 58 Display* display = GetXDisplay(); |
58 XSetWindowAttributes swa; | 59 XSetWindowAttributes swa; |
59 swa.event_mask = StructureNotifyMask | ExposureMask; | 60 swa.event_mask = StructureNotifyMask | ExposureMask; |
60 swa.override_redirect = True; | 61 swa.override_redirect = True; |
61 window_ = XCreateWindow( | 62 window_ = XCreateWindow( |
62 display, | 63 display, |
63 RootWindow(display, DefaultScreen(display)), // parent | 64 RootWindow(display, DefaultScreen(display)), // parent |
64 bounds_.x(), bounds_.y(), bounds_.width(), bounds_.height(), | 65 bounds_.x(), bounds_.y(), bounds_.width(), bounds_.height(), |
65 0, // border width | 66 0, // border width |
66 CopyFromParent, // depth | 67 CopyFromParent, // depth |
67 InputOutput, | 68 InputOutput, |
(...skipping 28 matching lines...) Expand all Loading... |
96 if (compositor_.get()) | 97 if (compositor_.get()) |
97 compositor_->Draw(false); | 98 compositor_->Draw(false); |
98 } | 99 } |
99 | 100 |
100 // static | 101 // static |
101 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { | 102 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { |
102 return new TestCompositorHostLinux(bounds); | 103 return new TestCompositorHostLinux(bounds); |
103 } | 104 } |
104 | 105 |
105 } // namespace ui | 106 } // namespace ui |
OLD | NEW |