From d1a0a436c7703d45787fea6fb779289a01640373 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 3 Dec 2008 22:46:55 +0000 Subject: [PATCH] [thorstenp] use ctype to have idle. No need to compile it from C. Fixes #4260 --- configure.ac | 38 -------------------- src/Makefile.am | 2 +- src/common/Makefile.am | 22 ------------ src/common/idle.c | 80 ------------------------------------------ src/common/sleepy.py | 7 +--- 5 files changed, 2 insertions(+), 147 deletions(-) delete mode 100644 src/common/Makefile.am delete mode 100644 src/common/idle.c diff --git a/configure.ac b/configure.ac index 4a1f08987..b38199934 100644 --- a/configure.ac +++ b/configure.ac @@ -84,39 +84,6 @@ fi 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]) if test "x$PYTHON" = "x:"; then AC_MSG_ERROR([Python not found]) @@ -180,9 +147,6 @@ if test "x$enable_carbon" = "xyes";then if test "x$CARBON_LIBS" != "x";then AC_SUBST(CARBON_LIBS) have_idle_osx=true - dnl Disable X11 idle - have_idle=false - AM_CONDITIONAL(BUILD_IDLE, false) dnl Disable custom trayicon have_trayicon=gtk+ AM_CONDITIONAL(BUILD_TRAYICON, false) @@ -232,7 +196,6 @@ AC_CONFIG_FILES([ data/gajim.desktop.in data/defs.py src/Makefile - src/common/Makefile src/osx/Makefile src/osx/growl/Makefile src/osx/syncmenu/Makefile @@ -247,7 +210,6 @@ echo " spell check ...... ${have_gtkspell} remote control ... ${have_remote} trayicon ......... ${have_trayicon} - idle module ...... ${have_idle} idle module OSX .. ${have_idle_osx} cocoa (OSX)....... ${have_cocoa} *****************************" diff --git a/src/Makefile.am b/src/Makefile.am index f0e4798ca..46a22cef6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = common osx +SUBDIRS = osx CLEANFILES = \ trayicon.c diff --git a/src/common/Makefile.am b/src/common/Makefile.am deleted file mode 100644 index ff75958c0..000000000 --- a/src/common/Makefile.am +++ /dev/null @@ -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 diff --git a/src/common/idle.c b/src/common/idle.c deleted file mode 100644 index 124a07c50..000000000 --- a/src/common/idle.c +++ /dev/null @@ -1,80 +0,0 @@ -/* common/idle.c - * - * Gajim Team: - * - Yann Le Boulanger - * - * Copyright (C) 2003-2004 Yann Le Boulanger - * Vincent Hanquez - * Copyright (C) 2005-2006 Yann Le Boulanger - * Nikos Kouremenos - * - * 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 . -*/ - -#include -#include -#include - -#include - -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); -} diff --git a/src/common/sleepy.py b/src/common/sleepy.py index 3f3a4c6f1..8137cb121 100644 --- a/src/common/sleepy.py +++ b/src/common/sleepy.py @@ -47,7 +47,7 @@ try: elif sys.platform == 'darwin': import osx.idle as idle else: # unix - import idle + from common import idle except Exception: gajim.log.debug('Unable to load idle module') SUPPORTED = False @@ -91,11 +91,6 @@ class SleepyUnix: self.away_interval = away_interval self.xa_interval = xa_interval self.state = STATE_AWAKE # assume we are awake - try: - idle.init() - except Exception: - SUPPORTED = False - self.state = STATE_UNKNOWN def getIdleSec(self): return idle.getIdleSec()