[thorstenp] use ctype to have idle. No need to compile it from C. Fixes #4260
This commit is contained in:
parent
39171b67b0
commit
d1a0a436c7
38
configure.ac
38
configure.ac
|
@ -84,39 +84,6 @@ fi
|
||||||
AM_CONDITIONAL(BUILD_GTKSPELL, $have_gtkspell)
|
AM_CONDITIONAL(BUILD_GTKSPELL, $have_gtkspell)
|
||||||
|
|
||||||
|
|
||||||
dnl ****
|
|
||||||
dnl xscreensaver
|
|
||||||
dnl ****
|
|
||||||
AC_ARG_ENABLE([idle],
|
|
||||||
[ --disable-idle do not build idle module [default auto]],
|
|
||||||
enable_idle=$enableval, enable_idle=yes)
|
|
||||||
|
|
||||||
if test "x$enable_idle" = "xyes";then
|
|
||||||
PKG_CHECK_EXISTS([xscrnsaver], [have_xscrnsaver=yes], [have_xscrnsaver=no])
|
|
||||||
|
|
||||||
if test "x$have_xscrnsaver" = "xyes";then
|
|
||||||
PKG_CHECK_MODULES([XSCRNSAVER], xscrnsaver)
|
|
||||||
AC_SUBST(XSCRNSAVER_LIBS)
|
|
||||||
have_idle=true
|
|
||||||
else
|
|
||||||
# Checks for libraries.
|
|
||||||
LIBS=-L$x_libraries
|
|
||||||
AC_CHECK_LIB([X11], [XOpenDisplay])
|
|
||||||
AC_CHECK_LIB([Xext], [XMissingExtension])
|
|
||||||
AC_CHECK_LIB([Xss], [XScreenSaverAllocInfo])
|
|
||||||
XSCRNSAVER_LIBS="$LIBS"
|
|
||||||
AC_SUBST([XSCRNSAVER_LIBS])
|
|
||||||
if test "x$XSCRNSAVER_LIBS" = "x-L";then
|
|
||||||
have_idle=false
|
|
||||||
else
|
|
||||||
have_idle=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
have_idle=false
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(BUILD_IDLE, $have_idle)
|
|
||||||
|
|
||||||
AM_PATH_PYTHON([2.4])
|
AM_PATH_PYTHON([2.4])
|
||||||
if test "x$PYTHON" = "x:"; then
|
if test "x$PYTHON" = "x:"; then
|
||||||
AC_MSG_ERROR([Python not found])
|
AC_MSG_ERROR([Python not found])
|
||||||
|
@ -180,9 +147,6 @@ if test "x$enable_carbon" = "xyes";then
|
||||||
if test "x$CARBON_LIBS" != "x";then
|
if test "x$CARBON_LIBS" != "x";then
|
||||||
AC_SUBST(CARBON_LIBS)
|
AC_SUBST(CARBON_LIBS)
|
||||||
have_idle_osx=true
|
have_idle_osx=true
|
||||||
dnl Disable X11 idle
|
|
||||||
have_idle=false
|
|
||||||
AM_CONDITIONAL(BUILD_IDLE, false)
|
|
||||||
dnl Disable custom trayicon
|
dnl Disable custom trayicon
|
||||||
have_trayicon=gtk+
|
have_trayicon=gtk+
|
||||||
AM_CONDITIONAL(BUILD_TRAYICON, false)
|
AM_CONDITIONAL(BUILD_TRAYICON, false)
|
||||||
|
@ -232,7 +196,6 @@ AC_CONFIG_FILES([
|
||||||
data/gajim.desktop.in
|
data/gajim.desktop.in
|
||||||
data/defs.py
|
data/defs.py
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/common/Makefile
|
|
||||||
src/osx/Makefile
|
src/osx/Makefile
|
||||||
src/osx/growl/Makefile
|
src/osx/growl/Makefile
|
||||||
src/osx/syncmenu/Makefile
|
src/osx/syncmenu/Makefile
|
||||||
|
@ -247,7 +210,6 @@ echo "
|
||||||
spell check ...... ${have_gtkspell}
|
spell check ...... ${have_gtkspell}
|
||||||
remote control ... ${have_remote}
|
remote control ... ${have_remote}
|
||||||
trayicon ......... ${have_trayicon}
|
trayicon ......... ${have_trayicon}
|
||||||
idle module ...... ${have_idle}
|
|
||||||
idle module OSX .. ${have_idle_osx}
|
idle module OSX .. ${have_idle_osx}
|
||||||
cocoa (OSX)....... ${have_cocoa}
|
cocoa (OSX)....... ${have_cocoa}
|
||||||
*****************************"
|
*****************************"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
SUBDIRS = common osx
|
SUBDIRS = osx
|
||||||
|
|
||||||
CLEANFILES = \
|
CLEANFILES = \
|
||||||
trayicon.c
|
trayicon.c
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
|
|
||||||
INCLUDES = \
|
|
||||||
$(PYTHON_INCLUDES)
|
|
||||||
if BUILD_IDLE
|
|
||||||
idlelib_LTLIBRARIES = idle.la
|
|
||||||
idlelibdir = $(libdir)/gajim
|
|
||||||
|
|
||||||
idle_la_LIBADD = $(XSCRNSAVER_LIBS)
|
|
||||||
|
|
||||||
idle_la_SOURCES = idle.c
|
|
||||||
|
|
||||||
idle_la_LDFLAGS = \
|
|
||||||
-module -avoid-version
|
|
||||||
|
|
||||||
idle_la_CFLAGS = $(XSCRNSAVER_CFLAGS) $(PYTHON_INCLUDES)
|
|
||||||
endif
|
|
||||||
|
|
||||||
DISTCLEANFILES =
|
|
||||||
|
|
||||||
EXTRA_DIST =
|
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
|
|
@ -1,80 +0,0 @@
|
||||||
/* common/idle.c
|
|
||||||
*
|
|
||||||
* Gajim Team:
|
|
||||||
* - Yann Le Boulanger <asterix@lagaule.org>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2003-2004 Yann Le Boulanger <asterix@lagaule.org>
|
|
||||||
* Vincent Hanquez <tab@snarc.org>
|
|
||||||
* Copyright (C) 2005-2006 Yann Le Boulanger <asterix@lagaule.org>
|
|
||||||
* Nikos Kouremenos <nkour@jabber.org>
|
|
||||||
*
|
|
||||||
* This file is part of Gajim.
|
|
||||||
*
|
|
||||||
* Gajim is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published
|
|
||||||
* by the Free Software Foundation; version 3 only.
|
|
||||||
*
|
|
||||||
* Gajim is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public Licens
|
|
||||||
* along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xutil.h>
|
|
||||||
#include <X11/extensions/scrnsaver.h>
|
|
||||||
|
|
||||||
#include <Python.h>
|
|
||||||
|
|
||||||
Display *display;
|
|
||||||
|
|
||||||
static PyObject * idle_init(PyObject *self, PyObject *args)
|
|
||||||
{
|
|
||||||
display = XOpenDisplay(NULL);
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
|
||||||
return Py_None;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject * idle_getIdleSec(PyObject *self, PyObject *args)
|
|
||||||
{
|
|
||||||
static XScreenSaverInfo *mit_info = NULL;
|
|
||||||
int idle_time, event_base, error_base;
|
|
||||||
|
|
||||||
if (XScreenSaverQueryExtension(display, &event_base, &error_base))
|
|
||||||
{
|
|
||||||
if (mit_info == NULL)
|
|
||||||
mit_info = XScreenSaverAllocInfo();
|
|
||||||
XScreenSaverQueryInfo(display, RootWindow(display, 0), mit_info);
|
|
||||||
idle_time = (mit_info->idle) / 1000;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
idle_time = 0;
|
|
||||||
|
|
||||||
return Py_BuildValue("i", idle_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject * idle_close(PyObject *self, PyObject *args)
|
|
||||||
{
|
|
||||||
XCloseDisplay(display);
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
|
||||||
return Py_None;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyMethodDef idleMethods[] =
|
|
||||||
{
|
|
||||||
{"init", idle_init, METH_NOARGS, "init idle"},
|
|
||||||
{"getIdleSec", idle_getIdleSec, METH_NOARGS, "Give the idle time in secondes"},
|
|
||||||
{"close", idle_close, METH_NOARGS, "close idle"},
|
|
||||||
{NULL, NULL, 0, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
PyMODINIT_FUNC
|
|
||||||
initidle(void)
|
|
||||||
{
|
|
||||||
(void) Py_InitModule("idle", idleMethods);
|
|
||||||
}
|
|
|
@ -47,7 +47,7 @@ try:
|
||||||
elif sys.platform == 'darwin':
|
elif sys.platform == 'darwin':
|
||||||
import osx.idle as idle
|
import osx.idle as idle
|
||||||
else: # unix
|
else: # unix
|
||||||
import idle
|
from common import idle
|
||||||
except Exception:
|
except Exception:
|
||||||
gajim.log.debug('Unable to load idle module')
|
gajim.log.debug('Unable to load idle module')
|
||||||
SUPPORTED = False
|
SUPPORTED = False
|
||||||
|
@ -91,11 +91,6 @@ class SleepyUnix:
|
||||||
self.away_interval = away_interval
|
self.away_interval = away_interval
|
||||||
self.xa_interval = xa_interval
|
self.xa_interval = xa_interval
|
||||||
self.state = STATE_AWAKE # assume we are awake
|
self.state = STATE_AWAKE # assume we are awake
|
||||||
try:
|
|
||||||
idle.init()
|
|
||||||
except Exception:
|
|
||||||
SUPPORTED = False
|
|
||||||
self.state = STATE_UNKNOWN
|
|
||||||
|
|
||||||
def getIdleSec(self):
|
def getIdleSec(self):
|
||||||
return idle.getIdleSec()
|
return idle.getIdleSec()
|
||||||
|
|
Loading…
Reference in New Issue