log: Only use one string buffer

This also fixes a mismatch between date_string and sizeof string in
the strftime call.
shell: Free temporary strings

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
compositor-drm: select the highest possible mode frequency

the mode list is ordered so that the lower frequencies come
before the higher ones, so traverse the list from the end
to the beginning
input: check if the focus surface has a valid resource

the resource can be NULL in some cases, like when the focus is
taken by the black_surface used in shell.c as fullscreen background.
data-device: Change resources in wl_data_offer and wl_data_source to pointers.

Because of its links to selection.c and xwayland, a destroy_signal field
was also added to wl_data_source.  Before selection.c and xwayland were
manually initializing the resource.destroy_signal field so that it could be
used without a valid resource.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Add a weston_buffer structure to replace wl_buffer

This commit adds a weston_buffer structure to replace wl_buffer.  This way
we can hold onto buffers by just their resource.  In order to do this, the
every renderer.attach function has to fill in the weston_buffer.width and
weston_buffer.height fields.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
nested: Port away from old wl_resource API
compositor: Remove double free()s in resource destructors

With the change to move free()ing of the wl_resource into wayland-server, we now have
a few cases where we double free the resource in the destructor.  This patch
removes those.
compositor: Fix remaining double free()s

Previous commit didn't catch all double free()s, hopefully this one does.
data-device: Don't leak wl_data_source in destructor

We used to refcount the data source, but switched to using a destroy signal
instead.  When we switched we forgot to free the source insted of
unreffing it.
data-device: Remove redundant and confusing assignment

We were assigning drag from the resource user data, which was wrong
(resource data is the weston_seat) and confusing since drag is later
assigned newly malloc()ed memory.
src/.gitignore: add spring-tool to .gitignore
protocol: Add missing xml files to EXTRA_DIST

Reported by Sven Joachim <svenjoac@gmx.de>
gl-renderer: Use eglQueryWaylandBufferWL for getting width and height

This gets rid of the last remaining use of struct wl_buffer.
compositor: Fix a couple of left-over wl_resource direct access
compositor: Remove a few legacy uses of wl_object
gl-renderer: Track the buffer type in gl_surface_state

Checking for gs->num_images for determining the previous buffer type
when attaching is not reliable. The number of images is never cleared
in the SHM path, so after a switch from an EGL buffer to SHM, every
following attach of an SHM buffer will happen with gs->num_images > 0,
and the code will assume the previous buffer was an EGL one.

Fix this by adding a buffer_type field to gl_surface_state.
gl-renderer: Fix initial upload of SHM buffer as texture

The fix to not call glTexImage2D() on every attach does not properly
set the texture damage region appropriately when the surface has a
buffer transform with 90 or 270 degrees rotation, since it would simply
multiply the buffer dimensions by the buffer scale, but in this case
width and height are inverted.

A possible fix for this would be to add the properly transformed region
to the texture damage region. However, there is a conversion back to
buffer coordinates when doing the actual upload and the entire buffer
needs to be uploaded anyway. So we just set a flag signalling that and
handle that special case in gl_renderer_flush_damage().
gl-renderer: Split gl_renderer_attach() into smaller functions
nested: Fix direct access to resource->data