swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit debb5202cdfd643a31133f23c1c4945ff3656e57
parent 9b58165ef971855b7915f32200c18a9c9f0f692e
Author: Michael Forney <mforney@mforney.org>
Date:   Tue,  3 Dec 2013 21:59:43 -0800

surface: Set size to 0 when NULL buffer is attached

Diffstat:
Mlibswc/surface.c | 23+++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/libswc/surface.c b/libswc/surface.c @@ -234,16 +234,23 @@ static void commit(struct wl_client * client, struct wl_resource * resource) state_set_buffer(&surface->state, surface->pending.state.buffer); /* Determine size of buffer. */ - if ((shm_buffer = wl_shm_buffer_get(surface->state.buffer))) + if (surface->state.buffer) { - set_size(surface, wl_shm_buffer_get_width(shm_buffer), - wl_shm_buffer_get_height(shm_buffer)); - } - else if ((drm_buffer = swc_drm_buffer_get(surface->state.buffer))) - { - set_size(surface, drm_buffer->drawable->width, - drm_buffer->drawable->height); + if ((shm_buffer = wl_shm_buffer_get(surface->state.buffer))) + { + set_size(surface, wl_shm_buffer_get_width(shm_buffer), + wl_shm_buffer_get_height(shm_buffer)); + } + else if ((drm_buffer = swc_drm_buffer_get(surface->state.buffer))) + { + set_size(surface, drm_buffer->drawable->width, + drm_buffer->drawable->height); + } + else + WARNING("Unknown buffer type attached\n"); } + else + set_size(surface, 0, 0); } /* Damage */