Sun, 01 Nov 2009 04:56:45 +0000
Use an updated exchndl.dll that supports setting the log file path manually and
external debug symbols (looks in the specified debug symbols dir and also for a
<modulename>.dbgsym alongside <modulename>).
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
1 | /** |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
2 | * @file gtkwin32dep.c UI Win32 Specific Functionality |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
3 | * @ingroup win32 |
| 14286 | 4 | * |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
7 | * source distribution. |
| 14286 | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify | |
| 10 | * it under the terms of the GNU General Public License as published by | |
| 11 | * the Free Software Foundation; either version 2 of the License, or | |
| 12 | * (at your option) any later version. | |
| 13 | * | |
| 14 | * This program is distributed in the hope that it will be useful, | |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | * GNU General Public License for more details. | |
| 18 | * | |
| 19 | * You should have received a copy of the GNU General Public License | |
| 20 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18633
diff
changeset
|
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 14286 | 22 | * |
| 23 | */ | |
| 24 | #define _WIN32_IE 0x500 | |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
25 | #ifndef WINVER |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
26 | #define WINVER 0x0500 /* W2K */ |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
27 | #endif |
| 14286 | 28 | #include <windows.h> |
| 29 | #include <io.h> | |
| 30 | #include <stdlib.h> | |
| 31 | #include <stdio.h> | |
| 32 | #include <winuser.h> | |
| 33 | ||
| 34 | #include <glib.h> | |
| 35 | #include <glib/gstdio.h> | |
| 36 | #include <gtk/gtk.h> | |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
37 | #include <gdk/gdkwin32.h> |
| 14286 | 38 | |
|
18633
34ba43198355
Fix the win32 build. Thanks to Etan and Lee Roach. Fixes #1929.
Daniel Atallah <datallah@pidgin.im>
parents:
17110
diff
changeset
|
39 | #include "internal.h" |
|
34ba43198355
Fix the win32 build. Thanks to Etan and Lee Roach. Fixes #1929.
Daniel Atallah <datallah@pidgin.im>
parents:
17110
diff
changeset
|
40 | |
| 14286 | 41 | #include "debug.h" |
| 42 | #include "notify.h" | |
|
21943
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
43 | #include "network.h" |
| 14286 | 44 | |
| 45 | #include "resource.h" | |
| 46 | #include "idletrack.h" | |
| 47 | #include "zlib.h" | |
| 48 | #include "untar.h" | |
| 49 | ||
| 50 | #include <libintl.h> | |
| 51 | ||
| 52 | #include "gtkwin32dep.h" | |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
53 | #include "win32dep.h" |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
54 | #include "gtkconv.h" |
|
21943
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
55 | #include "gtkconn.h" |
|
15678
7434ef155a3a
Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <datallah@pidgin.im>
parents:
15578
diff
changeset
|
56 | #include "util.h" |
| 14286 | 57 | #include "wspell.h" |
| 58 | ||
| 59 | /* | |
| 60 | * GLOBALS | |
| 61 | */ | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
62 | HINSTANCE exe_hInstance = 0; |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
63 | HINSTANCE dll_hInstance = 0; |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
64 | HWND messagewin_hwnd; |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
65 | static int gtkwin32_handle; |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
66 | |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
67 | typedef BOOL (CALLBACK* LPFNFLASHWINDOWEX)(PFLASHWINFO); |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
68 | static LPFNFLASHWINDOWEX MyFlashWindowEx = NULL; |
|
21943
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
69 | static gboolean pwm_handles_connections = TRUE; |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
70 | |
| 14286 | 71 | |
| 72 | /* | |
| 73 | * PUBLIC CODE | |
| 74 | */ | |
| 75 | ||
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
76 | HINSTANCE winpidgin_exe_hinstance(void) { |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
77 | return exe_hInstance; |
| 14286 | 78 | } |
| 79 | ||
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
80 | HINSTANCE winpidgin_dll_hinstance(void) { |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
81 | return dll_hInstance; |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
82 | } |
|
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
83 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
84 | int winpidgin_gz_decompress(const char* in, const char* out) { |
| 14286 | 85 | gzFile fin; |
| 86 | FILE *fout; | |
| 87 | char buf[1024]; | |
| 88 | int ret; | |
| 89 | ||
| 90 | if((fin = gzopen(in, "rb"))) { | |
| 91 | if(!(fout = g_fopen(out, "wb"))) { | |
| 15884 | 92 | purple_debug_error("winpidgin_gz_decompress", "Error opening file: %s\n", out); |
| 14286 | 93 | gzclose(fin); |
| 94 | return 0; | |
| 95 | } | |
| 96 | } | |
| 97 | else { | |
| 15884 | 98 | purple_debug_error("winpidgin_gz_decompress", "gzopen failed to open: %s\n", in); |
| 14286 | 99 | return 0; |
| 100 | } | |
| 101 | ||
| 102 | while((ret = gzread(fin, buf, 1024))) { | |
| 103 | if(fwrite(buf, 1, ret, fout) < ret) { | |
| 15884 | 104 | purple_debug_error("wpurple_gz_decompress", "Error writing %d bytes to file\n", ret); |
| 14286 | 105 | gzclose(fin); |
| 106 | fclose(fout); | |
| 107 | return 0; | |
| 108 | } | |
| 109 | } | |
| 110 | fclose(fout); | |
| 111 | gzclose(fin); | |
| 112 | ||
| 113 | if(ret < 0) { | |
| 15884 | 114 | purple_debug_error("winpidgin_gz_decompress", "gzread failed while reading: %s\n", in); |
| 14286 | 115 | return 0; |
| 116 | } | |
| 117 | ||
| 118 | return 1; | |
| 119 | } | |
| 120 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
121 | int winpidgin_gz_untar(const char* filename, const char* destdir) { |
| 14286 | 122 | char tmpfile[_MAX_PATH]; |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
123 | char template[]="wpidginXXXXXX"; |
| 14286 | 124 | |
| 125 | sprintf(tmpfile, "%s%s%s", g_get_tmp_dir(), G_DIR_SEPARATOR_S, _mktemp(template)); | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
126 | if(winpidgin_gz_decompress(filename, tmpfile)) { |
| 14286 | 127 | int ret; |
| 128 | if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET)) | |
| 129 | ret = 1; | |
| 130 | else { | |
| 15884 | 131 | purple_debug_error("winpidgin_gz_untar", "Failure untarring %s\n", tmpfile); |
| 14286 | 132 | ret = 0; |
| 133 | } | |
| 134 | g_unlink(tmpfile); | |
| 135 | return ret; | |
| 136 | } | |
| 137 | else { | |
| 15884 | 138 | purple_debug_error("winpidgin_gz_untar", "Failed to gz decompress %s\n", filename); |
| 14286 | 139 | return 0; |
| 140 | } | |
| 141 | } | |
| 142 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
143 | void winpidgin_shell_execute(const char *target, const char *verb, const char *clazz) { |
| 14286 | 144 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
145 | SHELLEXECUTEINFOW wsinfo; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
146 | wchar_t *w_uri, *w_verb, *w_clazz = NULL; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
147 | |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
148 | g_return_if_fail(target != NULL); |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
149 | g_return_if_fail(verb != NULL); |
| 14286 | 150 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
151 | w_uri = g_utf8_to_utf16(target, -1, NULL, NULL, NULL); |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
152 | w_verb = g_utf8_to_utf16(verb, -1, NULL, NULL, NULL); |
| 14286 | 153 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
154 | memset(&wsinfo, 0, sizeof(wsinfo)); |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
155 | wsinfo.cbSize = sizeof(wsinfo); |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
156 | wsinfo.lpVerb = w_verb; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
157 | wsinfo.lpFile = w_uri; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
158 | wsinfo.nShow = SW_SHOWNORMAL; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
159 | if (clazz != NULL) { |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
160 | w_clazz = g_utf8_to_utf16(clazz, -1, NULL, NULL, NULL); |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
161 | wsinfo.fMask |= SEE_MASK_CLASSNAME; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
162 | wsinfo.lpClass = w_clazz; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
163 | } |
| 14286 | 164 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
165 | if(!ShellExecuteExW(&wsinfo)) |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
166 | purple_debug_error("winpidgin", "Error opening URI: %s error: %d\n", |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
167 | target, (int) wsinfo.hInstApp); |
| 14286 | 168 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
169 | g_free(w_uri); |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
170 | g_free(w_verb); |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
171 | g_free(w_clazz); |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
172 | |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
173 | } |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
174 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
175 | void winpidgin_notify_uri(const char *uri) { |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
176 | /* We'll allow whatever URI schemes are supported by the |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
177 | * default http browser. |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
178 | */ |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
179 | winpidgin_shell_execute(uri, "open", "http"); |
| 14286 | 180 | } |
| 181 | ||
|
15678
7434ef155a3a
Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <datallah@pidgin.im>
parents:
15578
diff
changeset
|
182 | #define PIDGIN_WM_FOCUS_REQUEST (WM_APP + 13) |
|
7434ef155a3a
Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <datallah@pidgin.im>
parents:
15578
diff
changeset
|
183 | #define PIDGIN_WM_PROTOCOL_HANDLE (WM_APP + 14) |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
184 | |
|
21943
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
185 | static void* |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
186 | winpidgin_netconfig_changed_cb(void *data) |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
187 | { |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
188 | pwm_handles_connections = FALSE; |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
189 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
190 | return NULL; |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
191 | } |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
192 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
193 | static void* |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
194 | winpidgin_get_handle(void) |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
195 | { |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
196 | static int handle; |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
197 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
198 | return &handle; |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
199 | } |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
200 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
201 | static gboolean |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
202 | winpidgin_pwm_reconnect() |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
203 | { |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
204 | purple_signal_disconnect(purple_network_get_handle(), "network-configuration-changed", |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
205 | winpidgin_get_handle(), PURPLE_CALLBACK(winpidgin_netconfig_changed_cb)); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
206 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
207 | if (pwm_handles_connections == TRUE) { |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
208 | PurpleConnectionUiOps *ui_ops = pidgin_connections_get_ui_ops(); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
209 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
210 | purple_debug_info("winpidgin", "Resumed from standby, reconnecting accounts.\n"); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
211 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
212 | if (ui_ops != NULL && ui_ops->network_connected != NULL) |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
213 | ui_ops->network_connected(); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
214 | } else { |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
215 | purple_debug_info("winpidgin", "Resumed from standby, gtkconn will handle reconnecting.\n"); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
216 | pwm_handles_connections = TRUE; |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
217 | } |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
218 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
219 | return FALSE; |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
220 | } |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
221 | |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
222 | static LRESULT CALLBACK message_window_handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
223 | |
|
15678
7434ef155a3a
Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <datallah@pidgin.im>
parents:
15578
diff
changeset
|
224 | if (msg == PIDGIN_WM_FOCUS_REQUEST) { |
| 15884 | 225 | purple_debug_info("winpidgin", "Got external Buddy List focus request."); |
| 226 | purple_blist_set_visible(TRUE); | |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
227 | return TRUE; |
|
15678
7434ef155a3a
Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <datallah@pidgin.im>
parents:
15578
diff
changeset
|
228 | } else if (msg == PIDGIN_WM_PROTOCOL_HANDLE) { |
|
7434ef155a3a
Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <datallah@pidgin.im>
parents:
15578
diff
changeset
|
229 | char *proto_msg = (char *) lparam; |
| 15884 | 230 | purple_debug_info("winpidgin", "Got protocol handler request: %s\n", proto_msg ? proto_msg : ""); |
| 231 | purple_got_protocol_handler_uri(proto_msg); | |
|
15678
7434ef155a3a
Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <datallah@pidgin.im>
parents:
15578
diff
changeset
|
232 | return TRUE; |
|
21943
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
233 | } else if (msg == WM_POWERBROADCAST) { |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
234 | if (wparam == PBT_APMQUERYSUSPEND) { |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
235 | purple_debug_info("winpidgin", "Windows requesting permission to suspend.\n"); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
236 | return TRUE; |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
237 | } else if (wparam == PBT_APMSUSPEND) { |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
238 | PurpleConnectionUiOps *ui_ops = pidgin_connections_get_ui_ops(); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
239 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
240 | purple_debug_info("winpidgin", "Entering system standby, disconnecting accounts.\n"); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
241 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
242 | if (ui_ops != NULL && ui_ops->network_disconnected != NULL) |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
243 | ui_ops->network_disconnected(); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
244 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
245 | purple_signal_connect(purple_network_get_handle(), "network-configuration-changed", winpidgin_get_handle(), |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
246 | PURPLE_CALLBACK(winpidgin_netconfig_changed_cb), NULL); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
247 | |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
248 | return TRUE; |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
249 | } else if (wparam == PBT_APMRESUMESUSPEND) { |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
250 | purple_debug_info("winpidgin", "Resuming from system standby.\n"); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
251 | /* TODO: It seems like it'd be wise to use the NLA message, if possible, instead of this. */ |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
252 | purple_timeout_add_seconds(1, winpidgin_pwm_reconnect, NULL); |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
253 | return TRUE; |
|
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
254 | } |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
255 | } |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
256 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
257 | return DefWindowProc(hwnd, msg, wparam, lparam); |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
258 | } |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
259 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
260 | static HWND winpidgin_message_window_init(void) { |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
261 | HWND win_hwnd; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
262 | WNDCLASSEX wcx; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
263 | LPCTSTR wname; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
264 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
265 | wname = TEXT("WinpidginMsgWinCls"); |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
266 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
267 | wcx.cbSize = sizeof(wcx); |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
268 | wcx.style = 0; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
269 | wcx.lpfnWndProc = message_window_handler; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
270 | wcx.cbClsExtra = 0; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
271 | wcx.cbWndExtra = 0; |
|
16058
dc1c7b09a058
4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
272 | wcx.hInstance = winpidgin_exe_hinstance(); |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
273 | wcx.hIcon = NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
274 | wcx.hCursor = NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
275 | wcx.hbrBackground = NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
276 | wcx.lpszMenuName = NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
277 | wcx.lpszClassName = wname; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
278 | wcx.hIconSm = NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
279 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
280 | RegisterClassEx(&wcx); |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
281 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
282 | /* Create the window */ |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
283 | if(!(win_hwnd = CreateWindow(wname, TEXT("WinpidginMsgWin"), 0, 0, 0, 0, 0, |
|
21943
8a938e6ea033
This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents:
21613
diff
changeset
|
284 | NULL, NULL, winpidgin_exe_hinstance(), 0))) { |
| 15884 | 285 | purple_debug_error("winpidgin", |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
286 | "Unable to create message window.\n"); |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
287 | return NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
288 | } |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
289 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
290 | return win_hwnd; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
291 | } |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
292 | |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
293 | static gboolean stop_flashing(GtkWidget *widget, GdkEventFocus *event, gpointer data) { |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
294 | GtkWindow *window = data; |
|
17109
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
295 | gpointer handler_id; |
|
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
296 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
297 | winpidgin_window_flash(window, FALSE); |
|
17109
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
298 | |
|
24053
4ef3a40e1d9e
Use the "Flash taskbar button X times" value from the win32 Tweak UI "Prevent
Daniel Atallah <datallah@pidgin.im>
parents:
21943
diff
changeset
|
299 | if ((handler_id = g_object_get_data(G_OBJECT(window), "flash_stop_handler_id"))) { |
|
17109
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
300 | g_signal_handler_disconnect(G_OBJECT(window), (gulong) GPOINTER_TO_UINT(handler_id)); |
|
24053
4ef3a40e1d9e
Use the "Flash taskbar button X times" value from the win32 Tweak UI "Prevent
Daniel Atallah <datallah@pidgin.im>
parents:
21943
diff
changeset
|
301 | g_object_steal_data(G_OBJECT(window), "flash_stop_handler_id"); |
|
4ef3a40e1d9e
Use the "Flash taskbar button X times" value from the win32 Tweak UI "Prevent
Daniel Atallah <datallah@pidgin.im>
parents:
21943
diff
changeset
|
302 | } |
|
17109
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
303 | |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
304 | return FALSE; |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
305 | } |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
306 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
307 | void |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
308 | winpidgin_window_flash(GtkWindow *window, gboolean flash) { |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
309 | GdkWindow * gdkwin; |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
310 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
311 | g_return_if_fail(window != NULL); |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
312 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
313 | gdkwin = GTK_WIDGET(window)->window; |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
314 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
315 | g_return_if_fail(GDK_IS_WINDOW(gdkwin)); |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
316 | g_return_if_fail(GDK_WINDOW_TYPE(gdkwin) != GDK_WINDOW_CHILD); |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
317 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
318 | if(GDK_WINDOW_DESTROYED(gdkwin)) |
|
16345
b30ad1087fc3
Don't flash the conv. window if it is in the foreground.
Daniel Atallah <datallah@pidgin.im>
parents:
16123
diff
changeset
|
319 | return; |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
320 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
321 | if(MyFlashWindowEx) { |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
322 | FLASHWINFO info; |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
323 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
324 | memset(&info, 0, sizeof(FLASHWINFO)); |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
325 | info.cbSize = sizeof(FLASHWINFO); |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
326 | info.hwnd = GDK_WINDOW_HWND(gdkwin); |
|
17109
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
327 | if (flash) { |
|
24053
4ef3a40e1d9e
Use the "Flash taskbar button X times" value from the win32 Tweak UI "Prevent
Daniel Atallah <datallah@pidgin.im>
parents:
21943
diff
changeset
|
328 | DWORD flashCount; |
|
17110
c1e593033fad
Instead of flashing the taskbar continuously, flash it three times and leave it highlighted. Fixes #117.
Daniel Atallah <datallah@pidgin.im>
parents:
17109
diff
changeset
|
329 | info.uCount = 3; |
|
24053
4ef3a40e1d9e
Use the "Flash taskbar button X times" value from the win32 Tweak UI "Prevent
Daniel Atallah <datallah@pidgin.im>
parents:
21943
diff
changeset
|
330 | if (SystemParametersInfo(SPI_GETFOREGROUNDFLASHCOUNT, 0, &flashCount, 0)) |
|
4ef3a40e1d9e
Use the "Flash taskbar button X times" value from the win32 Tweak UI "Prevent
Daniel Atallah <datallah@pidgin.im>
parents:
21943
diff
changeset
|
331 | info.uCount = flashCount; |
|
17109
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
332 | info.dwFlags = FLASHW_ALL | FLASHW_TIMER; |
|
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
333 | } else |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
334 | info.dwFlags = FLASHW_STOP; |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
335 | info.dwTimeout = 0; |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
336 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
337 | MyFlashWindowEx(&info); |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
338 | } else |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
339 | FlashWindow(GDK_WINDOW_HWND(gdkwin), flash); |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
340 | } |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
341 | |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
342 | void |
| 15884 | 343 | winpidgin_conv_blink(PurpleConversation *conv, PurpleMessageFlags flags) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
344 | PidginWindow *win; |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
345 | GtkWindow *window; |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
346 | |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
347 | /* Don't flash for our own messages or system messages */ |
| 15884 | 348 | if(flags & PURPLE_MESSAGE_SEND || flags & PURPLE_MESSAGE_SYSTEM) |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
349 | return; |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
350 | |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
351 | if(conv == NULL) { |
| 15884 | 352 | purple_debug_info("winpidgin", "No conversation found to blink.\n"); |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
353 | return; |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
354 | } |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
355 | |
| 15563 | 356 | win = pidgin_conv_get_window(PIDGIN_CONVERSATION(conv)); |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
357 | if(win == NULL) { |
| 15884 | 358 | purple_debug_info("winpidgin", "No conversation windows found to blink.\n"); |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
359 | return; |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
360 | } |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
361 | window = GTK_WINDOW(win->window); |
|
14857
835b4926932f
[gaim-migrate @ 17560]
Daniel Atallah <datallah@pidgin.im>
parents:
14762
diff
changeset
|
362 | |
|
16345
b30ad1087fc3
Don't flash the conv. window if it is in the foreground.
Daniel Atallah <datallah@pidgin.im>
parents:
16123
diff
changeset
|
363 | /* Don't flash if the window is in the foreground */ |
|
b30ad1087fc3
Don't flash the conv. window if it is in the foreground.
Daniel Atallah <datallah@pidgin.im>
parents:
16123
diff
changeset
|
364 | if (GetForegroundWindow() == GDK_WINDOW_HWND(GTK_WIDGET(window)->window)) |
|
b30ad1087fc3
Don't flash the conv. window if it is in the foreground.
Daniel Atallah <datallah@pidgin.im>
parents:
16123
diff
changeset
|
365 | return; |
|
b30ad1087fc3
Don't flash the conv. window if it is in the foreground.
Daniel Atallah <datallah@pidgin.im>
parents:
16123
diff
changeset
|
366 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
367 | winpidgin_window_flash(window, TRUE); |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
368 | /* Stop flashing when window receives focus */ |
|
17109
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
369 | if (g_object_get_data(G_OBJECT(window), "flash_stop_handler_id") == NULL) { |
|
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
370 | gulong handler_id = g_signal_connect(G_OBJECT(window), "focus-in-event", |
|
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
371 | G_CALLBACK(stop_flashing), window); |
|
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
372 | g_object_set_data(G_OBJECT(window), "flash_stop_handler_id", GUINT_TO_POINTER(handler_id)); |
|
8ce3b7c451f1
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
Daniel Atallah <datallah@pidgin.im>
parents:
16345
diff
changeset
|
373 | } |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
374 | } |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
375 | |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
376 | static gboolean |
| 15884 | 377 | winpidgin_conv_im_blink(PurpleAccount *account, const char *who, char **message, |
| 378 | PurpleConversation *conv, PurpleMessageFlags flags, void *data) | |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
379 | { |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16058
diff
changeset
|
380 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/win32/blink_im")) |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
381 | winpidgin_conv_blink(conv, flags); |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
382 | return FALSE; |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
383 | } |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
384 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
385 | void winpidgin_init(HINSTANCE hint) { |
|
29635
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
386 | FARPROC exchndl_SetLogFile; |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
387 | |
| 15884 | 388 | purple_debug_info("winpidgin", "winpidgin_init start\n"); |
| 14286 | 389 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
390 | exe_hInstance = hint; |
| 14286 | 391 | |
| 392 | /* IdleTracker Initialization */ | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
393 | if(!winpidgin_set_idlehooks()) |
| 15884 | 394 | purple_debug_error("winpidgin", "Failed to initialize idle tracker\n"); |
| 14286 | 395 | |
|
15697
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15678
diff
changeset
|
396 | winpidgin_spell_init(); |
| 15884 | 397 | purple_debug_info("winpidgin", "GTK+ :%u.%u.%u\n", |
| 14286 | 398 | gtk_major_version, gtk_minor_version, gtk_micro_version); |
| 399 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
400 | messagewin_hwnd = winpidgin_message_window_init(); |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
401 | |
| 15884 | 402 | MyFlashWindowEx = (LPFNFLASHWINDOWEX) wpurple_find_and_loadproc("user32.dll", "FlashWindowEx"); |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
403 | |
|
29635
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
404 | exchndl_SetLogFile = wpurple_find_and_loadproc("exchndl.dll", "SetLogFile"); |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
405 | if (exchndl_SetLogFile) { |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
406 | gchar *filename = g_build_filename(purple_user_dir(), |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
407 | "pidgin.RPT", NULL); |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
408 | purple_debug_info("winpidgin", "Setting exchndl.dll LogFile to %s\n", |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
409 | filename); |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
410 | (exchndl_SetLogFile)(filename); |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
411 | g_free(filename); |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
412 | } |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29508
diff
changeset
|
413 | |
| 15884 | 414 | purple_debug_info("winpidgin", "winpidgin_init end\n"); |
| 14286 | 415 | } |
| 416 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
417 | void winpidgin_post_init(void) { |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
418 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16058
diff
changeset
|
419 | purple_prefs_add_none(PIDGIN_PREFS_ROOT "/win32"); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16058
diff
changeset
|
420 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/win32/blink_im", TRUE); |
|
14867
03271f43f081
[gaim-migrate @ 17570]
Daniel Atallah <datallah@pidgin.im>
parents:
14857
diff
changeset
|
421 | |
| 15884 | 422 | purple_signal_connect(pidgin_conversations_get_handle(), |
| 423 | "displaying-im-msg", >kwin32_handle, PURPLE_CALLBACK(winpidgin_conv_im_blink), | |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
424 | NULL); |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
425 | |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
426 | } |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
427 | |
| 14286 | 428 | /* Windows Cleanup */ |
| 429 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
430 | void winpidgin_cleanup(void) { |
| 15884 | 431 | purple_debug_info("winpidgin", "winpidgin_cleanup\n"); |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
432 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
433 | if(messagewin_hwnd) |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
434 | DestroyWindow(messagewin_hwnd); |
| 14286 | 435 | |
| 436 | /* Idle tracker cleanup */ | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
437 | winpidgin_remove_idlehooks(); |
| 14286 | 438 | |
| 439 | } | |
| 440 | ||
| 441 | /* DLL initializer */ | |
|
15697
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15678
diff
changeset
|
442 | /* suppress gcc "no previous prototype" warning */ |
|
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15678
diff
changeset
|
443 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
444 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
445 | dll_hInstance = hinstDLL; |
| 14286 | 446 | return TRUE; |
| 447 | } | |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
448 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
449 | typedef HMONITOR WINAPI _MonitorFromWindow(HWND, DWORD); |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
450 | typedef BOOL WINAPI _GetMonitorInfo(HMONITOR, LPMONITORINFO); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
451 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
452 | static gboolean |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
453 | get_WorkingAreaRectForWindow(HWND hwnd, RECT *workingAreaRc) { |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
454 | static _MonitorFromWindow *the_MonitorFromWindow; |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
455 | static _GetMonitorInfo *the_GetMonitorInfo; |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
456 | static gboolean initialized = FALSE; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
457 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
458 | HMONITOR monitor; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
459 | MONITORINFO info; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
460 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
461 | if(!initialized) { |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
462 | the_MonitorFromWindow = (_MonitorFromWindow*) |
| 15884 | 463 | wpurple_find_and_loadproc("user32", "MonitorFromWindow"); |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
464 | the_GetMonitorInfo = (_GetMonitorInfo*) |
| 15884 | 465 | wpurple_find_and_loadproc("user32", "GetMonitorInfoA"); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
466 | initialized = TRUE; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
467 | } |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
468 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
469 | if(!the_MonitorFromWindow) |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
470 | return FALSE; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
471 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
472 | if(!the_GetMonitorInfo) |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
473 | return FALSE; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
474 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
475 | monitor = the_MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY); |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
476 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
477 | info.cbSize = sizeof(info); |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
478 | if(!the_GetMonitorInfo(monitor, &info)) |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
479 | return FALSE; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
480 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
481 | CopyRect(workingAreaRc, &(info.rcWork)); |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
482 | return TRUE; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
483 | } |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
484 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
485 | void winpidgin_ensure_onscreen(GtkWidget *win) { |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
486 | RECT winR, wAR, intR; |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
487 | HWND hwnd = GDK_WINDOW_HWND(win->window); |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
488 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
489 | g_return_if_fail(hwnd != NULL); |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
490 | GetWindowRect(hwnd, &winR); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
491 | |
| 15884 | 492 | purple_debug_info("win32placement", |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
493 | "Window RECT: L:%ld R:%ld T:%ld B:%ld\n", |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
494 | winR.left, winR.right, |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
495 | winR.top, winR.bottom); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
496 | |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
497 | if(!get_WorkingAreaRectForWindow(hwnd, &wAR)) { |
| 15884 | 498 | purple_debug_info("win32placement", |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
499 | "Couldn't get multimonitor working area\n"); |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
500 | if(!SystemParametersInfo(SPI_GETWORKAREA, 0, &wAR, FALSE)) { |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
501 | /* I don't think this will ever happen */ |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
502 | wAR.left = 0; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
503 | wAR.top = 0; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
504 | wAR.bottom = GetSystemMetrics(SM_CYSCREEN); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
505 | wAR.right = GetSystemMetrics(SM_CXSCREEN); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
506 | } |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
507 | } |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
508 | |
| 15884 | 509 | purple_debug_info("win32placement", |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
510 | "Working Area RECT: L:%ld R:%ld T:%ld B:%ld\n", |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
511 | wAR.left, wAR.right, |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
512 | wAR.top, wAR.bottom); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
513 | |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
514 | /** If the conversation window doesn't intersect perfectly, move it to do so */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
515 | if(!(IntersectRect(&intR, &winR, &wAR) |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
516 | && EqualRect(&intR, &winR))) { |
| 15884 | 517 | purple_debug_info("win32placement", |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
518 | "conversation window out of working area, relocating\n"); |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
519 | |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
520 | /* Make sure the working area is big enough. */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
521 | if ((winR.right - winR.left) <= (wAR.right - wAR.left) |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
522 | && (winR.bottom - winR.top) <= (wAR.bottom - wAR.top)) { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
523 | /* Is it off the bottom? */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
524 | if (winR.bottom > wAR.bottom) { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
525 | winR.top = wAR.bottom - (winR.bottom - winR.top); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
526 | winR.bottom = wAR.bottom; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
527 | } |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
528 | /* Is it off the top? */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
529 | else if (winR.top < wAR.top) { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
530 | winR.bottom = wAR.top + (winR.bottom - winR.top); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
531 | winR.top = wAR.top; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
532 | } |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
533 | |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
534 | /* Is it off the left? */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
535 | if (winR.left < wAR.left) { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
536 | winR.right = wAR.left + (winR.right - winR.left); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
537 | winR.left = wAR.left; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
538 | } |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
539 | /* Is it off the right? */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
540 | else if (winR.right > wAR.right) { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
541 | winR.left = wAR.right - (winR.right - winR.left); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
542 | winR.right = wAR.right; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
543 | } |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
544 | |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
545 | } else { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
546 | /* We couldn't salvage it; move it to the top left corner of the working area */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
547 | winR.right = wAR.left + (winR.right - winR.left); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
548 | winR.bottom = wAR.top + (winR.bottom - winR.top); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
549 | winR.left = wAR.left; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
550 | winR.top = wAR.top; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
551 | } |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
552 | |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
553 | purple_debug_info("win32placement", |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
554 | "Relocation RECT: L:%ld R:%ld T:%ld B:%ld\n", |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
555 | winR.left, winR.right, |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
556 | winR.top, winR.bottom); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
557 | |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
558 | MoveWindow(hwnd, winR.left, winR.top, |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
559 | (winR.right - winR.left), |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
560 | (winR.bottom - winR.top), TRUE); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
561 | } |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
562 | } |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
563 |