| 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 #include <X11/Xutil.h> | 8 #include <X11/Xutil.h> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // TODO(aa): This is going to have to be thought through more carefully. | 113 // TODO(aa): This is going to have to be thought through more carefully. |
| 114 // Which events are appropriate to pass to clients? | 114 // Which events are appropriate to pass to clients? |
| 115 switch (event->type) { | 115 switch (event->type) { |
| 116 case KeyPress: | 116 case KeyPress: |
| 117 case KeyRelease: | 117 case KeyRelease: |
| 118 case ButtonPress: | 118 case ButtonPress: |
| 119 case ButtonRelease: | 119 case ButtonRelease: |
| 120 case MotionNotify: | 120 case MotionNotify: |
| 121 return true; | 121 return true; |
| 122 case ClientMessage: | 122 case ClientMessage: |
| 123 return event->xclient.message_type != atom_wm_protocols_; | 123 return event->xclient.message_type == atom_wm_protocols_; |
| 124 default: | 124 default: |
| 125 return false; | 125 return false; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE { | 129 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE { |
| 130 if (event->type == ClientMessage) { | 130 if (event->type == ClientMessage) { |
| 131 Atom protocol = static_cast<Atom>(event->xclient.data.l[0]); | 131 Atom protocol = static_cast<Atom>(event->xclient.data.l[0]); |
| 132 if (protocol == atom_wm_delete_window_) | 132 if (protocol == atom_wm_delete_window_) |
| 133 delegate_->OnDestroyed(); | 133 delegate_->OnDestroyed(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 154 | 154 |
| 155 // static | 155 // static |
| 156 scoped_ptr<NativeViewport> NativeViewport::Create( | 156 scoped_ptr<NativeViewport> NativeViewport::Create( |
| 157 shell::Context* context, | 157 shell::Context* context, |
| 158 NativeViewportDelegate* delegate) { | 158 NativeViewportDelegate* delegate) { |
| 159 return scoped_ptr<NativeViewport>(new NativeViewportX11(delegate)).Pass(); | 159 return scoped_ptr<NativeViewport>(new NativeViewportX11(delegate)).Pass(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace services | 162 } // namespace services |
| 163 } // namespace mojo | 163 } // namespace mojo |
| OLD | NEW |