[PATCH weston 3/3] xwm: send input focus only for top-level windows

Kristian Høgsberg hoegsberg at gmail.com
Fri May 25 20:37:53 PDT 2012


On Fri, May 25, 2012 at 11:23:42PM -0400, Kristian Høgsberg wrote:
> On Fri, May 25, 2012 at 05:50:06PM +0300, Tiago Vignatti wrote:
> > Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
> 
> Committed with the few changes below.
> Kristian
> 
> > ---
> >  src/xwayland/window-manager.c |    9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
> > index 3cc0a50..62f5f07 100644
> > --- a/src/xwayland/window-manager.c
> > +++ b/src/xwayland/window-manager.c
> > @@ -306,6 +306,8 @@ weston_wm_window_read_properties(struct weston_wm_window *window)
> >  			break;
> >  		case XCB_ATOM_ATOM:
> >  			atom = xcb_get_property_value(reply);
> > +			if (*atom & wm->atom.net_wm_window_type)
> > +				window->type = *atom;
> 
> We don't need this...
> 
> >  			*(xcb_atom_t *) p = *atom;
> 
> because this will do exactly that.  When we're reading
> net_wm_window_type, p will point to window->type.
> 
> >  			break;
> >  		case TYPE_WM_PROTOCOLS:
> > @@ -438,6 +440,12 @@ weston_wm_window_activate(struct wl_listener *listener, void *data)
> >  	xcb_client_message_event_t client_message;
> >  
> >  	if (window) {
> > +		/* send the focus only for top-level windows. We might want to
> > +		 * improve the logic better here to satisfy this:
> > +		 * http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7 */
> > +		if (window->type != wm->atom.net_wm_window_type_normal)
> > +			return;
> > +

And this doesn't work.  It's not this simple, we have legacy
applications like xterm that doesn't set _NET_WM_WINDOW_TYPE and there
a dialog boxes and other types of windows that aren't
_NET_WM_WINDOW_TYPE_NORMAL, but still need keyboard focus.

Kristian

> >  		client_message.response_type = XCB_CLIENT_MESSAGE;
> >  		client_message.format = 32;
> >  		client_message.window = window->id;
> > @@ -714,6 +722,7 @@ weston_wm_handle_create_notify(struct weston_wm *wm, xcb_generic_event_t *event)
> >  	window->id = create_notify->window;
> >  	window->properties_dirty = 1;
> >  	window->decorate = 1;
> > +	window->type = 0;
> 
> Let's set this to XCB_ATOM_NONE instead.
> 
> >  	window->width = create_notify->width;
> >  	window->height = create_notify->height;
> > -- 
> > 1.7.9.5
> > 
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list