]> git.proxmox.com Git - spiceterm.git/blob - test_display_base.h
code cleanup - compile with -Wall
[spiceterm.git] / test_display_base.h
1 #ifndef __TEST_DISPLAY_BASE_H__
2 #define __TEST_DISPLAY_BASE_H__
3
4 #include <glib.h>
5 #include <spice.h>
6
7 #include "basic_event_loop.h"
8
9
10 typedef struct TextAttributes {
11 unsigned int fgcol:4;
12 unsigned int bgcol:4;
13 unsigned int bold:1;
14 unsigned int uline:1;
15 unsigned int blink:1;
16 unsigned int invers:1;
17 unsigned int unvisible:1;
18 } TextAttributes;
19
20 #define COUNT(x) ((sizeof(x)/sizeof(x[0])))
21
22 typedef struct Test Test;
23
24 #define COMMANDS_SIZE 1024
25
26 #define MAX_HEIGHT 2048
27 #define MAX_WIDTH 2048
28
29 struct Test {
30 SpiceCoreInterface *core;
31 SpiceServer *server;
32
33 QXLInstance qxl_instance;
34 QXLWorker *qxl_worker;
35
36 SpiceKbdInstance keyboard_sin;
37
38 uint8_t primary_surface[MAX_HEIGHT * MAX_WIDTH * 4];
39 int primary_height;
40 int primary_width;
41
42 SpiceTimer *conn_timeout_timer;
43 SpiceWatch *mwatch; /* watch master pty */
44
45 int cursor_notify;
46
47 // Current mode (set by create_primary)
48 int width;
49 int height;
50
51 int target_surface;
52
53 GCond* command_cond;
54 GMutex* command_mutex;
55
56 int commands_end;
57 int commands_start;
58 struct QXLCommandExt* commands[COMMANDS_SIZE];
59
60 // callbacks
61 void (*on_client_connected)(Test *test);
62 void (*on_client_disconnected)(Test *test);
63 };
64
65 void test_add_display_interface(Test *test);
66 void test_add_agent_interface(SpiceServer *server); // TODO - Test *test
67 void test_add_keyboard_interface(Test *test);
68 Test* test_new(SpiceCoreInterface* core);
69
70 void test_draw_update_char(Test *test, int x, int y, gunichar ch, TextAttributes attrib);
71 void test_spice_scroll(Test *test, int x1, int y1, int x2, int y2, int src_x, int src_y);
72 void test_spice_clear(Test *test, int x1, int y1, int x2, int y2);
73
74
75 uint32_t test_get_width(void);
76 uint32_t test_get_height(void);
77
78 void spice_test_config_parse_args(int argc, char **argv);
79
80 #endif /* __TEST_DISPLAY_BASE_H__ */