Add support for SPICE.
[virt-click.git] / click.h
1 /* virt-click
2  * Copyright (C) 2011 Red Hat Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18
19 #ifndef click_h_
20 #define click_h_
21
22 #include <glib-object.h>
23 #include <vncconnection.h>
24 #include <spice-client.h>
25
26 enum command_qual {
27   CMD_CLICK
28 };
29
30 typedef struct {
31   enum command_qual cmd;
32   union {
33     struct {
34       int x, y;                 /* x, y location */
35       int b;                    /* button number */
36     } click;
37   };
38 } command_t;
39
40 struct self_t;
41
42 typedef struct {
43   void (*shutdown) (struct self_t *self);
44   int (*click) (struct self_t *self, int x, int y, int b);
45 } callbacks_t;
46
47 typedef struct self_t {
48   GMainLoop *loop;
49   int ret;
50   gboolean connected;
51
52   /* Callbacks. */
53   callbacks_t *callbacks;
54
55   /* Command. */
56   command_t command;
57
58   /* Private data for VNC connections: */
59   VncConnection *conn;
60
61   /* Private data for SPICE connections. */
62   SpiceSession *session;
63   SpiceChannel *display_channel;
64   SpiceChannel *inputs_channel;
65 } self_t;
66
67 extern gboolean verbose;
68
69 /* commands.c */
70 extern int vc_parse_command (self_t *self, gchar **args, guint nr_args);
71 extern void vc_issue_command (self_t *self);
72
73 /* spice.c */
74 extern GOptionGroup *vc_spice_cmdline_get_option_group (void);
75 extern gboolean vc_spice_is_selected (void);
76 extern void vc_spice_setup (self_t *self);
77
78 /* vnc.c */
79 extern GOptionGroup *vc_vnc_cmdline_get_option_group (void);
80 extern gboolean vc_vnc_is_selected (void);
81 extern void vc_vnc_setup (self_t *self);
82
83 /* vnc-auth.c */
84 extern void vc_vnc_auth_credential (VncConnection *conn, GValueArray *credList, gpointer opaque);
85 extern void vc_vnc_auth_choose_type (VncConnection *conn, GValueArray *types, gpointer opaque G_GNUC_UNUSED);
86
87 #endif /* click_h_ */