| 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 "mojo/services/native_viewport/native_viewport.h" | 5 #include "mojo/services/native_viewport/native_viewport.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "ui/events/platform/platform_event_dispatcher.h" | 10 #include "ui/events/platform/platform_event_dispatcher.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 CopyFromParent, // depth | 46 CopyFromParent, // depth |
| 47 InputOutput, | 47 InputOutput, |
| 48 CopyFromParent, // visual | 48 CopyFromParent, // visual |
| 49 CWBackPixmap | CWOverrideRedirect, | 49 CWBackPixmap | CWOverrideRedirect, |
| 50 &swa); | 50 &swa); |
| 51 | 51 |
| 52 atom_wm_protocols_ = XInternAtom(display, "WM_PROTOCOLS", 1); | 52 atom_wm_protocols_ = XInternAtom(display, "WM_PROTOCOLS", 1); |
| 53 atom_wm_delete_window_ = XInternAtom(display, "WM_DELETE_WINDOW", 1); | 53 atom_wm_delete_window_ = XInternAtom(display, "WM_DELETE_WINDOW", 1); |
| 54 XSetWMProtocols(display, window_, &atom_wm_delete_window_, 1); | 54 XSetWMProtocols(display, window_, &atom_wm_delete_window_, 1); |
| 55 | 55 |
| 56 // Assumes there is only one instance per process. | 56 event_source_.reset(ui::PlatformEventSource::GetInstance()); |
| 57 event_source_ = ui::PlatformEventSource::CreateDefault(); | 57 if (!event_source_.get()) |
| 58 event_source_ = ui::PlatformEventSource::CreateDefault(); |
| 58 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | 59 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
| 59 | 60 |
| 60 delegate_->OnAcceleratedWidgetAvailable(window_); | 61 delegate_->OnAcceleratedWidgetAvailable(window_); |
| 61 } | 62 } |
| 62 | 63 |
| 63 virtual void Show() OVERRIDE { | 64 virtual void Show() OVERRIDE { |
| 64 XDisplay* display = gfx::GetXDisplay(); | 65 XDisplay* display = gfx::GetXDisplay(); |
| 65 XMapWindow(display, window_); | 66 XMapWindow(display, window_); |
| 66 XFlush(display); | 67 XFlush(display); |
| 67 } | 68 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 117 |
| 117 // static | 118 // static |
| 118 scoped_ptr<NativeViewport> NativeViewport::Create( | 119 scoped_ptr<NativeViewport> NativeViewport::Create( |
| 119 shell::Context* context, | 120 shell::Context* context, |
| 120 NativeViewportDelegate* delegate) { | 121 NativeViewportDelegate* delegate) { |
| 121 return scoped_ptr<NativeViewport>(new NativeViewportX11(delegate)).Pass(); | 122 return scoped_ptr<NativeViewport>(new NativeViewportX11(delegate)).Pass(); |
| 122 } | 123 } |
| 123 | 124 |
| 124 } // namespace services | 125 } // namespace services |
| 125 } // namespace mojo | 126 } // namespace mojo |
| OLD | NEW |