[PATCH weston] compisitor-x11: Handle --fullscreen better.

Kristian Høgsberg hoegsberg at gmail.com
Thu Nov 8 08:20:14 PST 2012


On Sun, Nov 04, 2012 at 01:01:22PM -0700, Scott Moreau wrote:
> The --fullscreen option effectively does nothing if --width and --height aren't
> manually set to the size of the screen. This handles the size setting and limits
> the output count to one, for fullscreen.

There's a fullscreen protocol described in EWMH that we try to follow.
The problem is that we set the WM hints to "don't resize me" even in
fullscreen mode.  That makes the WM not allow fullscreen state for our
window, and it just ignores our attempt to request fullscreen.  The
way it's supposed to work is that the application requests fullscreen
from the WM either by setting the _NET_WM_STATE property to
_NET_WM_STATE_FULLSCREEN before mapping or by sending a client message
to the root window if the window is already mapped and wait for the WM
to set the _NET_WM_STATE property.  In either case, the WM resizes the
window to the right fullscreen size (ie the WM determines that).

So what we have now is broken is a few ways.  I'd suggest the
following changes to get things working:

  1) Only set the wm_normal_hints if we're not fullscreen.

  2) Just set _NET_WM_STATE before mapping, instead of mapping and
     then sending the client message.

  3) Limit output count to 1 as you do.

  3) When we follow the EWMH protocol, we have to use the size the WM
     gives us so we have to wait for the configure notify and then the
     map event before we know what size we have.  We're not really
     ready to handle dynamic resizes, so for now the best fix is to
     just not return from x11_compositor_create() until we've received
     configure and map events from all output windows.  So we have to
     add XCB_EVENT_MASK_STRUCTURE_NOTIFY to our event mask and handle
     configure notify and map notify in x11_compositor_handle_event()
     and just keep calling x11_compositor_handle_event() until we're
     ready to return.

Kristian

> ---
>  src/compositor-x11.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compositor-x11.c b/src/compositor-x11.c
> index c575f25..75de857 100644
> --- a/src/compositor-x11.c
> +++ b/src/compositor-x11.c
> @@ -1206,6 +1206,10 @@ x11_compositor_create(struct wl_display *display,
>  	count = option_count ? option_count : 1;
>  
>  	wl_list_for_each(o, &configured_output_list, link) {
> +		if (fullscreen) {
> +			o->width = c->screen->width_in_pixels;
> +			o->height = c->screen->height_in_pixels;
> +		}
>  		output = x11_compositor_create_output(c, x, 0,
>  						      option_width ? width :
>  						      o->width,
> @@ -1219,7 +1223,7 @@ x11_compositor_create(struct wl_display *display,
>  		x = pixman_region32_extents(&output->base.region)->x2;
>  
>  		output_count++;
> -		if (option_count && output_count >= option_count)
> +		if (fullscreen || (option_count && output_count >= option_count))
>  			break;
>  	}
>  
> -- 
> 1.7.11.7
> 
> _______________________________________________
> 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