[PATCH] xwayland: Fix input coordinates of shadowless CSD windows

Pekka Paalanen ppaalanen at gmail.com
Thu May 18 12:26:05 UTC 2017


On Tue,  2 May 2017 10:24:17 -0600
Scott Moreau <oreaus at gmail.com> wrote:

> This fixes wrong input coordinates when using clients like steam,
> that draw their own decorations and have no shadows.
> ---
>  xwayland/window-manager.c | 30 +++++++++++++++++-------------
>  1 file changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
> index 2608075..7cb60d1 100644
> --- a/xwayland/window-manager.c
> +++ b/xwayland/window-manager.c
> @@ -610,15 +610,17 @@ weston_wm_window_get_frame_size(struct weston_wm_window *window,
>  {
>  	struct theme *t = window->wm->theme;
>  
> -	if (window->fullscreen) {
> +	if (window->decorate) {
> +		if (window->frame) {
> +			*width = frame_width(window->frame);
> +			*height = frame_height(window->frame);
> +		} else {
> +			*width = window->width + t->margin * 2;
> +			*height = window->height + t->margin * 2;
> +		}
> +	} else {
>  		*width = window->width;
>  		*height = window->height;
> -	} else if (window->decorate && window->frame) {
> -		*width = frame_width(window->frame);
> -		*height = frame_height(window->frame);
> -	} else {
> -		*width = window->width + t->margin * 2;
> -		*height = window->height + t->margin * 2;
>  	}
>  }
>  
> @@ -628,14 +630,16 @@ weston_wm_window_get_child_position(struct weston_wm_window *window,
>  {
>  	struct theme *t = window->wm->theme;
>  
> -	if (window->fullscreen) {
> +	if (window->decorate) {
> +		if (window->frame)
> +			frame_interior(window->frame, x, y, NULL, NULL);
> +		else {
> +			*x = t->margin;
> +			*y = t->margin;
> +		}
> +	} else {
>  		*x = 0;
>  		*y = 0;
> -	} else if (window->decorate && window->frame) {
> -		frame_interior(window->frame, x, y, NULL, NULL);
> -	} else {
> -		*x = t->margin;
> -		*y = t->margin;
>  	}
>  }
>  

Hi Scott,

thanks for this, the handling of non-decorated, non-fullscreen, non-OR
windows has probably been broken for a good while if not forever.

I tested with google-chrome-browser as that's what I had at hand, both
with and without system decorations. Without system decorations, this
patch indeed fixes both the input region (the shadow area was not
click-through as it should have been) and removes shadows (that I
assume should not have been there).

Is the above exactly what you wanted to say in the commit message, or
did Steam really get wrong input coordinates, i.e. clicks were off also
inside the window?

Does this patch remove unwanted shadows from Steam or was Steam without
shadows to begin with?

The commit message is a little ambiguous on these terms, so I'd like
(someone) to re-word it.

When using system decorations in Chrome, the decorations look and work
just fine also after the patch.

Maximizing xterm works ok.

I'm a little worried about removing the checks for window->fullscreen,
because e.g. weston_wm_window_draw_decoration() looks at
window->fullscreen and does nothing. It would feel more logical for
draw_decoration to use the same conditions as get_frame_size and
get_child_position. What do you think? Which conditions should those be?

weston_wm_window_configure(), call arranged from send_configure(), is
unconditionally using get_frame_size and get_child_position as well.

Also weston_wm_window_set_pending_state() and send_configure() are
looking at both window->decorate and window->fullscreen. It all
seems to imply that if _NET_WM_STATE_FULLSCREEN is in effect, then
decorations should be avoided regardless of the _MOTIF_WM_HINTS
MWM_DECOR_* flags. Does that make sense?

Looking at weston_wm_window_draw_decoration(), it seems that shadows
for undecorated non-fullscreen surfaces were actually intentional. If
we remove that intention, the drawing of the shadow should also be
removed, and the commit message should explain why that was wrong.

In summary, I would suggest changing
	if (window->decorate)
into
	if (window->decorate && !window->fullscreen)

In fact, testing with e.g. geany, this patch regresses fullscreening: a
fullscreen X11 window is shifted down with a black bar on top and the
bottom going out of screen. The same can be seen with xterm.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170518/dced8fe8/attachment.sig>


More information about the wayland-devel mailing list