Changeset 10396

Show
Ignore:
Timestamp:
09/08/08 14:00:27 (2 months ago)
Author:
asterix
Message:

[Alex V. Myltsev] idle.c: cleanup.

Replace METH_VARARGS with METH_NOARGS, discard win32 ifdefs (it's no more compiled on win32 anyway).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/idle.c

    r10175 r10396  
    2424*/ 
    2525 
    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> 
    3129 
    3230#include <Python.h> 
    3331 
    34 #ifndef _WIN32 
    35         Display *display; 
    36 #endif 
    37  
     32Display *display; 
    3833 
    3934static PyObject * idle_init(PyObject *self, PyObject *args) 
    4035{ 
    41 #ifndef _WIN32 
    4236        display = XOpenDisplay(NULL); 
    43 #endif 
     37 
    4438        Py_INCREF(Py_None); 
    4539        return Py_None; 
     
    4842static PyObject * idle_getIdleSec(PyObject *self, PyObject *args) 
    4943{ 
    50 #ifndef _WIN32 
    5144        static XScreenSaverInfo *mit_info = NULL; 
    5245        int idle_time, event_base, error_base; 
    53 #endif 
    5446 
    55 #ifndef _WIN32 
    5647        if (XScreenSaverQueryExtension(display, &event_base, &error_base)) 
    5748        { 
     
    6354        else 
    6455                idle_time = 0; 
    65 #endif 
     56 
    6657        return Py_BuildValue("i", idle_time); 
    6758} 
     
    6960static PyObject * idle_close(PyObject *self, PyObject *args) 
    7061{ 
    71 #ifndef _WIN32 
    7262        XCloseDisplay(display); 
    73 #endif 
     63 
    7464        Py_INCREF(Py_None); 
    7565        return Py_None; 
     
    7868static PyMethodDef idleMethods[] = 
    7969{ 
    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"}, 
    8373        {NULL, NULL, 0, NULL} 
    8474};