summaryrefslogtreecommitdiffstats
path: root/ui/views/examples/examples_main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ui/views/examples/examples_main.cc')
-rw-r--r--ui/views/examples/examples_main.cc53
1 files changed, 53 insertions, 0 deletions
diff --git a/ui/views/examples/examples_main.cc b/ui/views/examples/examples_main.cc
index f27a3e8..cd48f6b 100644
--- a/ui/views/examples/examples_main.cc
+++ b/ui/views/examples/examples_main.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
#include "base/logging.h"
+#include "base/message_loop.h"
#include "base/process_util.h"
#include "base/stl_util.h"
#include "base/utf_string_conversions.h"
@@ -20,6 +21,37 @@
#include "ui/base/win/scoped_ole_initializer.h"
#endif
+#if defined(USE_AURA)
+#include "ui/aura/client/stacking_client.h"
+#include "ui/aura/env.h"
+#include "ui/aura/window.h"
+#include "ui/aura/root_window.h"
+#include "ui/gfx/compositor/compositor.h"
+#include "ui/gfx/compositor/test/compositor_test_support.h"
+#include "ui/views/widget/native_widget_aura.h"
+#endif
+
+#if defined(USE_AURA)
+class RootWindowStackingClient : public aura::client::StackingClient {
+ public:
+ explicit RootWindowStackingClient() {
+ aura::client::SetStackingClient(this);
+ }
+
+ virtual ~RootWindowStackingClient() {
+ aura::client::SetStackingClient(NULL);
+ }
+
+ // Overridden from aura::client::StackingClient:
+ virtual aura::Window* GetDefaultParent(aura::Window* window) OVERRIDE {
+ return window->GetRootWindow();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(RootWindowStackingClient);
+};
+#endif
+
int main(int argc, char** argv) {
#if defined(OS_WIN)
ui::ScopedOleInitializer ole_initializer;
@@ -43,13 +75,34 @@ int main(int argc, char** argv) {
ui::ResourceBundle::InitSharedInstanceWithLocale("en-US");
MessageLoop main_message_loop(MessageLoop::TYPE_UI);
+#if defined(USE_AURA)
+
+ // TURN ON THE HAX.
+ views::NativeWidgetAura::set_aura_desktop_hax();
+
+ ui::CompositorTestSupport::Initialize();
+
+ {
+ RootWindowStackingClient root_window_stacking_client;
+#endif
views::TestViewsDelegate delegate;
views::examples::ShowExamplesWindow(true);
+ // xxx: Hax here because this kills event handling.
+#if !defined(USE_AURA)
views::AcceleratorHandler accelerator_handler;
MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler);
+#else
+ MessageLoopForUI::current()->Run();
+#endif
+
+#if defined(USE_AURA)
+ }
+ aura::Env::DeleteInstance();
+ ui::CompositorTestSupport::Terminate();
+#endif
return 0;
}