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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
%%
headers
#include <Python.h>
#include "pygobject.h"
#include "spice-common.h"
#include "spice-widget.h"
#include "spice-gtk-session.h"
#include "spice-audio.h"
#include "usb-device-widget.h"
%%
modulename spice_client_gtk
%%
import gobject.GObject as PyGObject_Type
import gtk.DrawingArea as PyGtkDrawingArea_Type
import gtk.Widget as PyGtkWidget_Type
import gtk.VBox as PyGtkVBox_Type
%%
ignore-glob
*_get_type
%%
%%
override spice_display_send_keys kwargs
static PyObject*
_wrap_spice_display_send_keys(PyGObject *self,
PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"keys", "kind", NULL};
PyObject *keyList;
int kind = SPICE_DISPLAY_KEY_EVENT_CLICK;
int i, len;
guint *keys;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"O|I:SpiceDisplay.send_keys", kwlist,
&keyList, &kind))
return NULL;
if (!PyList_Check(keyList))
return NULL;
len = PyList_Size(keyList);
keys = g_malloc0(sizeof(guint)*len);
for (i = 0 ; i < len ; i++) {
PyObject *val;
char *sym;
val = PyList_GetItem(keyList, i);
sym = PyString_AsString(val);
if (!sym) {
g_free(keys);
return NULL;
}
keys[i] = gdk_keyval_from_name(sym);
}
spice_display_send_keys(SPICE_DISPLAY(self->obj), keys, len, kind);
g_free(keys);
Py_INCREF(Py_None);
return Py_None;
}
%%
override spice_display_get_grab_keys kwargs
static PyObject*
_wrap_spice_display_get_grab_keys(PyGObject *self,
PyObject *args, PyObject *kwargs)
{
SpiceGrabSequence *seq;
PyObject *keyList;
int i;
seq = spice_display_get_grab_keys(SPICE_DISPLAY(self->obj));
keyList = PyList_New(0);
for (i = 0 ; i < seq->nkeysyms ; i++)
PyList_Append(keyList, PyInt_FromLong(seq->keysyms[i]));
return keyList;
}
%%
override spice_display_set_grab_keys kwargs
static PyObject*
_wrap_spice_display_set_grab_keys(PyGObject *self,
PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"keys", NULL};
PyObject *keyList;
int i;
guint nkeysyms;
guint *keysyms;
SpiceGrabSequence *seq;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"O|I:SpiceDisplay.set_grab_keys", kwlist,
&keyList))
return NULL;
if (!PyList_Check(keyList))
return NULL;
nkeysyms = PyList_Size(keyList);
keysyms = g_new0(guint, nkeysyms);
for (i = 0 ; i < nkeysyms ; i++) {
PyObject *val = PyList_GetItem(keyList, i);
keysyms[i] = (guint)PyInt_AsLong(val);
}
seq = spice_grab_sequence_new(nkeysyms, keysyms);
g_free(keysyms);
spice_display_set_grab_keys(SPICE_DISPLAY(self->obj), seq);
spice_grab_sequence_free(seq);
Py_INCREF(Py_None);
return Py_None;
}
%%
override spice_session_get_channels
static PyObject*
_wrap_spice_session_get_channels(PyGObject *self,
PyObject *args, PyObject *kwargs)
{
PyObject *py_list;
GList *list, *tmp;
PyObject *chann;
list = spice_session_get_channels(SPICE_SESSION(self->obj));
if ((py_list = PyList_New(0)) == NULL) {
return NULL;
}
for (tmp = list; tmp != NULL; tmp = tmp->next) {
chann = pygobject_new(G_OBJECT(tmp->data));
if (chann == NULL) {
Py_DECREF(py_list);
return NULL;
}
PyList_Append(py_list, chann);
Py_DECREF(chann);
}
return py_list;
}
%%
override spice_audio_new
static int
_wrap_spice_audio_new(PyGObject *self,
PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"session", "context", "name", NULL};
PyGObject *session = NULL;
PyObject *py_context = NULL;
char *name = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"O!|Os:SpiceAudio", kwlist,
&PySpiceSession_Type, &session,
&py_context, &name))
return -1;
self->obj = (GObject *)spice_audio_new(SPICE_SESSION(session->obj), NULL, NULL);
if (!self->obj) {
PyErr_SetString(PyExc_RuntimeError, "could not create SpiceAudio object");
return -1;
}
pygobject_register_wrapper((PyObject *)self);
return 0;
}
|