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

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
« no previous file with comments | « ui/ozone/platform/dri/dri_window.h ('k') | ui/ozone/platform/egltest/ozone_platform_egltest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/ozone/platform/dri/dri_window.h ('k') | ui/ozone/platform/egltest/ozone_platform_egltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698