Fri, 06 Jan 2006 04:46:00 +0000
[gaim-migrate @ 15091]
" Adds an emblem to a buddy if they have a queued message
(hidden conversation). In the large buddy list it is
added in the northwest corner, sliding the existing
northwest emblem (if specified) to the northeast
position and discarding the northeast emblem. In the
small buddy list, the emblem is added to the southeast.
Attached is a patch and an emblem image to be dropped
in pixmaps/status/default/. The emblem image is a
scaled down version of the send-im.png image." -- Casey Harkins
as I asked for this patch, and since there don't seem to be objections to
it (yet), I'm going ahead and applying it.
committer: Luke Schierer <lschiere@pidgin.im>
| 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
98d8abd3db98
[gaim-migrate @ 14717]
Richard Laager <rlaager@pidgin.im>
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
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
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
21bcbadf956d
[gaim-migrate @ 14582]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12272
diff
changeset
|
61 | #ifdef USE_SCREENSAVER |
|
12272
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
62 | static time_t |
|
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
63 | gaim_gtk_get_time_idle() |
| 11907 | 64 | { |
|
12272
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
65 | # ifndef _WIN32 |
|
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
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
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
77 | # else |
|
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
78 | /* Query windows */ |
| 11907 | 79 | return (GetTickCount() - wgaim_get_lastactive()) / 1000; |
|
12272
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
80 | # endif /* _WIN32 */ |
|
12278
21bcbadf956d
[gaim-migrate @ 14582]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12272
diff
changeset
|
81 | } |
| 11907 | 82 | #endif /* USE_SCREENSAVER */ |
| 83 | ||
|
12272
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
84 | static GaimIdleUiOps ui_ops = |
| 11907 | 85 | { |
|
12278
21bcbadf956d
[gaim-migrate @ 14582]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12272
diff
changeset
|
86 | #ifdef USE_SCREENSAVER |
|
12272
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
87 | gaim_gtk_get_time_idle |
|
12278
21bcbadf956d
[gaim-migrate @ 14582]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12272
diff
changeset
|
88 | #else |
|
21bcbadf956d
[gaim-migrate @ 14582]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12272
diff
changeset
|
89 | NULL |
|
21bcbadf956d
[gaim-migrate @ 14582]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12272
diff
changeset
|
90 | #endif /* USE_SCREENSAVER */ |
|
12272
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
91 | }; |
| 11907 | 92 | |
|
12272
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
93 | GaimIdleUiOps * |
|
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
94 | gaim_gtk_idle_get_ui_ops() |
| 11907 | 95 | { |
|
12272
4eee92ead973
[gaim-migrate @ 14574]
Mark Doliner <markdoliner@pidgin.im>
parents:
12252
diff
changeset
|
96 | return &ui_ops; |
| 11907 | 97 | } |