1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/**
* Recreate the primary surface endlessly.
*/
#include <math.h>
#include <config.h>
#include <stdlib.h>
#include "test_display_base.h"
SpiceServer *server;
SpiceCoreInterface *core;
SpiceTimer *ping_timer;
void show_channels(SpiceServer *server);
int ping_ms = 100;
void pinger(void *opaque)
{
// show_channels is not thread safe - fails if disconnections / connections occur
//show_channels(server);
core->timer_start(ping_timer, ping_ms);
}
void set_primary_params(void *cb_opaque, uint64_t *arg1, uint64_t *arg2)
{
#if 0
static int toggle = 0;
if (toggle) {
*arg1 = 800;
*arg2 = 600;
} else {
*arg1 = 1024;
*arg2 = 768;
}
toggle = 1 - toggle;
#endif
static int count = 0;
*arg1 = 800 + sin((float)count / 6) * 200;
*arg2 = 600 + cos((float)count / 6) * 200;
count++;
}
static Command commands[] = {
{DESTROY_PRIMARY, 0, 0, NULL, NULL},
{CREATE_PRIMARY, 0, 0, set_primary_params, NULL},
};
int main(void)
{
core = basic_event_loop_init();
server = test_init(core);
//spice_server_set_image_compression(server, SPICE_IMAGE_COMPRESS_OFF);
test_add_display_interface(server);
test_set_command_list(commands, COUNT(commands));
ping_timer = core->timer_add(pinger, NULL);
core->timer_start(ping_timer, ping_ms);
basic_event_loop_mainloop();
return 0;
}
|