screenshot: Print warning if we're not launched from weston

weston-screenshooter is a helper binary that weston launches to write the
screenshot to disk.  If somebody tries to launch it by hand, print a
warning and mention the screenshot keybinding.
compositor: Init fade surface color properly

When fading in, if a repaint was triggered after a call to
weston_compositor_fade() but before the first call to fade_frame(),
the fade surface wouldn't be drawn because its alpha channel wasn't
initialized properly.
configure.ac: Change bugs.freedesktop.org product to Wayland

Update the bug link. Thanks to Rune K. Svendsen for spotting this.

https://bugs.freedesktop.org/show_bug.cgi?id=60818
configure.ac: Add version to bug URL as well
window: improve EGL-related error messages

Make them explicitly mention EGL, otherwise one can easily think that
"failed to initialize display" refers to Wayland display.

Also explicitly mention falling back to wl_shm. I tested this with a
LD_PRELOAD trick that overrides eglBindAPI and makes it fail.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: check the initial wl_display_dispatch()

Check for errors in the first wl_display_dispatch() call. Otherwise
doing something silly like
  $ WAYLAND_SOCKET=999 ./clickdot
will segfault.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: destroy the 2nd shm buffer, if both released

Handle the case when we the compositor somehow migrates from requiring
double buffering into working on single buffering, so we release the
extra shm buffer.

Currently, I do not think this can happen in practice, but in the future
it may happen with sub-surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: create new struct surface with wl_surface

Struct window has many fields that are directly related to the
wl_surface, more than to the window as a whole. When we start composing
a window from several wl_surfaces, these fields need to be per
wl_surface, not per window.

Start separating such fields from struct window into struct surface by
moving the wl_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: move toysurface and allocation to struct surface

Fields 'allocation' and 'server_allocation' are surface specific. Fields
'saved_allocation', 'min_allocation', and 'pending_allocation' are
window specific, and will not be moved.

Field 'toysurface' is naturally surface specific, since it provides the
backing storage for the wl_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: move buffer type and transform into struct surface

These are surface specifics, since buffers are surface specific.

SURFACE_HINT_RESIZE is moved together to the other SURFACE_* flags, so
that surface_create_surface() would not need two flags arguments.
struct toysurface::prepare vfunc checks for SURFACE_HINT_RESIZE, and
egl_window_surface_create() and shm_surface_create() check for the
non-HINT flags.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: assimilate window_get_resize_dx_dy() into the call site

Not used elsewhere, just cleanup.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: move 'widget' member into struct surface

Repaint and resizing widget recursions must start from the root widget
of each (sub-)surface, so that buffers and regions get initialized
correctly. Make it easier by moving the widget field from struct window
to struct surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: move input and opaque regions into struct surface

They are per wl_surface state.

The frame widget is always on the main surface, since it can be created
only for the window. That is why frame_resize_handler() can simply
assume that the surface is the main_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: add surface pointer to widget

So that given a widget, we can access the surface specific data, like
buffers, and input and opaque regions.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: move cairo_surface into struct surface

Widgets should be rendering to a cairo_surface for a particular
wl_surface, just like buffers are per surface.

window_flush() has a change in behaviour: it will now send
wl_shell_surface.set_toplevel also without a cairo_surface to be
attached. This shouldn't change anything in practice.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: remove the transparent flag as unused

This flag was always true, and never false.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: let menu and tooltip redraw use widget size

Menu and tooltip redraw functions were using the surface size directly.
For consistency, make them use the widget size instead, it is the same.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
window: create Cairo surfaces on demand for redraw

This introduces the function widget_cairo_create().

Instead of directly referencing surface->cairo_surface, use the function
widget_cairo_create(), which will create the cairo_surface as necessary,
and just returns a Cairo drawing context. Also fix window_get_surface()
similarly.

Now we can go through idle_redraw() without always creating Cairo
surfaces and committing them. This will be useful with sub-surfaces,
where repainting one sub-surface does not need to force the repaint of
all surfaces of a window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
weston-launcher: Add missing newline in error message
shell: Bypass fullscreen scaling if surface width and height match output

If our surface has width and height set to the same dimensions as the output
then we can bypassing the scale factor calculation and addition of the
transformation.

The use case that led to this optimisation is the playback of video using
gstreamer-vaapi with the "scale" method. The video is the same dimensions as
the output (1080p.)