swc

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

commit 3d6534495efbbfab0784384d523d70b62ab269f7
parent faad1a2a3d23143973e192a2f6ebebf5a1e37aea
Author: Michael Forney <mforney@mforney.org>
Date:   Fri, 22 Nov 2013 17:33:08 -0800

window: Use swc_rectangle for geometry

Diffstat:
Mlibswc/shell_surface.c | 9+++++----
Mlibswc/swc.h | 12++++++++++--
Mlibswc/window.c | 8++++----
Mlibswc/window.h | 4++--
4 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/libswc/shell_surface.c b/libswc/shell_surface.c @@ -153,14 +153,15 @@ static const struct wl_shell_surface_interface shell_surface_implementation = { .set_class = &set_class }; -static void configure(struct swc_window * window, int32_t x, int32_t y, - uint32_t width, uint32_t height) +static void configure(struct swc_window * window, + const struct swc_rectangle * geometry) { struct swc_shell_surface * shell_surface = CONTAINER_OF(window, typeof(*shell_surface), window); - wl_shell_surface_send_configure - (shell_surface->resource, WL_SHELL_SURFACE_RESIZE_NONE, width, height); + wl_shell_surface_send_configure(shell_surface->resource, + WL_SHELL_SURFACE_RESIZE_NONE, + geometry->width, geometry->height); } static const struct swc_window_impl shell_window_impl = { diff --git a/libswc/swc.h b/libswc/swc.h @@ -28,6 +28,14 @@ #include <stdint.h> #include <wayland-server.h> +/* Rectangles {{{ */ +struct swc_rectangle +{ + int32_t x, y; + uint32_t width, height; +}; +/* }}} */ + /* Windows {{{ */ enum { @@ -56,8 +64,8 @@ struct swc_window void swc_window_show(struct swc_window * window); void swc_window_hide(struct swc_window * window); void swc_window_focus(struct swc_window * window); -void swc_window_set_geometry(struct swc_window * window, int32_t x, int32_t y, - uint32_t width, uint32_t height); +void swc_window_set_geometry(struct swc_window * window, + const struct swc_rectangle * geometry); void swc_window_set_border(struct swc_window * window, uint32_t color, uint32_t width); /* }}} */ diff --git a/libswc/window.c b/libswc/window.c @@ -70,13 +70,13 @@ void swc_window_focus(struct swc_window * window) INTERNAL(window)->surface); } -void swc_window_set_geometry(struct swc_window * window, int32_t x, int32_t y, - uint32_t width, uint32_t height) +void swc_window_set_geometry(struct swc_window * window, + const struct swc_rectangle * geometry) { if (INTERNAL(window)->impl->configure) - INTERNAL(window)->impl->configure(window, x, y, width, height); + INTERNAL(window)->impl->configure(window, geometry); - swc_surface_move(INTERNAL(window)->surface, x, y); + swc_surface_move(INTERNAL(window)->surface, geometry->x, geometry->y); } void swc_window_set_border(struct swc_window * window, diff --git a/libswc/window.h b/libswc/window.h @@ -31,8 +31,8 @@ struct swc_window; struct swc_window_impl { - void (* configure)(struct swc_window * window, int32_t x, int32_t y, - uint32_t width, uint32_t height); + void (* configure)(struct swc_window * window, + const struct swc_rectangle * geometry); void (* focus)(struct swc_window * window); };