Re: Application launch detection



Peter Astrand <astrand lysator liu se> writes:

> It's also possible to patch XLib directly (and maybe use LD_LIBRARY_PATH).
> Most people agree on that if XLib could set the PID and hostname as atoms
> on the windows, this would be a good thing. I've tested to patch Xlib
> directly, so that XMapWindow sends an signal upon XMapWindow() and it
> works great. The patch is about 10 lines. Apps could check if the Xlib
> extension is available, and if not, fall back on LD_PRELOAD etc. 
> 
> But: Are there *any* chance to get this extension into the official
> XFree86/OMG source? Is it desirable?

I think hacking this into XMapWindow is simply wrong:

 - Functions like MapWindow are wrappers around the X wire
   protocol. When I say, XMapWindow(), I mean "map the window on the
   server".  Xlib is not there to make interpretations of what I mean
   and send extra events around or set extra properties.

 - XMapWindow has no idea whether the window it is mapping is
   an immediate child of the root window, so I don't see how to
   implement the modified XMapWindow without major slowdowns
   or major changes to XLib.

 - Changing what XMapWindow to set properties as well may cause
   unexpected side effects such as PropertyNotify events that
   could potentially break legacy apps.

 - The first window being mapped may correspond very badly
   to the idea of the app starting up.

Now, if you wanted to change X[mb]SetWMProperties to handle setting
the PID, that might make sense. After all, it is very closely related
to what it is doing already. It might even be able to set the
LAUNCH_ID property, if that is what we decide to use, though I believe
that would interfere with toolkits doing more sophisticated things.
  
Basically, don't try to put policy into Xlib, and especially not into
functions that are defined as wrappers around the X protocol - that is
the domain of the toolkit. If you want to hack X code, extend Xt, but
XMapWindow should not be changed.

Regards,
                                        Owen








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]