[PATCH weston] Make border width and ball radius configurable
Jason Ekstrand
jason at jlekstrand.net
Sat Nov 29 14:54:04 PST 2014
I don't see anything wrong with this patch, but I'm forced to ask the
question: What's the point? I mean, it's a little bouncing ball, why does
it need to be configurable?
On Sat, Nov 29, 2014 at 5:36 AM, Seedo Eldho Paul <seedoeldhopaul at gmail.com>
wrote:
> Also change "simple-shm exiting" to "simple-damage exiting"
>
> Signed-off-by: Seedo Eldho Paul <seedoeldhopaul at gmail.com>
> ---
> clients/simple-damage.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/clients/simple-damage.c b/clients/simple-damage.c
> index fe532fe..9f3d58f 100644
> --- a/clients/simple-damage.c
> +++ b/clients/simple-damage.c
> @@ -172,8 +172,6 @@ window_init_game(struct window *window)
> gettimeofday(&tv, NULL);
> srand(tv.tv_usec);
>
> - window->ball.radius = 10;
> -
> ax1 = window->border + window->ball.radius;
> ay1 = window->border + window->ball.radius;
> ax2 = window->width - window->border - window->ball.radius;
> @@ -233,8 +231,8 @@ window_advance_game(struct window *window, uint32_t
> timestamp)
>
> static struct window *
> create_window(struct display *display, int width, int height,
> - enum wl_output_transform transform, int scale,
> - enum window_flags flags)
> + int border, int radius, enum wl_output_transform transform,
> + int scale, enum window_flags flags)
> {
> struct window *window;
>
> @@ -268,7 +266,8 @@ create_window(struct display *display, int width, int
> height,
> window->display = display;
> window->width = width;
> window->height = height;
> - window->border = 10;
> + window->border = border;
> + window->ball.radius = radius;
> window->flags = flags;
> window->transform = transform;
> window->scale = scale;
> @@ -772,6 +771,8 @@ print_usage(int retval)
> " --version=VERSION\tVersion of wl_surface to use\n"
> " --width=WIDTH\t\tWidth of the window\n"
> " --height=HEIGHT\tHeight of the window\n"
> + " --border=BORDER\tBorder width of the window\n"
> + " --radius=RADIUS\tRadius of the ball\n"
> " --scale=SCALE\t\tScale factor for the surface\n"
> " --transform=TRANSFORM\tTransform for the surface\n"
> " --rotating-transform\tUse a different buffer_transform
> for each frame\n"
> @@ -818,6 +819,7 @@ main(int argc, char **argv)
> int i, ret = 0;
> int version = -1;
> int width = 300, height = 200, scale = 1;
> + int border = 10, radius = 10;
> enum wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
> enum window_flags flags = 0;
>
> @@ -839,6 +841,10 @@ main(int argc, char **argv)
> continue;
> } else if (sscanf(argv[i], "--height=%d", &height) > 0) {
> continue;
> + } else if (sscanf(argv[i], "--border=%d", &border) > 0) {
> + continue;
> + } else if (sscanf(argv[i], "--radius=%d", &radius) > 0) {
> + continue;
> } else if (strncmp(argv[i], "--transform=", 12) == 0 &&
> parse_transform(argv[i] + 12, &transform) > 0) {
> continue;
> @@ -858,7 +864,8 @@ main(int argc, char **argv)
>
> display = create_display(version);
>
> - window = create_window(display, width, height, transform, scale,
> flags);
> + window = create_window(display, width, height, border, radius,
> + transform, scale, flags);
> if (!window)
> return 1;
>
> @@ -872,7 +879,7 @@ main(int argc, char **argv)
> while (running && ret != -1)
> ret = wl_display_dispatch(display->display);
>
> - fprintf(stderr, "simple-shm exiting\n");
> + fprintf(stderr, "simple-damage exiting\n");
> destroy_window(window);
> destroy_display(display);
>
> --
> 1.9.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20141129/f4e82314/attachment.html>
More information about the wayland-devel
mailing list