Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Unified Diff: ui/ozone/platform/dri/dri_window.cc

Issue 873563002: [Ozone] Constrain the cursor when overscan insets are set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..83ea6d0b5796182b09b1a74a10571af751852a3f 100644
--- a/ui/ozone/platform/dri/dri_window.cc
+++ b/ui/ozone/platform/dri/dri_window.cc
@@ -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;
+ 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

Powered by Google App Engine
This is Rietveld 408576698