Chromium Code Reviews| Index: ui/ozone/platform/dri/dri_window.cc |
| diff --git a/ui/ozone/platform/dri/dri_window.cc b/ui/ozone/platform/dri/dri_window.cc |
| index 9796d137d9e7d749bd2e274de23f52feefefe7eb..e723333f570a0d6d26faaaaa210d796b2762ae2f 100644 |
| --- a/ui/ozone/platform/dri/dri_window.cc |
| +++ b/ui/ozone/platform/dri/dri_window.cc |
| @@ -50,7 +50,7 @@ DriWindow::~DriWindow() { |
| void DriWindow::Initialize() { |
| sender_->AddChannelObserver(this); |
| PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
| - cursor_->OnWindowAdded(widget_, bounds_); |
| + cursor_->OnWindowAdded(widget_, bounds_, GetCursorConfinedBounds()); |
| delegate_->OnAcceleratedWidgetAvailable(widget_); |
| } |
| @@ -58,6 +58,11 @@ gfx::AcceleratedWidget DriWindow::GetAcceleratedWidget() { |
| return widget_; |
| } |
| +gfx::Rect DriWindow::GetCursorConfinedBounds() const { |
| + return cursor_confined_bounds_.IsEmpty() ? gfx::Rect(bounds_.size()) |
| + : cursor_confined_bounds_; |
| +} |
| + |
| void DriWindow::Show() {} |
| void DriWindow::Hide() {} |
| @@ -98,6 +103,11 @@ void DriWindow::MoveCursorTo(const gfx::Point& location) { |
| event_factory_->WarpCursorTo(widget_, location); |
| } |
| +void DriWindow::ConfineCursorToBounds(const gfx::Rect& bounds) { |
| + cursor_confined_bounds_ = bounds; |
|
sadrul
2015/01/26 18:13:29
Check for equality?
|
| + cursor_->ConfineCursorToBounds(widget_, bounds); |
| +} |
| + |
| bool DriWindow::CanDispatchEvent(const PlatformEvent& ne) { |
| DCHECK(ne); |
| Event* event = static_cast<Event*>(ne); |
| @@ -156,6 +166,7 @@ uint32_t DriWindow::DispatchEvent(const PlatformEvent& native_event) { |
| void DriWindow::OnChannelEstablished() { |
| sender_->Send(new OzoneGpuMsg_CreateWindowDelegate(widget_)); |
| SendBoundsChange(); |
| + cursor_->ConfineCursorToBounds(widget_, GetCursorConfinedBounds()); |
| } |
| void DriWindow::OnChannelDestroyed() { |
| @@ -164,7 +175,6 @@ void DriWindow::OnChannelDestroyed() { |
| void DriWindow::SendBoundsChange() { |
| cursor_->PrepareForBoundsChange(widget_); |
| sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_)); |
| - cursor_->CommitBoundsChange(widget_, bounds_); |
| } |
| } // namespace ui |