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

Added a method to aura_surface for drawing attention to the window.

X11 applications have two common ways of bringing their windows to the
user's attention: sending NET_ACTIVE_WINDOW and setting the urgency
flag in NET_WM_HINTS. These tricks are used by applications to, e.g.
refocus their windows when the user opens a file in an already-running
app.

In crrev.com/c/1824398 we add support to sommelier to identify these
requests. We must now add a method to the aura protocol so that we can
communicate the request to chrome.  For the time being the request will
do nothing, as we are awaiting UX input on how to respond to the
request.

Bug: 899587
Change-Id: I0e8b6e639a389055b6e2adbaeb77d0881dd2c18d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1824726
Commit-Queue: Nic Hollingum <hollingum@google.com>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarFergus Dall <sidereal@google.com>
Cr-Commit-Position: refs/heads/master@{#704054}
parent e4c02318
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
</copyright> </copyright>
<interface name="zaura_shell" version="8"> <interface name="zaura_shell" version="9">
<description summary="aura_shell"> <description summary="aura_shell">
The global interface exposing aura shell capabilities is used to The global interface exposing aura shell capabilities is used to
instantiate an interface extension for a wl_surface object. instantiate an interface extension for a wl_surface object.
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
</request> </request>
</interface> </interface>
<interface name="zaura_surface" version="8"> <interface name="zaura_surface" version="9">
<description summary="aura shell interface to a wl_surface"> <description summary="aura shell interface to a wl_surface">
An additional interface to a wl_surface object, which allows the An additional interface to a wl_surface object, which allows the
client to access aura shell specific functionality for surface. client to access aura shell specific functionality for surface.
...@@ -172,6 +172,29 @@ ...@@ -172,6 +172,29 @@
<arg name="occlusion_fraction" type="fixed"/> <arg name="occlusion_fraction" type="fixed"/>
<arg name="occlusion_reason" type="uint"/> <arg name="occlusion_reason" type="uint"/>
</event> </event>
<!-- Version 9 additions -->
<request name="activate" since="9">
<description summary="Indicate that this window wants to be the active window">
Make this the active window. This usually implies something like
restacking this surface to the foreground. The compositor is free to
ignore this request if it deems the client to be misbehaving. Typically
this request will only be honoured in response to some user driven
event, such as executing an application or opening a file in a window
that already exists.
</description>
</request>
<request name="draw_attention" since="9">
<description summary="Indicate that this window wants some of the user's attention">
Draw attention to this surface in a way that does not change the user's
focus. This usually means animating window decorations or taskbar icons.
The compositor can still ignore this request if it deems fit, but unlike
draw_focus, these requests are expected to come from background tasks,
and are more likely to be honoured.
</description>
</request>
</interface> </interface>
<interface name="zaura_output" version="6"> <interface name="zaura_output" version="6">
......
...@@ -129,6 +129,14 @@ void aura_surface_unset_occlusion_tracking(wl_client* client, ...@@ -129,6 +129,14 @@ void aura_surface_unset_occlusion_tracking(wl_client* client,
GetUserDataAs<AuraSurface>(resource)->SetOcclusionTracking(false); GetUserDataAs<AuraSurface>(resource)->SetOcclusionTracking(false);
} }
void aura_surface_activate(wl_client* client, wl_resource* resource) {
GetUserDataAs<AuraSurface>(resource)->Activate();
}
void aura_surface_draw_attention(wl_client* client, wl_resource* resource) {
GetUserDataAs<AuraSurface>(resource)->DrawAttention();
}
const struct zaura_surface_interface aura_surface_implementation = { const struct zaura_surface_interface aura_surface_implementation = {
aura_surface_set_frame, aura_surface_set_frame,
aura_surface_set_parent, aura_surface_set_parent,
...@@ -137,7 +145,9 @@ const struct zaura_surface_interface aura_surface_implementation = { ...@@ -137,7 +145,9 @@ const struct zaura_surface_interface aura_surface_implementation = {
aura_surface_set_application_id, aura_surface_set_application_id,
aura_surface_set_client_surface_id, aura_surface_set_client_surface_id,
aura_surface_set_occlusion_tracking, aura_surface_set_occlusion_tracking,
aura_surface_unset_occlusion_tracking}; aura_surface_unset_occlusion_tracking,
aura_surface_activate,
aura_surface_draw_attention};
} // namespace } // namespace
...@@ -195,6 +205,20 @@ void AuraSurface::SetOcclusionTracking(bool tracking) { ...@@ -195,6 +205,20 @@ void AuraSurface::SetOcclusionTracking(bool tracking) {
surface_->SetOcclusionTracking(tracking); surface_->SetOcclusionTracking(tracking);
} }
void AuraSurface::Activate() {
if (!surface_)
return;
// TODO(hollingum): implement me.
LOG(WARNING) << "Surface requested focus, but that is not implemented";
}
void AuraSurface::DrawAttention() {
if (!surface_)
return;
// TODO(hollingum): implement me.
LOG(WARNING) << "Surface requested attention, but that is not implemented";
}
// Overridden from SurfaceObserver: // Overridden from SurfaceObserver:
void AuraSurface::OnSurfaceDestroying(Surface* surface) { void AuraSurface::OnSurfaceDestroying(Surface* surface) {
surface->RemoveSurfaceObserver(this); surface->RemoveSurfaceObserver(this);
......
...@@ -17,7 +17,7 @@ struct wl_resource; ...@@ -17,7 +17,7 @@ struct wl_resource;
namespace exo { namespace exo {
namespace wayland { namespace wayland {
constexpr uint32_t kZAuraShellVersion = 8; constexpr uint32_t kZAuraShellVersion = 9;
// Adds bindings to the Aura Shell. Normally this implies Ash on ChromeOS // Adds bindings to the Aura Shell. Normally this implies Ash on ChromeOS
// builds. On non-ChromeOS builds the protocol provides access to Aura windowing // builds. On non-ChromeOS builds the protocol provides access to Aura windowing
...@@ -40,6 +40,8 @@ class AuraSurface : public SurfaceObserver, ...@@ -40,6 +40,8 @@ class AuraSurface : public SurfaceObserver,
void SetApplicationId(const char* application_id); void SetApplicationId(const char* application_id);
void SetClientSurfaceId(int client_surface_id); void SetClientSurfaceId(int client_surface_id);
void SetOcclusionTracking(bool tracking); void SetOcclusionTracking(bool tracking);
void Activate();
void DrawAttention();
// Overridden from SurfaceObserver: // Overridden from SurfaceObserver:
void OnSurfaceDestroying(Surface* surface) override; void OnSurfaceDestroying(Surface* surface) override;
......
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