| 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 #if defined(USE_X11) | |
| 6 #include <X11/Xlib.h> | |
| 7 #endif | |
| 8 | |
| 9 #include "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 10 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 11 #include "base/i18n/icu_util.h" | 7 #include "base/i18n/icu_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 14 #include "third_party/skia/include/core/SkXfermode.h" | 10 #include "third_party/skia/include/core/SkXfermode.h" |
| 15 #include "ui/aura/client/default_capture_client.h" | 11 #include "ui/aura/client/default_capture_client.h" |
| 16 #include "ui/aura/client/window_tree_client.h" | 12 #include "ui/aura/client/window_tree_client.h" |
| 17 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" |
| 18 #include "ui/aura/test/test_focus_client.h" | 14 #include "ui/aura/test/test_focus_client.h" |
| 19 #include "ui/aura/test/test_screen.h" | 15 #include "ui/aura/test/test_screen.h" |
| 20 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 21 #include "ui/aura/window_delegate.h" | 17 #include "ui/aura/window_delegate.h" |
| 22 #include "ui/aura/window_tree_host.h" | 18 #include "ui/aura/window_tree_host.h" |
| 23 #include "ui/base/hit_test.h" | 19 #include "ui/base/hit_test.h" |
| 24 #include "ui/compositor/test/in_process_context_factory.h" | 20 #include "ui/compositor/test/in_process_context_factory.h" |
| 25 #include "ui/events/event.h" | 21 #include "ui/events/event.h" |
| 26 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
| 27 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
| 28 #include "ui/gl/gl_surface.h" | 24 #include "ui/gl/gl_surface.h" |
| 29 | 25 |
| 30 #if defined(USE_X11) | 26 #if defined(USE_X11) |
| 31 #include "base/message_loop/message_pump_x11.h" | 27 #include "ui/gfx/x/x11_connection.h" |
| 32 #endif | 28 #endif |
| 33 | 29 |
| 34 namespace { | 30 namespace { |
| 35 | 31 |
| 36 // Trivial WindowDelegate implementation that draws a colored background. | 32 // Trivial WindowDelegate implementation that draws a colored background. |
| 37 class DemoWindowDelegate : public aura::WindowDelegate { | 33 class DemoWindowDelegate : public aura::WindowDelegate { |
| 38 public: | 34 public: |
| 39 explicit DemoWindowDelegate(SkColor color) : color_(color) {} | 35 explicit DemoWindowDelegate(SkColor color) : color_(color) {} |
| 40 | 36 |
| 41 // Overridden from WindowDelegate: | 37 // Overridden from WindowDelegate: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 100 |
| 105 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; | 101 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; |
| 106 | 102 |
| 107 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); | 103 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); |
| 108 }; | 104 }; |
| 109 | 105 |
| 110 int DemoMain() { | 106 int DemoMain() { |
| 111 #if defined(USE_X11) | 107 #if defined(USE_X11) |
| 112 // This demo uses InProcessContextFactory which uses X on a separate Gpu | 108 // This demo uses InProcessContextFactory which uses X on a separate Gpu |
| 113 // thread. | 109 // thread. |
| 114 XInitThreads(); | 110 gfx::InitializeThreadedX11(); |
| 115 #endif | 111 #endif |
| 116 | 112 |
| 117 gfx::GLSurface::InitializeOneOff(); | 113 gfx::GLSurface::InitializeOneOff(); |
| 118 | 114 |
| 119 // The ContextFactory must exist before any Compositors are created. | 115 // The ContextFactory must exist before any Compositors are created. |
| 120 scoped_ptr<ui::InProcessContextFactory> context_factory( | 116 scoped_ptr<ui::InProcessContextFactory> context_factory( |
| 121 new ui::InProcessContextFactory()); | 117 new ui::InProcessContextFactory()); |
| 122 ui::ContextFactory::SetInstance(context_factory.get()); | 118 ui::ContextFactory::SetInstance(context_factory.get()); |
| 123 | 119 |
| 124 // Create the message-loop here before creating the root window. | 120 // Create the message-loop here before creating the root window. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 int main(int argc, char** argv) { | 166 int main(int argc, char** argv) { |
| 171 CommandLine::Init(argc, argv); | 167 CommandLine::Init(argc, argv); |
| 172 | 168 |
| 173 // The exit manager is in charge of calling the dtors of singleton objects. | 169 // The exit manager is in charge of calling the dtors of singleton objects. |
| 174 base::AtExitManager exit_manager; | 170 base::AtExitManager exit_manager; |
| 175 | 171 |
| 176 base::i18n::InitializeICU(); | 172 base::i18n::InitializeICU(); |
| 177 | 173 |
| 178 return DemoMain(); | 174 return DemoMain(); |
| 179 } | 175 } |
| OLD | NEW |