[go: up one dir, main page]

[exo] Fix activation implementation in zaura shell

The activation implementation did not check if the client was
owned by the remote shell.

(cherry picked from commit 834e3bbac3c498f5e4fe1cc1bf903676f6cfbca6)

Bug: 1258838
Change-Id: I82dab3f5b9cbe55820cdf9adb0e30d5780f4c400
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3221124
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#931258}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3279149
Auto-Submit: Kramer Ge <fangzhoug@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Commit-Queue: Kramer Ge <fangzhoug@chromium.org>
Cr-Commit-Position: refs/branch-heads/4664@{#994}
Cr-Branched-From: 24dc4ee75e01a29d390d43c9c264372a169273a7-refs/heads/main@{#929512}
diff --git a/components/exo/wayland/zaura_shell.cc b/components/exo/wayland/zaura_shell.cc
index 0f3a0c4..baa999b 100644
--- a/components/exo/wayland/zaura_shell.cc
+++ b/components/exo/wayland/zaura_shell.cc
@@ -816,6 +816,20 @@
 
     wl_client* client = wl_resource_get_client(aura_shell_resource_);
 
+    // If surface that gained active is not owned by the aura shell then
+    // set to null.
+    if (gained_active_surface_resource &&
+        wl_resource_get_client(gained_active_surface_resource) != client) {
+      gained_active_surface_resource = nullptr;
+    }
+
+    // If surface that lost active is not owned by the aura shell then set
+    // to null.
+    if (lost_active_surface_resource &&
+        wl_resource_get_client(lost_active_surface_resource) != client) {
+      lost_active_surface_resource = nullptr;
+    }
+
     zaura_shell_send_activated(aura_shell_resource_,
                                gained_active_surface_resource,
                                lost_active_surface_resource);