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