On Wed, 10 May 2000, Jeff Raven wrote:
Jeff... you never cease to put a smile on my face... ;)
you described the problem perfectly... but allow me to elaborate further
(and describe two problems with your patch)
first off... with sloppy focus... XSetInputFocus set the revert arg to
PointerRoot, which tells the X server that the window under the cursor has
input focus (which is usually root, but can be a window)
well... whenever the pointer enters a window... we set it to something
other than PointerRoot, hence the focus will stay until if we move the
pointer out of the window...
with ClickToFocus (you can verify this with your patch)... setting the
focus to PointerRoot can cause weird focusing behaviour
try this... open 2 xterms... focus one of them and then close it... now
move the cursor over the other xterm, don't click, but you can type into
it... not proper "click to type" behaviour... basically what probably needs
to happen is to check for when the focused window is closed (or withdrawn
due to workspace change) and then set the focus to some window not
interested in input (like root or the toolbar window)
it's a fairly complex solution to a simple problem :)
also... the transient returning focus to its parent is definately a good
idea, but i would recommend checking to make sure that the transient has
focus before assigning it back to the parent
> On Mon, May 08, 2000 at 10:44:52PM -0500, Jason Kasper wrote:
> > bbkeys only exhibits this behavior if you use click-to-focus mode for
> > blackbox. I have no idea why--I simply stop getting XEvents in bbkeys
> > if the focused window is closed with click-to-focus mode in blackbox....
> >
>
> Sheesh, I go on vacation for a few days and at long last some
> interesting problems surface with the alpha blackbox! Thank goodness
> no one's dealt with them yet -- I would've hated to miss out on
> the fun.
>
> Anyway, as much as I would like to encourage people not to use
> ClickToFocus, I can't resist a good bug-hunt, and I think I tracked
> down the problem. The attached patch should fix the problem, and
> also deal with the issue which I think the original code was trying
> to address -- namely, when a window dies under ClickToFocus, we'd
> like its parent to get the focus.
>
> Please test out the patch if you're feeling adventurous -- it hasn't
> caused any problems on my machine, but I haven't had a chance to put
> it through much since I only got back from vacation a few hours ago.
>
> A short description of the patch follows (there's also some comments
> in the patch itself, if you're curious) :
>
> The problem with the existing code is that the parent of the client
> window is blackbox's container window, which dies when the client
> window does. So passing the focus to its parent quickly results in no
> window having the focus, and thus no key events. The first change deals
> with this by making ClickToFocus act like SloppyFocus -- when the window
> with focus dies, the root window gets the focus.
>
> As for the possible original intent, the second modification causes
> the parent of a transient to receive the focus when a transient with
> focus dies. Currently it does this in the destructor of the transient
> window, which is probably less than ideal, but I haven't had time to
> look through the code and see where it could be done instead.
>
> Anyway, let me know if you try it and it works/has problems.
>
> Jeff Raven
> [EMAIL PROTECTED]
>
--- signature Wed Dec 29 17:52:53 1999
+++ .signature Wed Dec 29 17:53:19 1999
@@ -0,0 +1,3 @@
+Bradley T Hughes <[EMAIL PROTECTED]>
+-----------------------------------
+ http://blackbox.alug.org/