| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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> | 7 #include <X11/Xlib.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "ui/base/x/x11_util.h" | |
| 17 #include "ui/compositor/compositor.h" | 16 #include "ui/compositor/compositor.h" |
| 18 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
| 18 #include "ui/gfx/x/x11_types.h" |
| 19 | 19 |
| 20 namespace ui { | 20 namespace ui { |
| 21 | 21 |
| 22 class TestCompositorHostX11 : public TestCompositorHost, | 22 class TestCompositorHostX11 : public TestCompositorHost, |
| 23 public CompositorDelegate { | 23 public CompositorDelegate { |
| 24 public: | 24 public: |
| 25 TestCompositorHostX11(const gfx::Rect& bounds); | 25 TestCompositorHostX11(const gfx::Rect& bounds); |
| 26 virtual ~TestCompositorHostX11(); | 26 virtual ~TestCompositorHostX11(); |
| 27 | 27 |
| 28 private: | 28 private: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 48 | 48 |
| 49 TestCompositorHostX11::TestCompositorHostX11(const gfx::Rect& bounds) | 49 TestCompositorHostX11::TestCompositorHostX11(const gfx::Rect& bounds) |
| 50 : bounds_(bounds), | 50 : bounds_(bounds), |
| 51 method_factory_(this) { | 51 method_factory_(this) { |
| 52 } | 52 } |
| 53 | 53 |
| 54 TestCompositorHostX11::~TestCompositorHostX11() { | 54 TestCompositorHostX11::~TestCompositorHostX11() { |
| 55 } | 55 } |
| 56 | 56 |
| 57 void TestCompositorHostX11::Show() { | 57 void TestCompositorHostX11::Show() { |
| 58 Display* display = GetXDisplay(); | 58 XDisplay* display = gfx::GetXDisplay(); |
| 59 XSetWindowAttributes swa; | 59 XSetWindowAttributes swa; |
| 60 swa.event_mask = StructureNotifyMask | ExposureMask; | 60 swa.event_mask = StructureNotifyMask | ExposureMask; |
| 61 swa.override_redirect = True; | 61 swa.override_redirect = True; |
| 62 window_ = XCreateWindow( | 62 window_ = XCreateWindow( |
| 63 display, | 63 display, |
| 64 RootWindow(display, DefaultScreen(display)), // parent | 64 RootWindow(display, DefaultScreen(display)), // parent |
| 65 bounds_.x(), bounds_.y(), bounds_.width(), bounds_.height(), | 65 bounds_.x(), bounds_.y(), bounds_.width(), bounds_.height(), |
| 66 0, // border width | 66 0, // border width |
| 67 CopyFromParent, // depth | 67 CopyFromParent, // depth |
| 68 InputOutput, | 68 InputOutput, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 98 if (compositor_.get()) | 98 if (compositor_.get()) |
| 99 compositor_->Draw(); | 99 compositor_->Draw(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 // static | 102 // static |
| 103 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { | 103 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { |
| 104 return new TestCompositorHostX11(bounds); | 104 return new TestCompositorHostX11(bounds); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace ui | 107 } // namespace ui |
| OLD | NEW |