summaryrefslogtreecommitdiff
path: root/src/xen_linpicker.h
blob: ce56883a98ded26514b796d6c446c58511ec6d88 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef XEN_LINPICKER_H
#define XEN_LINPICKER_H 1

#include <xenctrl.h>
#include <xs.h>
#include <xen/io/xenbus.h>

#include "config.h"
#include "common.h"
#include "xen_backend.h"
#include "fd.h"
#include "buffer.h"
#include "display.h"
#include "input.h"

/* logging */
#define XEN_BE_LOG(xendev, lvl, msg...)		\
    do {					\
	if (lvl <= LOGLEVEL)			\
	    xen_be_printf(xendev, msg);		\
    } while (0)

/* domain creation watch */
int xen_linpicker_init(struct xs_handle *, xc_interface*);
int xen_linpicker_update(struct xs_handle *, xc_interface*, const char *);
int xen_linpicker_be_set_state(struct XenDevice *xendev, enum xenbus_state state);

/* xenfb stuff */
struct common {
    struct XenDevice  xendev;  /* must be first */
    void              *page;
    struct client     *client;
    struct buffer     *buffer;
    int               uses_gref;
};

struct XenInput {
    struct common c;
    int abs_pointer_wanted; /* Whether guest supports absolute pointer */
    int button_state;       /* Last seen pointer button state */
    int extended;
};

#define UP_QUEUE 8

struct XenFB {
    struct common     c;
    size_t            fb_len;
    int               row_stride;
    int               depth;
    int               width;
    int               height;
    int               offset;
    void              *pixels;
    int               fbpages;
    int               feature_update;
    int               refresh_period;
    int               bug_trigger;
    int               have_console;
    int               do_resize;

    struct {
	int x,y,w,h;
    } up_rects[UP_QUEUE];
    int               up_count;
    int               up_fullscreen;
};

int xen_linpicker_fb_connect(struct XenFB *fb);
int xen_linpicker_fb_resize(struct XenFB *fb);
void xen_linpicker_fb_update(struct XenFB *fb, int x, int y, int w, int h);
void xen_linpicker_fb_disconnect(struct XenFB *fb);

/* xen input stuff */
int xen_linpicker_input_connect(struct XenInput *xenfb);
void xen_linpicker_input_disconnect(struct XenInput *xenfb);
int xen_linpicker_input_send(struct XenInput *xenfb, const struct mouse_event *m);

int xenfb_send_key(struct XenInput *xenfb, bool down, int keycode);
int xenfb_send_motion(struct XenInput *xenfb, int rel_x, int rel_y, int rel_z);
int xenfb_send_position(struct XenInput *xenfb, int abs_x, int abs_y, int z);

#endif /* XEN_LINPICKER_H */