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

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

Issue 922843002: Fix software mirror mode on Ozone part 2/2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« ui/gfx/display.h ('K') | « ui/gfx/display.cc ('k') | no next file » | 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 a5cee6b20e4d588987f88ee60b3b596edf119995..ee40da3b7490be9eac27f92167238e1537958ffa 100644
--- a/ui/ozone/platform/dri/dri_window.cc
+++ b/ui/ozone/platform/dri/dri_window.cc
@@ -125,20 +125,27 @@ bool DriWindow::CanDispatchEvent(const PlatformEvent& ne) {
// DriWindow. We cannot check the event's location because if the
// touchscreen has a bezel, touches in the bezel have a location outside of
// |bounds_|.
- int64_t display_id =
+ gfx::Display display =
DeviceDataManager::GetInstance()->GetDisplayForTouchDevice(
event->source_device_id());
- if (display_id == gfx::Display::kInvalidDisplayID)
+ if (display.id() == gfx::Display::kInvalidDisplayID)
return false;
- DisplaySnapshot* snapshot = display_manager_->GetDisplay(display_id);
+ // If |display| is mirroring another display's content, touches should be
+ // dispatched to that display.
+ int64_t touch_display_id =
+ display.mirrored_display_id() == gfx::Display::kInvalidDisplayID
+ ? display.id()
+ : display.mirrored_display_id();
+
+ DisplaySnapshot* snapshot = display_manager_->GetDisplay(touch_display_id);
if (!snapshot || !snapshot->current_mode())
return false;
- gfx::Rect display_bounds(snapshot->origin(),
- snapshot->current_mode()->size());
- return display_bounds == bounds_;
+ gfx::Rect touch_display_bounds(snapshot->origin(),
+ snapshot->current_mode()->size());
+ return touch_display_bounds == bounds_;
} else if (event->IsLocatedEvent()) {
LocatedEvent* located_event = static_cast<LocatedEvent*>(event);
return bounds_.Contains(gfx::ToFlooredPoint(located_event->location()));
« ui/gfx/display.h ('K') | « ui/gfx/display.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698