raising windows on button release


There are some cases where you do not want to raise (or focus) a
window on click, even though you normally do. For example a click that
begins a drag-and-drop operation, or a click that selects (or perhaps
middle-click-pastes) some text should not activate the window.

In Windows XP you can see this behavior for example, if you start
dragging an icon in the file manager. I think Mac has the same.

Nautilus used to have a hack using a Sawfish-specific feature; IIRC
the hack went like this:
 - a window could have a special WM_PROTOCOL indicating it 
   would self-raise on click
 - Sawfish wouldn't ever activate the window in that case
 - the window would activate itself if it decided the click 
   wasn't on an icon being dragged

I've considered solving this by just moving the activate from button
press to button release in the window manager, and not activating if
the release is outside the window (i.e. if the release drops a drag
elsewhere). I'm not sure if this will break stuff though. It's also
not quite optimal behavior, as one would like to activate on click
immediately, if appropriate.

You also have the problem that if a window has the "self-activating"
WM_PROTOCOL set and the WM doesn't have activate-on-click enabled,
things are sort of broken.

Has anyone else thought about this issue?

