Bug 141106 - changing WM_CLASS is in conflict with ICCCM standard
Summary: changing WM_CLASS is in conflict with ICCCM standard
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
Depends on:
Reported: 2021-03-19 10:05 UTC by fasttwitch
Modified: 2021-03-19 15:30 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description fasttwitch 2021-03-19 10:05:29 UTC
libreoffice writer "Version: Build ID: 40(Build:2)"
when it opens its window has WM_CLASS property soffice.Soffice and
this is what the window manager sees when it requests to become mapped.
However, soon after it changes it to libreoffice.libreoffice-writer.
This is confusing the window manager which use the WM_CLASS
property to obtain configuration resources. It is also in conflict
with the ICCCM standard, which states in section

"This property must be present when the window leaves the
Withdrawn state and may be changed only while the window
is in the Withdrawn state. Window managers may examine
the property only when they start up and when the window
leaves the Withdrawn state, but there should be no need
for a client to change its state dynamically."

On top of that, the new values of the res_name and res_class
fields of the XClassHint appear to be swapped.

My complaint is therefore that libreoffice is in conflict
with the ICCCM, and therefore also with the EWMH standard.
It is also confusing with the way some standards conforming
window managers are designed to work.
My request to libreoffice is therefore to do respect the
standards and to only change its WM_CLASS property when
still in the Withdrawn state.

Steps to Reproduce:
1. start libreoffice writer

Actual Results:
changing WM_CLASS when already mapped, which isn't allowed, and is confusing.

Expected Results:
be social and easy to work with and therefore be standards conformant.

Reproducible: Always

User Profile Reset: Yes

Additional Info:
Set the proper value of WM_CLASS before mapping the window and never change it!
Comment 1 Jan-Marek Glogowski 2021-03-19 15:30:41 UTC
The original implementation for gtk / X11 was done in

commit 2aee1633048bcb732a5c1917580d305afa54e5ef
Author: Caolán McNamara <caolanm@redhat.com>
Date:   Wed Oct 27 23:05:06 2010 +0100

    fdo#632229# provide some support for a per-windowframe ApplicationID/WM_CLASS

(That fdo number is wrong.)

Later I implemented it for Qt5 / XCB with

commit 77a3c443d35c7d966217f02ea9189cb1819c7828
Author: Jan-Marek Glogowski <glogow@fbihome.de>
Date:   Fri Jun 14 00:46:32 2019 +0000

    tdf#125921 Qt5 set WM_CLASS for top level windows

We know it breaks the spec. And we updated the Wayland spec to allow changing of appid / class for visible windows to update the icon. LO is a single application and destroying windows when loading documents for different modules isn't really a viable alternative.