Commit a92c33a4 authored by Cici Ruan's avatar Cici Ruan Committed by Commit Bot

[Multi-display ARC] Send local bounds instead of global bounds

When removing display or adding primary display, Chrome sent bounds
based on updated display metrics, while on Wayland side, the display
metrics is not updated immediately. So when converting the Chrome
coordinates to Wayland coordinates, it converts to wrong position.
Instead of sending global bounds, send the local bounds with display id
to avoid asychronization issue between Chrome and Wayland on bounds and
display metrics.

There is remaining issue when ARC window in external and removing the
external display. It will be fixed separately.

Android side: http://ag/7326868 http://ag/7325387 http://ag/7322138

BUG=b:130897153
TEST=Printed the log to see if correct local bounds sent.

Change-Id: Ifdb7644cdfcb1a96ba0ace399b8e0f32eb7a6be0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1593923Reviewed-by: default avatarMitsuru Oshima (OOO 8/5,6) <oshima@chromium.org>
Auto-Submit: Cici Ruan <cuicuiruan@google.com>
Commit-Queue: Cici Ruan <cuicuiruan@google.com>
Cr-Commit-Position: refs/heads/master@{#683902}
parent e81f1428
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/views/window/caption_button_types.h" #include "ui/views/window/caption_button_types.h"
#include "ui/wm/core/coordinate_conversion.h"
#include "ui/wm/core/window_animations.h" #include "ui/wm/core/window_animations.h"
#include "ui/wm/public/activation_change_observer.h" #include "ui/wm/public/activation_change_observer.h"
...@@ -976,10 +977,23 @@ void HandleRemoteSurfaceBoundsChangedCallback( ...@@ -976,10 +977,23 @@ void HandleRemoteSurfaceBoundsChangedCallback(
reason = ZCR_REMOTE_SURFACE_V1_BOUNDS_CHANGE_REASON_SNAP_TO_RIGHT; reason = ZCR_REMOTE_SURFACE_V1_BOUNDS_CHANGE_REASON_SNAP_TO_RIGHT;
} }
} }
zcr_remote_surface_v1_send_bounds_changed( if (wl_resource_get_version(resource) >= 22) {
resource, static_cast<uint32_t>(display_id >> 32), // Notify bounds change by local bounds.
static_cast<uint32_t>(display_id), bounds.x(), bounds.y(), bounds.width(), auto* widget = GetUserDataAs<ShellSurfaceBase>(resource)->GetWidget();
bounds.height(), reason); gfx::Rect bounds_in_display = gfx::Rect(bounds);
wm::ConvertRectFromScreen(widget->GetNativeWindow()->parent(),
&bounds_in_display);
zcr_remote_surface_v1_send_bounds_changed(
resource, static_cast<uint32_t>(display_id >> 32),
static_cast<uint32_t>(display_id), bounds_in_display.x(),
bounds_in_display.y(), bounds_in_display.width(),
bounds_in_display.height(), reason);
} else {
zcr_remote_surface_v1_send_bounds_changed(
resource, static_cast<uint32_t>(display_id >> 32),
static_cast<uint32_t>(display_id), bounds.x(), bounds.y(),
bounds.width(), bounds.height(), reason);
}
wl_client_flush(wl_resource_get_client(resource)); wl_client_flush(wl_resource_get_client(resource));
} }
......
...@@ -22,7 +22,7 @@ class Display; ...@@ -22,7 +22,7 @@ class Display;
namespace exo { namespace exo {
namespace wayland { namespace wayland {
constexpr uint32_t kZcrRemoteShellVersion = 21; constexpr uint32_t kZcrRemoteShellVersion = 22;
void bind_remote_shell(wl_client* client, void bind_remote_shell(wl_client* client,
void* data, void* data,
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
reset. reset.
</description> </description>
<interface name="zcr_remote_shell_v1" version="21"> <interface name="zcr_remote_shell_v1" version="22">
<description summary="remote_shell"> <description summary="remote_shell">
The global interface that allows clients to turn a wl_surface into a The global interface that allows clients to turn a wl_surface into a
"real window" which is remotely managed but can be stacked, activated "real window" which is remotely managed but can be stacked, activated
......
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