Project

General

Profile

Bug #532

Top level windows not recognized in bspwm

Added by Brian Lin over 2 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Operating System:
Linux
Affected version:
Affected revision:

Description

On Arch Linux with the following relevant packages:

bspwm 0.9.1-2
keepassx2 2.0.2-2

Issues:

  • Global auto-type does not work, yielding the following errors in the console:
    X Error: BadWindow (invalid Window parameter) 3
    Major opcode: 20 (X_GetProperty)
    Resource id: 0x0
    X Error: BadWindow (invalid Window parameter) 3
    Major opcode: 20 (X_GetProperty)
    Resource id: 0x0
  • The 'Window Title' drop down list is empty

Cause:

I've tracked down the issue to the 'isTopLevelWindow' function (https://github.com/keepassx/keepassx/blob/master/src/autotype/xcb/AutoTypeXCB.cpp#L381-L403) and the fact that bspwm does not appear to set 'WM_STATE' in the windows it creates. Why not use XQueryTree (or the XCB equivalent) to check for top level windows by comparing the root window and the windows' parent?

Perhaps this is more of a bug in bspwm, although I believe it conforms to EWMH and ICCCM.

History

#1 Updated by Felix Geyer over 2 years ago

The position in the window tree seems unrelated to what a window manager would consider top level windows.

$ xwininfo -tree -root
  Root window id: 0x2a6 (the root window) (has no name)
  Parent window id: 0x0 (none)
     221 children:
[...]
     0x40c0fb (has no name): ()  2511x1415+50+26  +50+26
        1 child:
        0x2e00007 "AutoTypeXCB.cpp [master] - KeePassX - Qt Creator": ("qtcreator" "QtCreator")  2509x1376+1+38  +51+64
           1 child:
           0x2e00016 (has no name): ()  1x1+-1+-1  +50+63
[...]
     0x2e00112 "QtCreator": ("qtcreator" "QtCreator")  320x438+195+173  +195+173
        1 child:
        0x2e00115 (has no name): ()  1x1+-1+-1  +194+172

In this example we only want window 0x2e00007.

#2 Updated by Brian Lin over 2 years ago

Ah, you're right. How about grabbing _NET_CLIENT_LIST from the root window and checking if the window is in that list?

$ xprop -root|grep '^_NET_CLIENT_LIST('
_NET_CLIENT_LIST(WINDOW): window id # 0xe000a7, 0x160001e
$ xwininfo -tree -root | egrep '(0xe000a7|0x160001e)'
     0xe000a7 "emacs@mactruck": ("emacs" "Emacs")  976x1042+12+22  +12+22
     0x160001e "Bug #532: Top level windows not recognized in bspwm - KeePassX - Redmine - Mozilla Firefox": ("Navigator" "Firefox")  900x1042+1004+22  +1004+22

This could be added as an additional check to the pre-existing one for WM_STATE.

Also available in: Atom PDF