Changeset 10396
- Timestamp:
- 09/08/08 14:00:27 (2 months ago)
- Files:
-
- 1 modified
-
trunk/src/common/idle.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/common/idle.c
r10175 r10396 24 24 */ 25 25 26 #ifndef _WIN32 27 #include <X11/Xlib.h> 28 #include <X11/Xutil.h> 29 #include <X11/extensions/scrnsaver.h> 30 #endif 26 #include <X11/Xlib.h> 27 #include <X11/Xutil.h> 28 #include <X11/extensions/scrnsaver.h> 31 29 32 30 #include <Python.h> 33 31 34 #ifndef _WIN32 35 Display *display; 36 #endif 37 32 Display *display; 38 33 39 34 static PyObject * idle_init(PyObject *self, PyObject *args) 40 35 { 41 #ifndef _WIN3242 36 display = XOpenDisplay(NULL); 43 #endif 37 44 38 Py_INCREF(Py_None); 45 39 return Py_None; … … 48 42 static PyObject * idle_getIdleSec(PyObject *self, PyObject *args) 49 43 { 50 #ifndef _WIN3251 44 static XScreenSaverInfo *mit_info = NULL; 52 45 int idle_time, event_base, error_base; 53 #endif54 46 55 #ifndef _WIN3256 47 if (XScreenSaverQueryExtension(display, &event_base, &error_base)) 57 48 { … … 63 54 else 64 55 idle_time = 0; 65 #endif 56 66 57 return Py_BuildValue("i", idle_time); 67 58 } … … 69 60 static PyObject * idle_close(PyObject *self, PyObject *args) 70 61 { 71 #ifndef _WIN3272 62 XCloseDisplay(display); 73 #endif 63 74 64 Py_INCREF(Py_None); 75 65 return Py_None; … … 78 68 static PyMethodDef idleMethods[] = 79 69 { 80 {"init", idle_init, METH_ VARARGS, "init idle"},81 {"getIdleSec", idle_getIdleSec, METH_ VARARGS, "Give the idle time in secondes"},82 {"close", idle_close, METH_ VARARGS, "close idle"},70 {"init", idle_init, METH_NOARGS, "init idle"}, 71 {"getIdleSec", idle_getIdleSec, METH_NOARGS, "Give the idle time in secondes"}, 72 {"close", idle_close, METH_NOARGS, "close idle"}, 83 73 {NULL, NULL, 0, NULL} 84 74 };
