| 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 #include "ui/views/mouse_watcher.h" | 5 #include "ui/views/mouse_watcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/event_types.h" | 9 #include "base/event_types.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 switch (event.message) { | 52 switch (event.message) { |
| 53 case WM_MOUSEMOVE: | 53 case WM_MOUSEMOVE: |
| 54 HandleGlobalMouseMoveEvent(MouseWatcherHost::MOUSE_MOVE); | 54 HandleGlobalMouseMoveEvent(MouseWatcherHost::MOUSE_MOVE); |
| 55 break; | 55 break; |
| 56 case WM_MOUSELEAVE: | 56 case WM_MOUSELEAVE: |
| 57 case WM_NCMOUSELEAVE: | 57 case WM_NCMOUSELEAVE: |
| 58 HandleGlobalMouseMoveEvent(MouseWatcherHost::MOUSE_EXIT); | 58 HandleGlobalMouseMoveEvent(MouseWatcherHost::MOUSE_EXIT); |
| 59 break; | 59 break; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 #elif defined(USE_WAYLAND) | |
| 63 virtual MessageLoopForUI::Observer::EventStatus WillProcessEvent( | |
| 64 base::wayland::WaylandEvent* event) OVERRIDE { | |
| 65 switch (event->type) { | |
| 66 case base::wayland::WAYLAND_MOTION: | |
| 67 HandleGlobalMouseMoveEvent(MouseWatcherHost::MOUSE_MOVE); | |
| 68 break; | |
| 69 case base::wayland::WAYLAND_POINTER_FOCUS: | |
| 70 if (!event->pointer_focus.state) | |
| 71 HandleGlobalMouseMoveEvent(MouseWatcherHost::MOUSE_EXIT); | |
| 72 break; | |
| 73 default: | |
| 74 break; | |
| 75 } | |
| 76 return EVENT_CONTINUE; | |
| 77 } | |
| 78 #elif defined(USE_AURA) | 62 #elif defined(USE_AURA) |
| 79 virtual base::EventStatus WillProcessEvent( | 63 virtual base::EventStatus WillProcessEvent( |
| 80 const base::NativeEvent& event) OVERRIDE { | 64 const base::NativeEvent& event) OVERRIDE { |
| 81 return base::EVENT_CONTINUE; | 65 return base::EVENT_CONTINUE; |
| 82 } | 66 } |
| 83 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE { | 67 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE { |
| 84 switch (ui::EventTypeFromNative(event)) { | 68 switch (ui::EventTypeFromNative(event)) { |
| 85 case ui::ET_MOUSE_MOVED: | 69 case ui::ET_MOUSE_MOVED: |
| 86 case ui::ET_MOUSE_DRAGGED: | 70 case ui::ET_MOUSE_DRAGGED: |
| 87 // DRAGGED is a special case of MOVED. See events_win.cc/events_x.cc. | 71 // DRAGGED is a special case of MOVED. See events_win.cc/events_x.cc. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 void MouseWatcher::Stop() { | 144 void MouseWatcher::Stop() { |
| 161 observer_.reset(NULL); | 145 observer_.reset(NULL); |
| 162 } | 146 } |
| 163 | 147 |
| 164 void MouseWatcher::NotifyListener() { | 148 void MouseWatcher::NotifyListener() { |
| 165 observer_.reset(NULL); | 149 observer_.reset(NULL); |
| 166 listener_->MouseMovedOutOfHost(); | 150 listener_->MouseMovedOutOfHost(); |
| 167 } | 151 } |
| 168 | 152 |
| 169 } // namespace views | 153 } // namespace views |
| OLD | NEW |