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