[PATCH] Fix not sending XEMBED_REQUEST_FOCUS

Olivier Brunel jjk at jjacky.com
Tue Feb 25 21:26:13 CET 2014


On 02/24/14 20:15, Marc Lehmann wrote:
> On Sat, Feb 22, 2014 at 05:18:04PM +0100, Olivier Brunel <jjk at jjacky.com> wrote:
>> When using -embed and the window is clicked, if we didn't have the focus
>> we should send XEMBED_REQUEST_FOCUS to the embedder to get it (i.e. it
>> will respond by sending us a XEMBED_FOCUS_IN).
> 
> Hi!
> 
> I've read through the xembed spec again, but I don't think urxvt should
> send such a request. urxvt doesn't have a click-to-focus focus model, it
> would be the responsibility of the wm (or the embedder) to manage focus.
> 
> Click-to-focus would implement a policy that is not up to urxvt to decide.
> It's up to the embedder to decide which focus policy to implement.
> 
> Thinking about it a bit more, it seems that this is a serious flaw in
> xembed - basically, the only way to get good default behaviour is to have
> a window manager using click-to-focus (probably because the authors of the
> xembed spec use window managers or widget models using click-to-focus),
> leaving other focus models badly supported.
> 
> I will bring this up on the next maintainer meeting, but I suspect that
> urxvt will not enforce a click-to-focus model on embedders, and it's the
> responsibility of the embedder to emulate the window managers focus model
> (or the focus model of its choice).

Ok, I've been looking into this some more, and it could be that my patch
wasn't done properly, but it doesn't work if the running app does handle
the mouse events itself, e.g. vim can do that.

In such a case, even with the patch, no XEMBED_REQUEST_FOCUS is sent, so
clearly the patch isn't a solution, and probably not a good idea.

I'm now thinking that urxvt isn't at fault here, and I need to find a
way, as embedder, to handle this. As you said, the embedder has to
emulate the window manager's job here it seems. (Sadly, GTK seems to do
that well from the keyboard, but ignores the mouse completely.)

(For what it's worth, if anything, I also did a quick try with XTerm,
which also supports xembed, and it seems to behave the same, i.e. no
XEMBED_REQUEST_FOCUS is sent either when its window is clicked.)

Sorry for the noise,
-j

> 
> The only problem here is that click-to-focus probably can't be
> implemented, due to limitations in xembed itself.
> 





More information about the rxvt-unicode mailing list