summaryrefslogtreecommitdiffstats
path: root/superkaramba/examples/globalMouse/extension
diff options
context:
space:
mode:
Diffstat (limited to 'superkaramba/examples/globalMouse/extension')
-rw-r--r--superkaramba/examples/globalMouse/extension/setup.py20
-rw-r--r--superkaramba/examples/globalMouse/extension/xcursor.c16
2 files changed, 23 insertions, 13 deletions
diff --git a/superkaramba/examples/globalMouse/extension/setup.py b/superkaramba/examples/globalMouse/extension/setup.py
index f33f8a6..49bd87b 100644
--- a/superkaramba/examples/globalMouse/extension/setup.py
+++ b/superkaramba/examples/globalMouse/extension/setup.py
@@ -1,12 +1,14 @@
from distutils.core import setup, Extension
-module1 = Extension('xcursor',
- include_dirs = ['/usr/X11R6/include'],
- libraries = ['X11'],
- library_dirs = ['/usr/X11R6/lib'],
- sources = ['xcursor.c'])
+def main():
+ setup(name = 'XMouseCursor',
+ version = '1.0',
+ description = 'Determines the position of the X mouse cursor',
+ ext_modules = [Extension('xcursor',
+ include_dirs = ['/usr/X11R6/include'],
+ libraries = ['X11'],
+ library_dirs = ['/usr/X11R6/lib'],
+ sources = ['xcursor.c'])])
-setup (name = 'XMouseCursor',
- version = '1.0',
- description = 'Determines the position of the X mouse cursor',
- ext_modules = [module1])
+if __name__ == "__main__":
+ main()
diff --git a/superkaramba/examples/globalMouse/extension/xcursor.c b/superkaramba/examples/globalMouse/extension/xcursor.c
index 8dad240..fbe80fa 100644
--- a/superkaramba/examples/globalMouse/extension/xcursor.c
+++ b/superkaramba/examples/globalMouse/extension/xcursor.c
@@ -26,6 +26,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
****************************************************************************/
+#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <X11/Xlib.h>
@@ -96,9 +97,16 @@ static PyMethodDef xcursorMethods[] =
{NULL, NULL, 0, NULL} /* Sentinel */
};
-void initxcursor(void)
+static struct PyModuleDef xcursordef =
{
- (void) Py_InitModule("xcursor", xcursorMethods);
-}
-
+ PyModuleDef_HEAD_INIT,
+ "xcursor",
+ NULL,
+ -1,
+ xcursorMethods
+};
+PyMODINIT_FUNC PyInit_xcursor(void)
+{
+ return PyModule_Create(&xcursordef);
+}