Mercurial > pidgin.yaz
annotate src/gtkidle.c @ 12478:8489040cf97b
[gaim-migrate @ 14789]
Patch to gaim-devel by Aleksander Piotrowski
"Looks like if one sets alias for particular buddy then alias_buddy callback
is not called. Following diff fixes that problem for me (verified with
jabber and my own protocol plugins) but I'm not sure if it is correct place
to call serv_alias_buddy() (as I'm not sure if this whole alias bug isn't
only my local problem ;)"
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 13 Dec 2005 23:25:24 +0000 |
parents | bc249de5ea02 |
children | 723f5b7ef6a2 |
rev | line source |
---|---|
11907 | 1 /* |
2 * gaim | |
3 * | |
4 * Gaim is the legal property of its developers, whose names are too numerous | |
5 * to list here. Please refer to the COPYRIGHT file distributed with this | |
6 * source distribution. | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 * | |
22 */ | |
23 #include "internal.h" | |
12410
bc249de5ea02
[gaim-migrate @ 14717]
Richard Laager <rlaager@wiktel.com>
parents:
12278
diff
changeset
|
24 #include "gtkidle.h" |
11907 | 25 |
26 #ifdef USE_SCREENSAVER | |
27 # ifndef _WIN32 | |
28 # include <X11/Xlib.h> | |
29 # include <X11/Xutil.h> | |
30 # include <X11/extensions/scrnsaver.h> | |
31 # include <gdk/gdkx.h> | |
32 # else | |
33 # include "idletrack.h" | |
34 # endif | |
35 #endif /* USE_SCREENSAVER */ | |
36 | |
12272 | 37 #include "idle.h" |
11907 | 38 |
39 /** | |
40 * Get the number of seconds the user has been idle. In Unix-world | |
41 * this is based on the X Windows usage. In MS Windows this is based | |
42 * on keyboard/mouse usage. | |
43 * | |
44 * In Debian bug #271639, jwz says: | |
45 * | |
46 * Gaim should simply ask xscreensaver how long the user has been idle: | |
47 * % xscreensaver-command -time | |
48 * XScreenSaver 4.18: screen blanked since Tue Sep 14 14:10:45 2004 | |
49 * | |
50 * Or you can monitor the _SCREENSAVER_STATUS property on root window #0. | |
51 * Element 0 is the status (0, BLANK, LOCK), element 1 is the time_t since | |
52 * the last state change, and subsequent elements are which hack is running | |
53 * on the various screens: | |
54 * % xprop -f _SCREENSAVER_STATUS 32ac -root _SCREENSAVER_STATUS | |
55 * _SCREENSAVER_STATUS(INTEGER) = BLANK, 1095196626, 10, 237 | |
56 * | |
57 * See watch() in xscreensaver/driver/xscreensaver-command.c. | |
58 * | |
59 * @return The number of seconds the user has been idle. | |
60 */ | |
12278 | 61 #ifdef USE_SCREENSAVER |
12272 | 62 static time_t |
63 gaim_gtk_get_time_idle() | |
11907 | 64 { |
12272 | 65 # ifndef _WIN32 |
66 /* Query xscreensaver */ | |
11907 | 67 static XScreenSaverInfo *mit_info = NULL; |
68 int event_base, error_base; | |
69 if (XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base)) { | |
70 if (mit_info == NULL) { | |
71 mit_info = XScreenSaverAllocInfo(); | |
72 } | |
73 XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info); | |
74 return (mit_info->idle) / 1000; | |
75 } else | |
76 return 0; | |
12272 | 77 # else |
78 /* Query windows */ | |
11907 | 79 return (GetTickCount() - wgaim_get_lastactive()) / 1000; |
12272 | 80 # endif /* _WIN32 */ |
12278 | 81 } |
11907 | 82 #endif /* USE_SCREENSAVER */ |
83 | |
12272 | 84 static GaimIdleUiOps ui_ops = |
11907 | 85 { |
12278 | 86 #ifdef USE_SCREENSAVER |
12272 | 87 gaim_gtk_get_time_idle |
12278 | 88 #else |
89 NULL | |
90 #endif /* USE_SCREENSAVER */ | |
12272 | 91 }; |
11907 | 92 |
12272 | 93 GaimIdleUiOps * |
94 gaim_gtk_idle_get_ui_ops() | |
11907 | 95 { |
12272 | 96 return &ui_ops; |
11907 | 97 } |