Commit 88090164 authored by Nicholas Hollingum's avatar Nicholas Hollingum Committed by Commit Bot

exo: Use panel rotation for drawing/reporting

panel_rotation() is the difference between the buffer and hardware's
scanlines as opposed to rotation() which is the "logical" uprightness
of the screen. This matters on devices where the logical orientation
does not match the hardware orientation.

There are two cases where exo uses the wrong rotation which means:
 - cursor images are drawn in the wrong orientation
 - the screen orientation is reported incorrectly to clients. This is
   ~fine~ until you start using applications which refuse to handle
   events which are "offscreen".

We model this CL after changes in crrev.com/c/1911344.

Bug: 1081085
Change-Id: Ia3a01b8dd5d745dbdb6a5b2220cae44061088a77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2195341Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Nic Hollingum <hollingum@google.com>
Cr-Commit-Position: refs/heads/master@{#769038}
parent dbb65740
......@@ -678,7 +678,9 @@ void Pointer::UpdateCursor() {
if (cursor_client->GetCursorSize() == ui::CursorSize::kLarge)
scale *= kLargeCursorScale;
ui::ScaleAndRotateCursorBitmapAndHotpoint(scale, display.rotation(),
// Use panel_rotation() rather than "natural" rotation, as it actually
// relates to the hardware you're about to draw the cursor bitmap on.
ui::ScaleAndRotateCursorBitmapAndHotpoint(scale, display.panel_rotation(),
&bitmap, &hotspot);
ui::PlatformCursor platform_cursor;
......
......@@ -81,13 +81,15 @@ void WaylandDisplayObserver::SendDisplayMetrics() {
// has raw information before overscan, rotation applied.
gfx::Size size_in_pixel = display.GetSizeInPixel();
// Use panel_rotation otherwise some X apps will refuse to take events from
// outside the "visible" region.
wl_output_send_geometry(
output_resource_, origin.x(), origin.y(),
static_cast<int>(kInchInMm * size_in_pixel.width() / info.device_dpi()),
static_cast<int>(kInchInMm * size_in_pixel.height() / info.device_dpi()),
WL_OUTPUT_SUBPIXEL_UNKNOWN, make.empty() ? kUnknown : make.c_str(),
model.empty() ? kUnknown : model.c_str(),
OutputTransform(display.rotation()));
OutputTransform(display.panel_rotation()));
if (wl_resource_get_version(output_resource_) >=
WL_OUTPUT_SCALE_SINCE_VERSION) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment