Commit 05bdcf78 authored by Maksim Sisov's avatar Maksim Sisov Committed by Commit Bot

ozone/wayland: Fix setting correct app id.

The app id is an identifier that the compositor can use to group
multiple surfaces together.

Also, the app id is used to match with the application's .desktop file
that also sets an icon of the application, its name if set and other
useful information [1]

[1] https://github.com/wayland-project/wayland-protocols/blob/master/unstable/xdg-shell/xdg-shell-unstable-v6.xml#L559

Bug: 1021874
Change-Id: Ic6607a7f2272da4bf8ae3cea81706ac0e56ab6d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1901066Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#713320}
parent 5f774fc2
......@@ -174,6 +174,9 @@ bool WaylandWindow::Initialize(PlatformWindowInitProperties properties) {
break;
}
if (xdg_surface_ && !properties.wm_class_class.empty())
xdg_surface_->SetAppId(properties.wm_class_class);
connection_->ScheduleFlush();
PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
......
......@@ -59,6 +59,12 @@ class XDGSurfaceWrapper {
// Sets a desired window geometry once wayland requests client to do so.
virtual void SetWindowGeometry(const gfx::Rect& bounds) = 0;
// Sets an app id of the native window that is shown as an application name
// and hints the compositor that it can group application surfaces together by
// their app id. This also helps the compositor to identify application's
// .desktop file and use the icon set there.
virtual void SetAppId(const std::string& app_id) = 0;
};
bool CheckIfWlArrayHasValue(struct wl_array* wl_array, uint32_t value);
......
......@@ -80,6 +80,10 @@ void XDGSurfaceWrapperV5::SetWindowGeometry(const gfx::Rect& bounds) {
bounds.width(), bounds.height());
}
void XDGSurfaceWrapperV5::SetAppId(const std::string& app_id) {
xdg_surface_set_app_id(xdg_surface_.get(), app_id.c_str());
}
// static
void XDGSurfaceWrapperV5::Configure(void* data,
xdg_surface* obj,
......
......@@ -35,6 +35,7 @@ class XDGSurfaceWrapperV5 : public XDGSurfaceWrapper {
void SetTitle(const base::string16& title) override;
void AckConfigure() override;
void SetWindowGeometry(const gfx::Rect& bounds) override;
void SetAppId(const std::string& app_id) override;
// xdg_surface_listener
static void Configure(void* data,
......
......@@ -116,6 +116,10 @@ void XDGSurfaceWrapperV6::SetWindowGeometry(const gfx::Rect& bounds) {
bounds.height());
}
void XDGSurfaceWrapperV6::SetAppId(const std::string& app_id) {
zxdg_toplevel_v6_set_app_id(zxdg_toplevel_v6_.get(), app_id.c_str());
}
// static
void XDGSurfaceWrapperV6::Configure(void* data,
struct zxdg_surface_v6* zxdg_surface_v6,
......
......@@ -23,6 +23,7 @@ class XDGSurfaceWrapperV6 : public XDGSurfaceWrapper {
XDGSurfaceWrapperV6(WaylandWindow* wayland_window);
~XDGSurfaceWrapperV6() override;
// XDGSurfaceWrapper overrides:
bool Initialize(WaylandConnection* connection,
wl_surface* surface,
bool with_toplevel) override;
......@@ -36,6 +37,7 @@ class XDGSurfaceWrapperV6 : public XDGSurfaceWrapper {
void SetTitle(const base::string16& title) override;
void AckConfigure() override;
void SetWindowGeometry(const gfx::Rect& bounds) override;
void SetAppId(const std::string& app_id) override;
// xdg_surface_listener
static void Configure(void* data,
......
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