On 24-Jul-2002 aetius wrote: > I think I understand now. MapRequest events don't have a pid attached > (and I would have known that had I looked at the docs before, tsk, tsk), > and there doesn't seem to be a way to find out what pid caused the > event. Hmmm. >
remember, X is a network driven application. Even if you received a pid it might be on another machine. So at the absolute best you could get this to work for apps blackbox launches via the menu. Not ones run from the command line, new windows spawned by existing apps, etc. In X we know nothing about a window until the MapRequest. The MapRequest and subsequent setup occurs for all intents and purposes instantly. Rememeber Blackbox is not threaded so if we are handling an event we are not able to switch workspaces, draw a menu, etc. So you are not able to change workspaces while we are mapping a window. This is part of the reason why I spent so much time getting the placeWindow() code right (and in the end using the algorithm submitted) because it was slowing the map handling down and thus pausing the window manager. As I see it the best we can manage would look like this. exec a new process store command line in a table along with current_workspace and time <return to event loop> <sometime later> MapRequest is handled check if window's WM_COMMAND matches any entry in the table if it does, place window on the workspace associated in table then remove entry from table else compare WM_CLASS with WM_COMMAND (Rxvt matches rxvt, etc) and repeat above window then loads as usual prune table to only contain N items or only items of XX age Which sounds like a fair bit of work and as noted only works with the menu opened apps. Which means people get different behavior from different places doing the same thing. I am willing to support a solution for this problem if a good one is found. The one I just described is not it.
