diff options
author | Phil Jones <philj56@gmail.com> | 2022-06-27 10:09:17 +0100 |
---|---|---|
committer | Phil Jones <philj56@gmail.com> | 2022-06-27 10:09:17 +0100 |
commit | 3a2178ab907d05dd10c482d7b0c8ce5ca6f3bb7a (patch) | |
tree | 38423c523892403ca0fd2ded8e517dbc53a556ee /src/surface.c | |
parent | 0fe263031db78d78203b183c14d84b1172d29822 (diff) |
Add default output selection.
Tofi should now appear on whatever the compositor's default output is
(usually the focused one), unless --output has been given.
Diffstat (limited to 'src/surface.c')
-rw-r--r-- | src/surface.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/surface.c b/src/surface.c index e7b2ac1..e640c40 100644 --- a/src/surface.c +++ b/src/surface.c @@ -13,7 +13,11 @@ void surface_init( struct wl_shm *wl_shm) { const int height = surface->height; - const int stride = surface->stride; + const int width = surface->width; + + /* Assume 4 bytes per pixel for WL_SHM_FORMAT_ARGB8888 */ + const int stride = width * 4; + surface->stride = stride; /* Double-buffered pool, so allocate space for two windows */ surface->shm_pool_size = @@ -34,13 +38,13 @@ void surface_init( surface->shm_pool_size); for (int i = 0; i < 2; i++) { - int offset = surface->height * surface->stride * i; + int offset = height * stride * i; surface->buffers[i] = wl_shm_pool_create_buffer( surface->wl_shm_pool, offset, - surface->width, - surface->height, - surface->stride, + width, + height, + stride, WL_SHM_FORMAT_ARGB8888); } @@ -58,10 +62,7 @@ void surface_destroy(struct surface *surface) wl_buffer_destroy(surface->buffers[1]); } -void surface_draw( - struct surface *surface, - struct color *color, - struct image *texture) +void surface_draw(struct surface *surface) { wl_surface_attach(surface->wl_surface, surface->buffers[surface->index], 0, 0); wl_surface_damage_buffer(surface->wl_surface, 0, 0, INT32_MAX, INT32_MAX); |