summaryrefslogtreecommitdiffstats
path: root/superkaramba/examples/globalMouse/extension
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2022-11-11 17:41:30 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2022-11-13 12:09:49 +0900
commitda9cd0c056c8275033fca84a1c8d49a8edb0c8ee (patch)
tree2521f74c0b2868d82518e13053fb01cc179e9a23 /superkaramba/examples/globalMouse/extension
parent5dab6232ef3b3715630cf88eb40c4c6021e65f07 (diff)
downloadtdeutils-da9cd0c056c8275033fca84a1c8d49a8edb0c8ee.tar.gz
tdeutils-da9cd0c056c8275033fca84a1c8d49a8edb0c8ee.zip
superkaramba: convert examples to python3.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
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);
+}