Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eta
gajim
Commits
43e123e7
Commit
43e123e7
authored
20 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
module idle can now my used under windows 2k / XP
parent
427702e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/idle.c
+49
-8
49 additions, 8 deletions
common/idle.c
common/setup.py
+14
-7
14 additions, 7 deletions
common/setup.py
with
63 additions
and
15 deletions
common/idle.c
+
49
−
8
View file @
43e123e7
...
...
@@ -16,26 +16,51 @@
* GNU General Public License for more details.
*/
#include
<X11/Xlib.h>
#include
<X11/Xutil.h>
#include
<X11/extensions/scrnsaver.h>
#include
<gdk/gdkx.h>
#include
<python2.3/Python.h>
#ifndef _WIN32
#include
<X11/Xlib.h>
#include
<X11/Xutil.h>
#include
<X11/extensions/scrnsaver.h>
#include
<gdk/gdkx.h>
#include
<gtk/gtk.h>
#else
#define _WIN32_WINNT 0x0500
#include
<windows.h>
#define EXPORT __declspec(dllexport)
#endif
#include
<Python.h>
#ifdef _WIN32
typedef
BOOL
(
WINAPI
*
GETLASTINPUTINFO
)(
LASTINPUTINFO
*
);
static
HMODULE
g_user32
=
NULL
;
static
GETLASTINPUTINFO
g_GetLastInputInfo
=
NULL
;
#endif
#include
<gtk/gtk.h>
static
PyObject
*
idle_init
(
PyObject
*
self
,
PyObject
*
args
)
{
{
#ifndef _WIN32
gtk_init
(
NULL
,
NULL
);
#else
g_user32
=
LoadLibrary
(
"user32.dll"
);
if
(
g_user32
)
{
g_GetLastInputInfo
=
(
GETLASTINPUTINFO
)
GetProcAddress
(
g_user32
,
"GetLastInputInfo"
);
}
#endif
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
PyObject
*
idle_getIdleSec
(
PyObject
*
self
,
PyObject
*
args
)
{
#ifndef _WIN32
static
XScreenSaverInfo
*
mit_info
=
NULL
;
int
idle_time
,
event_base
,
error_base
;
#else
int
idle_time
=
0
;
#endif
#ifndef _WIN32
gtk_init
(
NULL
,
NULL
);
if
(
XScreenSaverQueryExtension
(
GDK_DISPLAY
(),
&
event_base
,
&
error_base
))
{
...
...
@@ -46,12 +71,28 @@ static PyObject * idle_getIdleSec(PyObject *self, PyObject *args)
}
else
idle_time
=
0
;
#else
if
(
g_GetLastInputInfo
!=
NULL
)
{
LASTINPUTINFO
lii
;
memset
(
&
lii
,
0
,
sizeof
(
lii
));
lii
.
cbSize
=
sizeof
(
lii
);
if
(
g_GetLastInputInfo
(
&
lii
))
{
idle_time
=
lii
.
dwTime
;
}
idle_time
=
(
GetTickCount
()
-
idle_time
)
/
1000
;
}
#endif
return
Py_BuildValue
(
"i"
,
idle_time
);
}
static
PyObject
*
idle_close
(
PyObject
*
self
,
PyObject
*
args
)
{
{
#ifndef _WIN32
gtk_main_quit
();
#else
if
(
g_user32
!=
NULL
)
FreeLibrary
(
g_user32
);
#endif
Py_INCREF
(
Py_None
);
return
Py_None
;
}
...
...
This diff is collapsed.
Click to expand it.
common/setup.py
+
14
−
7
View file @
43e123e7
...
...
@@ -17,13 +17,20 @@
##
from
distutils.core
import
setup
,
Extension
import
os
module1
=
Extension
(
'
idle
'
,
sources
=
[
'
idle.c
'
],
# extra_compile_args = ['-W'],
libraries
=
[
'
gtk-x11-2.0
'
,
'
gdk-x11-2.0
'
,
'
glib-2.0
'
,
'
X11
'
,
'
Xext
'
,
'
Xss
'
,
'
atk-1.0
'
],
library_dirs
=
[
'
/usr/X11R6/lib
'
],
include_dirs
=
[
'
/usr/include/gtk-2.0
'
,
'
/usr/include/glib-2.0
'
,
'
/usr/lib/gtk-2.0/include
'
,
'
/usr/lib/glib-2.0/include
'
,
'
/usr/include/pango-1.0
'
,
'
/usr/include/atk-1.0
'
]
)
if
os
.
name
==
'
posix
'
:
module1
=
Extension
(
'
idle
'
,
sources
=
[
'
idle.c
'
],
# extra_compile_args = ['-W'],
libraries
=
[
'
gtk-x11-2.0
'
,
'
gdk-x11-2.0
'
,
'
glib-2.0
'
,
'
X11
'
,
'
Xext
'
,
'
Xss
'
,
'
atk-1.0
'
],
library_dirs
=
[
'
/usr/X11R6/lib
'
],
include_dirs
=
[
'
/usr/include/gtk-2.0
'
,
'
/usr/include/glib-2.0
'
,
'
/usr/lib/gtk-2.0/include
'
,
'
/usr/lib/glib-2.0/include
'
,
'
/usr/include/pango-1.0
'
,
'
/usr/include/atk-1.0
'
]
)
elif
os
.
name
==
'
nt
'
:
module1
=
Extension
(
'
idle
'
,
sources
=
[
'
idle.c
'
],
# extra_compile_args = ['-W'],
)
setup
(
name
=
'
idle
'
,
version
=
'
1.0
'
,
description
=
'
interface to X11/scrnserver.h
'
,
ext_modules
=
[
module1
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment