2015-11-12 13:31:47 +00:00
|
|
|
#include <stdio.h>
|
2015-11-13 00:04:01 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <wayland-client.h>
|
2015-11-13 15:27:16 +00:00
|
|
|
#include <time.h>
|
2015-11-13 00:04:01 +00:00
|
|
|
#include "client.h"
|
|
|
|
#include "log.h"
|
|
|
|
|
|
|
|
struct client_state *state;
|
|
|
|
|
|
|
|
void sway_terminate(void) {
|
|
|
|
client_teardown(state);
|
|
|
|
exit(1);
|
|
|
|
}
|
2015-11-12 13:31:47 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2015-11-13 00:04:01 +00:00
|
|
|
init_log(L_INFO);
|
|
|
|
state = client_setup();
|
|
|
|
|
2015-11-13 00:35:39 +00:00
|
|
|
uint8_t r = 0, g = 0, b = 0;
|
|
|
|
|
2015-11-13 15:27:16 +00:00
|
|
|
long last_ms = 0;
|
2015-11-13 00:35:39 +00:00
|
|
|
int rs;
|
2015-11-13 00:04:01 +00:00
|
|
|
do {
|
2015-11-13 15:27:16 +00:00
|
|
|
struct timespec spec;
|
|
|
|
clock_gettime(CLOCK_MONOTONIC, &spec);
|
|
|
|
long ms = round(spec.tv_nsec / 1.0e6);
|
|
|
|
|
2015-11-13 00:35:39 +00:00
|
|
|
cairo_set_source_rgb(state->cairo, r, g, b);
|
2015-11-13 00:04:01 +00:00
|
|
|
cairo_rectangle(state->cairo, 0, 0, 100, 100);
|
|
|
|
cairo_fill(state->cairo);
|
2015-11-13 00:35:39 +00:00
|
|
|
|
|
|
|
rs = client_render(state);
|
|
|
|
|
2015-11-13 15:27:16 +00:00
|
|
|
if (ms - last_ms > 100) {
|
|
|
|
r++;
|
|
|
|
if (r == 0) {
|
|
|
|
g++;
|
|
|
|
if (g == 0) {
|
|
|
|
b++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ms = last_ms;
|
2015-11-13 00:35:39 +00:00
|
|
|
}
|
|
|
|
} while (rs);
|
2015-11-13 00:04:01 +00:00
|
|
|
|
|
|
|
client_teardown(state);
|
2015-11-12 13:31:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|