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..1973890585a935222db9c6ce3590607dafd70687 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,14 @@ void DriWindow::MoveCursorTo(const gfx::Point& location) { |
event_factory_->WarpCursorTo(widget_, location); |
} |
+void DriWindow::ConfineCursorToBounds(const gfx::Rect& bounds) { |
+ if (cursor_confined_bounds_ == bounds) |
+ return; |
+ |
+ cursor_confined_bounds_ = bounds; |
+ cursor_->ConfineCursorToBounds(widget_, bounds); |
+} |
+ |
bool DriWindow::CanDispatchEvent(const PlatformEvent& ne) { |
DCHECK(ne); |
Event* event = static_cast<Event*>(ne); |
@@ -156,6 +169,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 +178,6 @@ void DriWindow::OnChannelDestroyed() { |
void DriWindow::SendBoundsChange() { |
cursor_->PrepareForBoundsChange(widget_); |
sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_)); |
- cursor_->CommitBoundsChange(widget_, bounds_); |
} |
} // namespace ui |