toytoolkit: Don't draw shadows for maximized windows.

Add THEME_FRAME_MAXIMIZED flag so the theming system can know not to draw
shadows for maximized windows. This allows maximized surfaces' content to be
sized and placed in a more expectable fashion.
window: Add getters for fullscreen and maximized state

This lets us eliminate a bit of redundancy in the clienst where they track
fullscreen state themselves.
terminal: Use window_get_fullscreen() instead of tracking that state manually
terminal: Don't snap resize if we're maximized

We allow fullscreen to fill the requested size, do the same for maximize.
toytoolkit: Take into account transform when sending output allocation.
Update to new fd and wl_registry APIs

This commit updates the clients and the wayland compositor backend to
use the new wl_registry mechanism and the thread safe fd API.
compositor: make wl_surface.attach double-buffered

This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".

Clients are now required to issue wl_surface.commit for the
wl_surface.attach to take effect.

While changing this, change the surface argument to
weston_surface_attach() from wl_surface into weston_surface, for
consistency.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
clients: use wl_surface_commit

Use wl_surface_commit() to commit the buffer attach, as Weston now
requires.

NOTE: GL-applications are broken until you upgrade to a version of Mesa
which does wl_surface_commit() on eglSwapBuffers(). If you have
Cairo-gl, this means all toytoolkit apps, too.

simple-shm and simple-touch OTOH will work now.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor, clients: make damage double-buffered

This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".

Implement double-buffering of damage in the compositor as required by
the new protocol.

Ensure all Weston demo clients call wl_surface_commit() after
wl_surface_damage().

Mesa does not need a fix for this, as the patch adding
wl_surface_commit() call to Mesa already takes care of damage, too;
Mesa commit: "wayland: use wl_surface_commit()"

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
shell: do not double-init a region

weston_surface_create() already inits the opaque region, so the second
init in create_black_surface() is logically wrong. Whether this was a
memory leak or not, depends on Pixman internals.

Fini before initing again.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor, clients: double-buffer opaque region

Make wl_surface.set_opaque_region double-buffered as required by the new
protocol. Also, do not reset the opaque region on surface size changes
anymore. Only explicit requests from the client will change the region
now.

In clients, make sure commit happens after setting the opaque region.

Mesa does not need a fix, as it never touches the opaque region.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor, clients: double-buffer input region

Make input region double-buffered as specified in the new protocol.

While doing it, get rid of the undef region code, and instead use a
maximum sized real pixman region. This avoids special-casing regions
that might sometimes be undef.

As the input region is now usable by default instead of undef,
weston_surface_update_transform() does not need to reset the input
region anymore.

weston_surface_attach() no longer resets the input region on surface
size change. Therefore, also weston_seat_update_drag_surface() does not
need to reset it.

Update toytoolkit to set input region before calling wl_surface_commit()
or swapBuffers (which does commit).

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
shell: do not double-init input region

weston_surface_create() already inits the input region.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor: fix surface pointer cast

In weston, the wl_resource:data field for a wl_surface object always
contains struct weston_surface *, never struct wl_surface *.

Even though this is just a cosmetic fix, it should reduce confusion.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor, clients: apply wl_surface.frame on commit

Apply wl_surface.frame request only on the next wl_surface.commit
according to the new protocol.

This makes it explicit, which repaint actually triggered the frame
callback, since commit schedules a repaint. Otherwise, something causing
a repaint before a commit could trigger the frame callback too early.

Ensure all demo clients send commit after wl_surface.frame. Note, that
GL apps rely on eglSwapBuffers() sending commit. In toytoolkit, it is
assumed that window_flush() always does a commit.

compositor-wayland assumes renderer->repaint_output does a commit.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor: fix event-test

event-test assumes, that even without the very first wl_surface.attach
(and commit), the surface will have infinite (previously undef) input
region. event-test simply has test-client to create a wl_surface, and
then it forcefully sets its position and size, and assumes the input
region is now the full surface, so that notify_motion() will hit it.

Change Weston to initialize the input region to infinite, instead of
empty.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor: Unmap drag icon surface when its released

libwayland-server was changed to emit the new drag icon signal instead
of faking an attach event with a NULL buffer so this has to be done on
this side.
tests: Update tests to new APIs
clients: Use wl_display_dispatch_pending()
window: don't call output configure uninitialised

Callbacks registered via display_set_output_configure_handler() are
promised to be called when we know the current mode for the output. If
the following order of events happens:
1. toytoolkit binds to a wl_output global
2. application registers an output configure handler
3. the wl_output.mode events are received

Then in step 2 we would call the callback with uninitialised output
informations, giving it a 0x0 size.

To avoid such race, do not call the callback from
display_set_output_configure_handler() if the output has 0x0 size.

The wl_output.mode event will be received later, and that will trigger
the right call to the callback.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>