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 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
|
/*
* Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS)
*
* Licensed under the LGPL, see LICENSE file for more information.
*
* $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/xs/GdkInput.xs,v 1.2 2004/05/15 19:03:30 kaffeetisch Exp $
*/
#include "gtk2perl.h"
MODULE = Gtk2::Gdk::Device PACKAGE = Gtk2::Gdk PREFIX = gdk_
#ifndef GDK_MULTIHEAD_SAFE
=for apidoc
Returns a list of I<GdkDevice>s.
=cut
## GList * gdk_devices_list (void)
void
gdk_devices_list (class)
PREINIT:
GList *i, *list = NULL;
PPCODE:
PERL_UNUSED_VAR (ax);
list = gdk_devices_list ();
for (i = list; i != NULL; i = i->next)
XPUSHs (sv_2mortal (newSVGdkDevice (i->data)));
#endif /* ! GDK_MULTIHEAD_SAFE */
MODULE = Gtk2::Gdk::Device PACKAGE = Gtk2::Gdk::Device PREFIX = gdk_device_
gchar *
name (device)
GdkDevice *device
CODE:
RETVAL = device->name;
OUTPUT:
RETVAL
GdkInputSource
source (device)
GdkDevice *device
CODE:
RETVAL = device->source;
OUTPUT:
RETVAL
GdkInputMode
mode (device)
GdkDevice *device
CODE:
RETVAL = device->mode;
OUTPUT:
RETVAL
gboolean
has_cursor (device)
GdkDevice *device
CODE:
RETVAL = device->has_cursor;
OUTPUT:
RETVAL
=for apidoc
Returns a list of hash references that resemble the I<GdkDeviceAxis> structure,
i.e. that have three keys: "use", "min", and "max".
=cut
void
axes (device)
GdkDevice *device
PREINIT:
int i;
PPCODE:
EXTEND (sp, device->num_axes);
for (i = 0; i < device->num_axes; i++) {
HV *axis = newHV ();
hv_store (axis, "use", 3, newSVGdkAxisUse (device->axes[i].use), 0);
hv_store (axis, "min", 3, newSVnv (device->axes[i].min), 0);
hv_store (axis, "max", 3, newSVnv (device->axes[i].max), 0);
PUSHs (sv_2mortal (newRV_noinc ((SV *) axis)));
}
=for apidoc
Returns a list of hash references that resemble the I<GdkDeviceKey> structure,
i.e. that have two keys: "keyval" and "modifiers".
=cut
void
keys (device)
GdkDevice *device
PREINIT:
int i;
PPCODE:
EXTEND (sp, device->num_keys);
for (i = 0; i < device->num_keys; i++) {
HV *key = newHV ();
hv_store (key, "keyval", 6, newSVuv (device->keys[i].keyval), 0);
hv_store (key, "modifiers", 9, newSVGdkModifierType (device->keys[i].modifiers), 0);
PUSHs (sv_2mortal (newRV_noinc ((SV *) key)));
}
## void gdk_device_set_source (GdkDevice *device, GdkInputSource source)
void
gdk_device_set_source (device, source)
GdkDevice *device
GdkInputSource source
## gboolean gdk_device_set_mode (GdkDevice *device, GdkInputMode mode)
gboolean
gdk_device_set_mode (device, mode)
GdkDevice *device
GdkInputMode mode
## void gdk_device_set_key (GdkDevice *device, guint index_, guint keyval, GdkModifierType modifiers)
void
gdk_device_set_key (device, index_, keyval, modifiers)
GdkDevice *device
guint index_
guint keyval
GdkModifierType modifiers
## void gdk_device_set_axis_use (GdkDevice *device, guint index_, GdkAxisUse use)
void
gdk_device_set_axis_use (device, index_, use)
GdkDevice *device
guint index_
GdkAxisUse use
=for apidoc
Returns the modifier mask and a list of values of the axes.
=cut
## void gdk_device_get_state (GdkDevice *device, GdkWindow *window, gdouble *axes, GdkModifierType *mask)
void
gdk_device_get_state (device, window)
GdkDevice *device
GdkWindow *window
PREINIT:
gdouble *axes = NULL;
GdkModifierType mask;
int i;
PPCODE:
axes = g_new0 (gdouble, device->num_axes);
gdk_device_get_state (device, window, axes, &mask);
EXTEND (sp, device->num_axes + 1);
PUSHs (sv_2mortal (newSVGdkModifierType (mask)));
for (i = 0; i < device->num_axes; i++)
PUSHs (sv_2mortal (newSVnv (axes[i])));
g_free (axes);
=for apidoc
Returns a list of hash references that resemble the I<GdkTimeCoord> structure,
i.e. that have two keys: "time" and "axes".
=cut
## gboolean gdk_device_get_history (GdkDevice *device, GdkWindow *window, guint32 start, guint32 stop, GdkTimeCoord ***events, gint *n_events)
void
gdk_device_get_history (device, window, start, stop)
GdkDevice *device
GdkWindow *window
guint32 start
guint32 stop
PREINIT:
GdkTimeCoord **events = NULL;
gint i, j, n_events = 0;
PPCODE:
if (! gdk_device_get_history (device, window, start, stop, &events, &n_events))
XSRETURN_EMPTY;
EXTEND (sp, n_events);
for (i = 0; i < n_events; i++) {
HV *event;
AV *axes;
axes = newAV ();
for (j = 0; j < device->num_axes; j++)
av_store (axes, j, newSVnv (events[i]->axes[j]));
event = newHV ();
hv_store (event, "axes", 4, newRV_noinc ((SV *) axes), 0);
hv_store (event, "time", 4, newSVuv (events[i]->time), 0);
PUSHs (sv_2mortal (newRV_noinc ((SV *) event)));
}
gdk_device_free_history (events, n_events);
=for apidoc
=for arg ... of axis values such as the one returned by L<get_state>
=cut
## gboolean gdk_device_get_axis (GdkDevice *device, gdouble *axes, GdkAxisUse use, gdouble *value)
gdouble
gdk_device_get_axis (device, use, ...)
GdkDevice *device
GdkAxisUse use
PREINIT:
gdouble *real_axes = NULL;
gdouble value = 0;
int i;
CODE:
#define FIRST 2
real_axes = g_new0 (double, items - FIRST);
for (i = FIRST; i < items; i++)
real_axes[i - FIRST] = SvNV (ST (i));
if (! gdk_device_get_axis (device, real_axes, use, &value))
XSRETURN_UNDEF;
RETVAL = value;
g_free (real_axes);
#undef FIRST
OUTPUT:
RETVAL
#ifndef GDK_MULTIHEAD_SAFE
## GdkDevice *gdk_device_get_core_pointer (void)
GdkDevice *
gdk_device_get_core_pointer (class)
C_ARGS:
/* void */
#endif /* ! GDK_MULTIHEAD_SAFE */
MODULE = Gtk2::Gdk::Device PACKAGE = Gtk2::Gdk::Input PREFIX = gdk_input_
## void gdk_input_set_extension_events (GdkWindow *window, gint mask, GdkExtensionMode mode)
void
gdk_input_set_extension_events (class, window, mask, mode)
GdkWindow *window
GdkEventMask mask
GdkExtensionMode mode
C_ARGS:
window, mask, mode
|