Chromium Code Reviews| 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()) { |
|
Ben Goodger (Google)
2014/05/02 22:58:02
nit: no braces
Aaron Boodman
2014/05/05 18:18:31
Done.
| |
| 58 ui::PlatformEventSource::CreateDefault(); | |
|
Ben Goodger (Google)
2014/05/02 22:58:02
don't you need to assign to event_source_ here?
Aaron Boodman
2014/05/05 18:18:31
whoopsie.
| |
| 59 } | |
| 58 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | 60 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
| 59 | 61 |
| 60 delegate_->OnAcceleratedWidgetAvailable(window_); | 62 delegate_->OnAcceleratedWidgetAvailable(window_); |
| 61 } | 63 } |
| 62 | 64 |
| 63 virtual void Show() OVERRIDE { | 65 virtual void Show() OVERRIDE { |
| 64 XDisplay* display = gfx::GetXDisplay(); | 66 XDisplay* display = gfx::GetXDisplay(); |
| 65 XMapWindow(display, window_); | 67 XMapWindow(display, window_); |
| 66 XFlush(display); | 68 XFlush(display); |
| 67 } | 69 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 118 |
| 117 // static | 119 // static |
| 118 scoped_ptr<NativeViewport> NativeViewport::Create( | 120 scoped_ptr<NativeViewport> NativeViewport::Create( |
| 119 shell::Context* context, | 121 shell::Context* context, |
| 120 NativeViewportDelegate* delegate) { | 122 NativeViewportDelegate* delegate) { |
| 121 return scoped_ptr<NativeViewport>(new NativeViewportX11(delegate)).Pass(); | 123 return scoped_ptr<NativeViewport>(new NativeViewportX11(delegate)).Pass(); |
| 122 } | 124 } |
| 123 | 125 |
| 124 } // namespace services | 126 } // namespace services |
| 125 } // namespace mojo | 127 } // namespace mojo |
| OLD | NEW |