~ubuntu-branches/ubuntu/maverick/pygame/maverick

« back to all changes in this revision

Viewing changes to src/mouse.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-01-14 17:02:11 UTC
  • mfrom: (1.3.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100114170211-21eop2ja7mr9vdcr
Tags: 1.9.1release-0ubuntu1
* New upstream version (lp: #433304)
* debian/control:
  - build-depends on libportmidi-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 *  pygame mouse module
25
25
 */
26
26
#include "pygame.h"
 
27
#include "pgcompat.h"
27
28
#include "pygamedocs.h"
28
29
 
29
30
/* mouse module functions */
202
203
        PyTuple_SET_ITEM (anddata, loop, PyInt_FromLong (cursor->mask[loop]));
203
204
    }
204
205
 
205
 
    return Py_BuildValue ("((ii)(ii)OO)", w, h, spotx, spoty, xordata, anddata);
 
206
    return Py_BuildValue ("((ii)(ii)NN)", w, h, spotx, spoty, xordata, anddata);
206
207
}
207
208
 
208
 
static PyMethodDef mouse_builtins[] =
 
209
static PyMethodDef _mouse_methods[] =
209
210
{
210
211
    { "set_pos", mouse_set_pos, METH_VARARGS, DOC_PYGAMEMOUSESETPOS },
211
212
    { "get_pos", (PyCFunction) mouse_get_pos, METH_VARARGS,
226
227
};
227
228
 
228
229
 
229
 
PYGAME_EXPORT
230
 
void initmouse (void)
 
230
MODINIT_DEFINE (mouse)
231
231
{
232
 
    PyObject *module, *dict;
 
232
    PyObject *module;
 
233
 
 
234
#if PY3
 
235
    static struct PyModuleDef _module = {
 
236
        PyModuleDef_HEAD_INIT,
 
237
        "mouse",
 
238
        DOC_PYGAMEMOUSE,
 
239
        -1,
 
240
        _mouse_methods,
 
241
        NULL, NULL, NULL, NULL
 
242
    };
 
243
#endif
 
244
 
 
245
    /* imported needed apis; Do this first so if there is an error
 
246
       the module is not loaded.
 
247
    */
 
248
    import_pygame_base ();
 
249
    if (PyErr_Occurred ()) {
 
250
        MODINIT_ERROR;
 
251
    }
233
252
 
234
253
    /* create the module */
235
 
    module = Py_InitModule3 ("mouse", mouse_builtins, DOC_PYGAMEMOUSE);
236
 
    dict = PyModule_GetDict (module);
237
 
 
238
 
    /*imported needed apis*/
239
 
    import_pygame_base ();
 
254
#if PY3
 
255
    module = PyModule_Create (&_module);
 
256
#else
 
257
    module = Py_InitModule3 ("mouse", _mouse_methods, DOC_PYGAMEMOUSE);
 
258
#endif
 
259
    if (module == NULL) {
 
260
        MODINIT_ERROR;
 
261
    }
 
262
    MODINIT_RETURN (module);
240
263
}