[PATCH] Fix not sending XEMBED_REQUEST_FOCUS

Olivier Brunel jjk at jjacky.com
Mon Feb 24 20:45:58 CET 2014


(Sorry, wrong button, didn't send this to the list the first time.
Apologies.)

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.

Well, the spec does say about XEMBED_REQUEST_FOCUS:
"
Sent from the client to the embedder when the client wants focus. The
most common occasion is when the user clicks into one of the client's
child widgets, for example a line editor, in order to type something in.
"

Doesn't this apply here? It seems safe to assume that if the user clicks
on urxvt's window, it wants to focus it so it can type something in.

I understand that urxvt doesn't have a click-to-focus policy, but at the
same time aren't things a bit different when embedded?
As far as I can tell, from the embedder's side there's no way to tell
focus is wanted, since there's no awareness of the window, and that's
why this message exists.

(Also, are there use case when a click shouldn't focus? I only know of
(as far as mouse-driven focus change goes) click-to-focus, and focus
"following" the mouse pointer, but even in the later a click will focus
the window as well.)


> 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).
> 
> The only problem here is that click-to-focus probably can't be
> implemented, due to limitations in xembed itself.

Well, that would leave us with no way to focus an embedded urxvt via
click though, right?
As embedder as I don't have awareness of the urxvt's window, so I don't
see/process the mouse events. (That's I imagine the very reason the
XEMBED_REQUEST_FOCUS message exists.)

So if you were to decide not to enforce it, could it then at least by
available as an option?

Thanks,
-j





More information about the rxvt-unicode mailing list