awesomeWM / awesome

awesome window manager
https://awesomewm.org/
GNU General Public License v2.0
6.32k stars 596 forks source link

Splash window for Qt applications is assigned a dialog type #3322

Open steelman opened 3 years ago

steelman commented 3 years ago

awesome v4.3 (Too long) • Compiled against Lua 5.3.3 (running with Lua 5.3) • D-Bus support: ✔ • execinfo support: ✔ • xcb-randr version: 1.6 • LGI version: 0.9.2

How to reproduce the issue:

Run LibreCAD or FreeCAD or probably any other Qt application which shows a splash window using Qt::SplashScreen.

Actual result:

The splash window is displayed with a title bar.

Expected result:

The splash window is displayed with a title bar.

Additional observations

LibreOffice shows a splash window without a title bar.

FreeCAD and LibreCAD splash windows trigger property::type signal with type set to dialog.

xprop(1) output for FreeCAD splash window

_NET_WM_DESKTOP(CARDINAL) = 15
_NET_FRAME_EXTENTS(CARDINAL) = 2, 2, 22, 2
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
awful.client.property.single_instance_id(UTF8_STRING) = 
WM_TRANSIENT_FOR(WINDOW): window id # 0x5a0000e
_NET_WM_ICON_NAME(UTF8_STRING) = 
_NET_WM_ICON(CARDINAL) =        Icon (64 x 64):

<icon wuz here>

XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = 
_NET_WM_NAME(UTF8_STRING) = "FreeCAD"
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_SPLASH, _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x5a0000e
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                Initial state is Normal State.
_NET_WM_PID(CARDINAL) = 14328
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 94371863
WM_CLASS(STRING) = "freecad", "FreeCAD"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                user specified location: 483, 262
                user specified size: 399 by 244
                window gravity: NorthWest

I suspect that c->has_NET_WM_WINDOW_TYPE in property_update_wm_transient_for() is false (but why?) and client type is set to WINDOW_TYPE_DIALOG.

psychon commented 3 years ago

Random guess where the dialog comes from: https://github.com/awesomeWM/awesome/blob/fda950d186efdc43a64c4300a27a5e19a55c2bd7/property.c#L122-L123

Possible fix:

diff --git a/objects/client.c b/objects/client.c
index f3754a1ec..b4952faf2 100644
--- a/objects/client.c
+++ b/objects/client.c
@@ -1965,6 +1965,10 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, xcb_get_window_at
     c->size_hints_honor = true;
     luaA_object_emit_signal(L, -1, "property::size_hints_honor", 0);

+    /* Then check clients hints (must check _NET_WM_WINDOW_TYPE before
+     * WM_TRANSIENT_FOR in client_update_properties()) */
+    ewmh_client_check_hints(c);
+
     /* update all properties */
     client_update_properties(L, -1, c);

@@ -1976,9 +1980,6 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, xcb_get_window_at
     /* Put the window in normal state. */
     xwindow_set_state(c->window, XCB_ICCCM_WM_STATE_NORMAL);

-    /* Then check clients hints */
-    ewmh_client_check_hints(c);
-
     /* Push client in stack */
     stack_client_push(c);