summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/main.c b/main.c
index c76ebd2..c328052 100644
--- a/main.c
+++ b/main.c
@@ -31,34 +31,58 @@ main ()
while (1)
{
pixman_color_t color = { 0xffff, 0xabcd, 0x7777, 0xaaaa };
+ pixman_color_t bg = { 0x0, 0x0, 0x0, 0xffff };
pixman_point_fixed_t p1 = { 0, 0 };
- pixman_point_fixed_t p2 = { ws_window_get_width (window) << 16,
- ws_window_get_height (window) << 16 };
- pixman_gradient_stop_t stops[2] =
+ pixman_point_fixed_t p2 = { 0, 0 };
+ pixman_gradient_stop_t stops[3] =
{
{ pixman_int_to_fixed (0), { 0x2222, 0xeeee, 0xeeee, 0xeeee } },
+ { pixman_double_to_fixed (0.5), { 0xdddd, 0xdddd, 0x0000, 0xdddd } },
{ pixman_int_to_fixed (1), { 0xffff, 0x1111, 0x1111, 0x1111 } }
};
int fd = ws_get_fd (ws);
+ struct timeval tv;
+ pixman_image_t *image;
+ int w, h;
FD_ZERO (&set);
FD_SET (fd, &set);
- select (fd + 1, &set, NULL, NULL, NULL);
+ tv.tv_usec = 0;
+ tv.tv_sec = 5;
+
+ if (!ws_pending (ws))
+ select (fd + 1, &set, NULL, NULL, NULL);
ws_process (ws);
+#if 0
color.red = rand();
color.blue = rand();
+#endif
- image = pixman_image_create_linear_gradient (&p1, &p2, stops, 2);
- ws_window_copy_from_image (window, image, 0, 0, 0, 0,
- ws_window_get_width (window),
- ws_window_get_height (window));
+ w = ws_window_get_width (window);
+ h = ws_window_get_height (window);
+
+ image = pixman_image_create_solid_fill (&bg);
+ ws_window_copy_from_image (window, image, 0, 0, 0, 0, w, h);
+ pixman_image_unref (image);
+
+ p2.x = w << 16;
+ p2.y = h << 16;
+ image = pixman_image_create_linear_gradient (&p1, &p2, stops, 3);
+ ws_window_copy_from_image (window, image, 0, 0, 0, 0, w, h);
pixman_image_unref (image);
+
+ image = pixman_image_create_solid_fill (&color);
+ ws_window_copy_from_image (window, image, 0, 0, 0, 0, 20, h);
+ ws_window_copy_from_image (window, image, 0, 0, w - 20, 0, 20, h);
+ ws_window_copy_from_image (window, image, 0, 0, 0, 0, w, 20);
+ ws_window_copy_from_image (window, image, 0, 0, 0, h - 20, w, 20);
+ pixman_image_unref (image);
+
ws_window_finish (&window, 1);
}
- printf ("Hello world\n");
while (1)
;
return 0;