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

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

Issue 844343002: [Ozone-DRI] Add display observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update GYP 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_delegate_impl.cc
diff --git a/ui/ozone/platform/dri/dri_window_delegate_impl.cc b/ui/ozone/platform/dri/dri_window_delegate_impl.cc
index fd39e9154f98f6ae068d10538260ab1dc56d05e8..467578396379cd4e08d41e2220fea6dade27020f 100644
--- a/ui/ozone/platform/dri/dri_window_delegate_impl.cc
+++ b/ui/ozone/platform/dri/dri_window_delegate_impl.cc
@@ -61,6 +61,8 @@ DriWindowDelegateImpl::~DriWindowDelegateImpl() {
void DriWindowDelegateImpl::Initialize() {
TRACE_EVENT1("dri", "DriWindowDelegateImpl::Initialize", "widget", widget_);
+ screen_manager_->AddObserver(this);
+
uint64_t cursor_width = 64;
uint64_t cursor_height = 64;
drm_->GetCapability(DRM_CAP_CURSOR_WIDTH, &cursor_width);
@@ -78,6 +80,7 @@ void DriWindowDelegateImpl::Initialize() {
void DriWindowDelegateImpl::Shutdown() {
TRACE_EVENT1("dri", "DriWindowDelegateImpl::Shutdown", "widget", widget_);
+ screen_manager_->RemoveObserver(this);
}
gfx::AcceleratedWidget DriWindowDelegateImpl::GetAcceleratedWidget() {
@@ -85,12 +88,13 @@ gfx::AcceleratedWidget DriWindowDelegateImpl::GetAcceleratedWidget() {
}
HardwareDisplayController* DriWindowDelegateImpl::GetController() {
- return controller_.get();
+ return controller_;
}
void DriWindowDelegateImpl::OnBoundsChanged(const gfx::Rect& bounds) {
TRACE_EVENT2("dri", "DriWindowDelegateImpl::OnBoundsChanged", "widget",
widget_, "bounds", bounds.ToString());
+ bounds_ = bounds;
controller_ = screen_manager_->GetDisplayController(bounds);
}
@@ -128,6 +132,30 @@ void DriWindowDelegateImpl::MoveCursor(const gfx::Point& location) {
controller_->MoveCursor(location);
}
+void DriWindowDelegateImpl::OnDisplayChanged(
+ HardwareDisplayController* controller) {
+ DCHECK(controller);
+
+ gfx::Rect controller_bounds =
+ gfx::Rect(controller->origin(), controller->GetModeSize());
+ if (controller_) {
+ if (controller_ != controller)
+ return;
+
+ if (controller->IsDisabled() || bounds_ != controller_bounds)
+ controller_ = nullptr;
+ } else {
+ if (bounds_ == controller_bounds && !controller->IsDisabled())
+ controller_ = controller;
+ }
+}
+
+void DriWindowDelegateImpl::OnDisplayRemoved(
+ HardwareDisplayController* controller) {
+ if (controller_ == controller)
+ controller_ = nullptr;
+}
+
void DriWindowDelegateImpl::ResetCursor(bool bitmap_only) {
if (cursor_bitmaps_.size()) {
// Draw new cursor into backbuffer.

Powered by Google App Engine
This is Rietveld 408576698