Fri, 11 Oct 2019 05:35:07 +0000
Merged in default (pull request #594)
Fix some Windows build issues
Approved-by: Gary Kramlich
Approved-by: Eion Robb
|
38553
36e30c91cd15
gtkwin32dep: Fix section documentation headings
Mike Ruprecht <cmaiku@gmail.com>
parents:
38433
diff
changeset
|
1 | /* |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
2 | * 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
|
3 | * 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
|
4 | * source distribution. |
| 14286 | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * 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
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 14286 | 19 | * |
| 20 | */ | |
|
33898
0f4b2e3ac978
win32: fix all warnings about improper winsock2.h include point
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33647
diff
changeset
|
21 | #include "internal.h" |
|
0f4b2e3ac978
win32: fix all warnings about improper winsock2.h include point
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33647
diff
changeset
|
22 | |
| 14286 | 23 | #include <io.h> |
| 24 | #include <stdlib.h> | |
| 25 | #include <stdio.h> | |
| 26 | #include <winuser.h> | |
|
35892
02bf3200b9cb
cross-win32: make use of WIN32_LEAN_AND_MEAN define
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35891
diff
changeset
|
27 | #include <shellapi.h> |
| 14286 | 28 | |
| 29 | #include <glib.h> | |
| 30 | #include <glib/gstdio.h> | |
| 31 | #include <gtk/gtk.h> | |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
32 | #include <gdk/gdkwin32.h> |
| 14286 | 33 | |
| 34 | #include "debug.h" | |
| 35 | #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
|
36 | #include "network.h" |
| 14286 | 37 | |
| 38 | #include "resource.h" | |
| 39 | #include "untar.h" | |
| 40 | ||
| 41 | #include "gtkwin32dep.h" | |
|
39333
2da5959eb42c
pidgin: Use gtk_window_present() to present buddy list
Mike Ruprecht <cmaiku@gmail.com>
parents:
38628
diff
changeset
|
42 | #include "gtkblist.h" |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
43 | #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
|
44 | #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
|
45 | #include "util.h" |
| 14286 | 46 | |
| 47 | /* | |
| 48 | * GLOBALS | |
| 49 | */ | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
50 | HINSTANCE exe_hInstance = 0; |
|
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
51 | HINSTANCE dll_hInstance = 0; |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
52 | HWND messagewin_hwnd; |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
53 | static int gtkwin32_handle; |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
54 | |
|
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 | static gboolean pwm_handles_connections = TRUE; |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
56 | |
| 14286 | 57 | |
| 58 | /* | |
| 59 | * PUBLIC CODE | |
| 60 | */ | |
| 61 | ||
|
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
|
62 | HINSTANCE winpidgin_exe_hinstance(void) { |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
63 | return exe_hInstance; |
| 14286 | 64 | } |
| 65 | ||
| 35605 | 66 | void winpidgin_set_exe_hinstance(HINSTANCE hint) |
| 67 | { | |
| 68 | exe_hInstance = hint; | |
| 69 | } | |
| 70 | ||
|
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
|
71 | 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
|
72 | 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
|
73 | } |
|
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
|
74 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
75 | int winpidgin_gz_decompress(const char* in, const char* out) { |
|
38628
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
76 | GFile *fin; |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
77 | GFile *fout; |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
78 | GInputStream *input; |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
79 | GOutputStream *output; |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
80 | GOutputStream *conv_out; |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
81 | GZlibDecompressor *decompressor; |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
82 | gssize size; |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
83 | GError *error = NULL; |
| 14286 | 84 | |
|
38628
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
85 | fin = g_file_new_for_path(in); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
86 | input = G_INPUT_STREAM(g_file_read(fin, NULL, &error)); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
87 | g_object_unref(fin); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
88 | |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
89 | if (input == NULL) { |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
90 | purple_debug_error("winpidgin_gz_decompress", |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
91 | "Failed to open: %s: %s\n", |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
92 | in, error->message); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
93 | g_clear_error(&error); |
| 14286 | 94 | return 0; |
| 95 | } | |
| 96 | ||
|
38628
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
97 | fout = g_file_new_for_path(out); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
98 | output = G_OUTPUT_STREAM(g_file_replace(fout, NULL, FALSE, |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
99 | G_FILE_CREATE_NONE, NULL, &error)); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
100 | g_object_unref(fout); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
101 | |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
102 | if (output == NULL) { |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
103 | purple_debug_error("winpidgin_gz_decompress", |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
104 | "Error opening file: %s: %s\n", |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
105 | out, error->message); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
106 | g_clear_error(&error); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
107 | g_object_unref(input); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
108 | return 0; |
| 14286 | 109 | } |
|
38628
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
110 | |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
111 | decompressor = g_zlib_decompressor_new(G_ZLIB_COMPRESSOR_FORMAT_GZIP); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
112 | conv_out = g_converter_output_stream_new(output, |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
113 | G_CONVERTER(decompressor)); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
114 | g_object_unref(decompressor); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
115 | g_object_unref(output); |
| 14286 | 116 | |
|
38628
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
117 | size = g_output_stream_splice(conv_out, input, |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
118 | G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
119 | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, NULL, &error); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
120 | |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
121 | g_object_unref(input); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
122 | g_object_unref(conv_out); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
123 | |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
124 | if (size < 0) { |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
125 | purple_debug_error("wpurple_gz_decompress", |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
126 | "Error writing to file: %s\n", |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
127 | error->message); |
|
ea61e3b679a7
gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents:
38553
diff
changeset
|
128 | g_clear_error(&error); |
| 14286 | 129 | return 0; |
| 130 | } | |
| 131 | ||
| 132 | return 1; | |
| 133 | } | |
| 134 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
135 | int winpidgin_gz_untar(const char* filename, const char* destdir) { |
| 14286 | 136 | char tmpfile[_MAX_PATH]; |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
137 | char template[]="wpidginXXXXXX"; |
| 14286 | 138 | |
| 139 | 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
|
140 | if(winpidgin_gz_decompress(filename, tmpfile)) { |
| 14286 | 141 | int ret; |
| 142 | if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET)) | |
| 143 | ret = 1; | |
| 144 | else { | |
| 15884 | 145 | purple_debug_error("winpidgin_gz_untar", "Failure untarring %s\n", tmpfile); |
| 14286 | 146 | ret = 0; |
| 147 | } | |
| 148 | g_unlink(tmpfile); | |
| 149 | return ret; | |
| 150 | } | |
| 151 | else { | |
| 15884 | 152 | purple_debug_error("winpidgin_gz_untar", "Failed to gz decompress %s\n", filename); |
| 14286 | 153 | return 0; |
| 154 | } | |
| 155 | } | |
| 156 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
157 | void winpidgin_shell_execute(const char *target, const char *verb, const char *clazz) { |
| 14286 | 158 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
159 | SHELLEXECUTEINFOW wsinfo; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
160 | wchar_t *w_uri, *w_verb, *w_clazz = NULL; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
161 | |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
162 | g_return_if_fail(target != NULL); |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
163 | g_return_if_fail(verb != NULL); |
| 14286 | 164 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
165 | 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
|
166 | w_verb = g_utf8_to_utf16(verb, -1, NULL, NULL, NULL); |
| 14286 | 167 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
168 | memset(&wsinfo, 0, sizeof(wsinfo)); |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
169 | wsinfo.cbSize = sizeof(wsinfo); |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
170 | wsinfo.lpVerb = w_verb; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
171 | wsinfo.lpFile = w_uri; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
172 | wsinfo.nShow = SW_SHOWNORMAL; |
|
29701
6c95c4bd2241
propagate from branch 'im.pidgin.pidgin' (head 9ff8f3bdd0f5c0101988628f7bf8dad4f7cb8f40)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
173 | wsinfo.fMask |= SEE_MASK_FLAG_NO_UI; |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
174 | if (clazz != NULL) { |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
175 | 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
|
176 | wsinfo.fMask |= SEE_MASK_CLASSNAME; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
177 | wsinfo.lpClass = w_clazz; |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
178 | } |
| 14286 | 179 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
180 | if(!ShellExecuteExW(&wsinfo)) |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
181 | 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
|
182 | target, (int) wsinfo.hInstApp); |
| 14286 | 183 | |
|
29508
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
184 | g_free(w_uri); |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
185 | g_free(w_verb); |
|
26abf4ffa828
Remove some win9x specific code.
Daniel Atallah <datallah@pidgin.im>
parents:
24053
diff
changeset
|
186 | g_free(w_clazz); |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
187 | |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
188 | } |
|
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
189 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
190 | void winpidgin_notify_uri(const char *uri) { |
|
33647
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
191 | /* Allow a few commonly used and "safe" schemes to go to the specific |
|
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
192 | * class handlers and send everything else to the default http browser. |
|
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
193 | * This isn't optimal, but should cover the most common cases. I didn't |
|
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
194 | * see any better secure solutions when I did some research. |
|
15298
e192226f7804
[gaim-migrate @ 18026]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
195 | */ |
|
33647
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
196 | gchar *scheme = g_uri_parse_scheme(uri); |
|
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
197 | if (scheme && (g_ascii_strcasecmp(scheme, "https") == 0 |
|
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
198 | || g_ascii_strcasecmp(scheme, "ftp") == 0 |
|
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
199 | || g_ascii_strcasecmp(scheme, "mailto") == 0)) |
|
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
200 | winpidgin_shell_execute(uri, "open", scheme); |
|
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
201 | else |
|
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
202 | winpidgin_shell_execute(uri, "open", "http"); |
|
c76b490587d4
Improve URI handling on Windows 8.
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
203 | g_free(scheme); |
| 14286 | 204 | } |
| 205 | ||
|
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
|
206 | #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
|
207 | #define PIDGIN_WM_PROTOCOL_HANDLE (WM_APP + 14) |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
208 | |
|
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
|
209 | static void* |
|
37489
cbf9ccc715ab
Move everything in libpurple that was using the network-changed signal to use the gio one
Gary Kramlich <grim@reaperworld.com>
parents:
36114
diff
changeset
|
210 | winpidgin_netconfig_changed_cb(GNetworkMonitor *monitor, gboolean available, gpointer data) |
|
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
|
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 | 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
|
213 | |
|
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 | 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
|
215 | } |
|
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 | |
|
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 | 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
|
218 | 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
|
219 | { |
|
37489
cbf9ccc715ab
Move everything in libpurple that was using the network-changed signal to use the gio one
Gary Kramlich <grim@reaperworld.com>
parents:
36114
diff
changeset
|
220 | g_signal_handlers_disconnect_by_func(g_network_monitor_get_default, |
|
cbf9ccc715ab
Move everything in libpurple that was using the network-changed signal to use the gio one
Gary Kramlich <grim@reaperworld.com>
parents:
36114
diff
changeset
|
221 | G_CALLBACK(winpidgin_netconfig_changed_cb), |
|
cbf9ccc715ab
Move everything in libpurple that was using the network-changed signal to use the gio one
Gary Kramlich <grim@reaperworld.com>
parents:
36114
diff
changeset
|
222 | 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
|
223 | 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
|
224 | 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
|
225 | |
|
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
|
226 | 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
|
227 | |
|
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
|
228 | 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
|
229 | 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
|
230 | } 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
|
231 | 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
|
232 | 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
|
233 | } |
|
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 | |
|
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 | 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
|
236 | } |
|
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 | |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
238 | 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
|
239 | |
|
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
|
240 | if (msg == PIDGIN_WM_FOCUS_REQUEST) { |
|
39333
2da5959eb42c
pidgin: Use gtk_window_present() to present buddy list
Mike Ruprecht <cmaiku@gmail.com>
parents:
38628
diff
changeset
|
241 | PidginBuddyList *blist; |
| 15884 | 242 | purple_debug_info("winpidgin", "Got external Buddy List focus request."); |
|
39333
2da5959eb42c
pidgin: Use gtk_window_present() to present buddy list
Mike Ruprecht <cmaiku@gmail.com>
parents:
38628
diff
changeset
|
243 | blist = pidgin_blist_get_default_gtk_blist(); |
|
2da5959eb42c
pidgin: Use gtk_window_present() to present buddy list
Mike Ruprecht <cmaiku@gmail.com>
parents:
38628
diff
changeset
|
244 | if (blist != NULL && blist->window != NULL) { |
|
2da5959eb42c
pidgin: Use gtk_window_present() to present buddy list
Mike Ruprecht <cmaiku@gmail.com>
parents:
38628
diff
changeset
|
245 | gtk_window_present(GTK_WINDOW(blist->window)); |
|
2da5959eb42c
pidgin: Use gtk_window_present() to present buddy list
Mike Ruprecht <cmaiku@gmail.com>
parents:
38628
diff
changeset
|
246 | } |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
247 | 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
|
248 | } 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
|
249 | char *proto_msg = (char *) lparam; |
| 15884 | 250 | purple_debug_info("winpidgin", "Got protocol handler request: %s\n", proto_msg ? proto_msg : ""); |
| 251 | 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
|
252 | 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
|
253 | } 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
|
254 | 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
|
255 | 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
|
256 | 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
|
257 | } 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
|
258 | 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
|
259 | |
|
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
|
260 | 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
|
261 | |
|
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
|
262 | 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
|
263 | 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
|
264 | |
|
37489
cbf9ccc715ab
Move everything in libpurple that was using the network-changed signal to use the gio one
Gary Kramlich <grim@reaperworld.com>
parents:
36114
diff
changeset
|
265 | g_signal_connect(g_network_monitor_get_default(), |
|
cbf9ccc715ab
Move everything in libpurple that was using the network-changed signal to use the gio one
Gary Kramlich <grim@reaperworld.com>
parents:
36114
diff
changeset
|
266 | "network-changed", |
|
cbf9ccc715ab
Move everything in libpurple that was using the network-changed signal to use the gio one
Gary Kramlich <grim@reaperworld.com>
parents:
36114
diff
changeset
|
267 | G_CALLBACK(winpidgin_netconfig_changed_cb), |
|
cbf9ccc715ab
Move everything in libpurple that was using the network-changed signal to use the gio one
Gary Kramlich <grim@reaperworld.com>
parents:
36114
diff
changeset
|
268 | 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
|
269 | |
|
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
|
270 | 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
|
271 | } 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
|
272 | 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
|
273 | /* TODO: It seems like it'd be wise to use the NLA message, if possible, instead of this. */ |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37901
diff
changeset
|
274 | g_timeout_add_seconds(1, winpidgin_pwm_reconnect, 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
|
275 | 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
|
276 | } |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
277 | } |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
278 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
279 | return DefWindowProc(hwnd, msg, wparam, lparam); |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
280 | } |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
281 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
282 | static HWND winpidgin_message_window_init(void) { |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
283 | HWND win_hwnd; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
284 | WNDCLASSEX wcx; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
285 | LPCTSTR wname; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
286 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
287 | wname = TEXT("WinpidginMsgWinCls"); |
|
14319
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 | wcx.cbSize = sizeof(wcx); |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
290 | wcx.style = 0; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
291 | wcx.lpfnWndProc = message_window_handler; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
292 | wcx.cbClsExtra = 0; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
293 | 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
|
294 | wcx.hInstance = winpidgin_exe_hinstance(); |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
295 | wcx.hIcon = NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
296 | wcx.hCursor = NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
297 | wcx.hbrBackground = NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
298 | wcx.lpszMenuName = NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
299 | wcx.lpszClassName = wname; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
300 | wcx.hIconSm = NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
301 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
302 | RegisterClassEx(&wcx); |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
303 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
304 | /* Create the window */ |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
305 | 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
|
306 | NULL, NULL, winpidgin_exe_hinstance(), 0))) { |
| 15884 | 307 | purple_debug_error("winpidgin", |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
308 | "Unable to create message window.\n"); |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
309 | return NULL; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
310 | } |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
311 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
312 | return win_hwnd; |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
313 | } |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
314 | |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
315 | static gboolean stop_flashing(GtkWidget *widget, GdkEventFocus *event, gpointer data) { |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
316 | 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
|
317 | 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
|
318 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
319 | 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
|
320 | |
|
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
|
321 | 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
|
322 | 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
|
323 | 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
|
324 | } |
|
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
|
325 | |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
326 | return FALSE; |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
327 | } |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
328 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
329 | void |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
330 | winpidgin_window_flash(GtkWindow *window, gboolean flash) { |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
331 | GdkWindow * gdkwin; |
|
29740
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
332 | FLASHWINFO info; |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
333 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
334 | g_return_if_fail(window != NULL); |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
335 | |
|
35869
184849af4d62
cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35858
diff
changeset
|
336 | gdkwin = gtk_widget_get_window(GTK_WIDGET(window)); |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
337 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
338 | g_return_if_fail(GDK_IS_WINDOW(gdkwin)); |
|
35869
184849af4d62
cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35858
diff
changeset
|
339 | g_return_if_fail(gdk_window_get_window_type(gdkwin) != GDK_WINDOW_CHILD); |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
340 | |
|
35869
184849af4d62
cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35858
diff
changeset
|
341 | if (gdk_window_is_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
|
342 | return; |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
343 | |
|
29740
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
344 | memset(&info, 0, sizeof(FLASHWINFO)); |
|
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
345 | info.cbSize = sizeof(FLASHWINFO); |
|
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
346 | info.hwnd = GDK_WINDOW_HWND(gdkwin); |
|
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
347 | if (flash) { |
|
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
348 | DWORD flashCount; |
|
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
349 | info.uCount = 3; |
|
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
350 | if (SystemParametersInfo(SPI_GETFOREGROUNDFLASHCOUNT, 0, &flashCount, 0)) |
|
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
351 | info.uCount = flashCount; |
|
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
352 | info.dwFlags = FLASHW_ALL | FLASHW_TIMER; |
|
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
353 | } else |
|
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
354 | info.dwFlags = FLASHW_STOP; |
|
30251
e443d0b07a3f
Fix a regression in 2.7.0 that caused window flashing not to work on Windows.
Daniel Atallah <datallah@pidgin.im>
parents:
29767
diff
changeset
|
355 | FlashWindowEx(&info); |
|
29740
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
356 | info.dwTimeout = 0; |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
357 | |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
358 | } |
|
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
359 | |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
360 | void |
| 36114 | 361 | winpidgin_conv_blink(PurpleConversation *conv) { |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35605
diff
changeset
|
362 | PidginConvWindow *win; |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
363 | GtkWindow *window; |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
364 | |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
365 | if(conv == NULL) { |
| 15884 | 366 | purple_debug_info("winpidgin", "No conversation found to blink.\n"); |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
367 | return; |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
368 | } |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
369 | |
| 15563 | 370 | win = pidgin_conv_get_window(PIDGIN_CONVERSATION(conv)); |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
371 | if(win == NULL) { |
| 15884 | 372 | 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
|
373 | return; |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
374 | } |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
375 | window = GTK_WINDOW(win->window); |
|
14857
835b4926932f
[gaim-migrate @ 17560]
Daniel Atallah <datallah@pidgin.im>
parents:
14762
diff
changeset
|
376 | |
|
16345
b30ad1087fc3
Don't flash the conv. window if it is in the foreground.
Daniel Atallah <datallah@pidgin.im>
parents:
16123
diff
changeset
|
377 | /* Don't flash if the window is in the foreground */ |
|
35869
184849af4d62
cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35858
diff
changeset
|
378 | if (GetForegroundWindow() == |
|
184849af4d62
cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35858
diff
changeset
|
379 | GDK_WINDOW_HWND(gtk_widget_get_window(GTK_WIDGET(window)))) |
|
184849af4d62
cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35858
diff
changeset
|
380 | { |
|
16345
b30ad1087fc3
Don't flash the conv. window if it is in the foreground.
Daniel Atallah <datallah@pidgin.im>
parents:
16123
diff
changeset
|
381 | return; |
|
35869
184849af4d62
cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35858
diff
changeset
|
382 | } |
|
16345
b30ad1087fc3
Don't flash the conv. window if it is in the foreground.
Daniel Atallah <datallah@pidgin.im>
parents:
16123
diff
changeset
|
383 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
384 | winpidgin_window_flash(window, TRUE); |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15298
diff
changeset
|
385 | /* 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
|
386 | 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
|
387 | 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
|
388 | 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
|
389 | 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
|
390 | } |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
391 | } |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
392 | |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
393 | static gboolean |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35912
diff
changeset
|
394 | winpidgin_conv_im_blink(PurpleConversation *conv, PurpleMessage *pmsg) |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
395 | { |
| 36114 | 396 | /* Don't flash for our own messages or system messages */ |
| 397 | if (purple_message_get_flags(pmsg) & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_SYSTEM)) | |
| 398 | return FALSE; | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16058
diff
changeset
|
399 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/win32/blink_im")) |
| 36114 | 400 | winpidgin_conv_blink(conv); |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
401 | return FALSE; |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
402 | } |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
403 | |
| 35605 | 404 | void winpidgin_init(void) { |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
30793
diff
changeset
|
405 | typedef void (__cdecl* LPFNSETLOGFILE)(const LPCSTR); |
|
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
30793
diff
changeset
|
406 | LPFNSETLOGFILE MySetLogFile; |
|
30739
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
30734
diff
changeset
|
407 | gchar *exchndl_dll_path; |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
408 | |
|
33960
ce450446c56a
Win32: strengthen DLL loading; VV: fix farstream plugins loading on win32
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33898
diff
changeset
|
409 | if (purple_debug_is_verbose()) |
|
ce450446c56a
Win32: strengthen DLL loading; VV: fix farstream plugins loading on win32
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33898
diff
changeset
|
410 | purple_debug_misc("winpidgin", "winpidgin_init start\n"); |
| 14286 | 411 | |
|
35901
5bcb306a4edf
cross-win32: FHS support for win32
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35892
diff
changeset
|
412 | exchndl_dll_path = g_build_filename(wpurple_bin_dir(), "exchndl.dll", NULL); |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
30793
diff
changeset
|
413 | MySetLogFile = (LPFNSETLOGFILE) wpurple_find_and_loadproc(exchndl_dll_path, "SetLogFile"); |
|
30739
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
30734
diff
changeset
|
414 | g_free(exchndl_dll_path); |
|
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
30734
diff
changeset
|
415 | exchndl_dll_path = NULL; |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
30793
diff
changeset
|
416 | if (MySetLogFile) { |
|
29767
6b53ccad9d4a
Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents:
29740
diff
changeset
|
417 | gchar *debug_dir, *locale_debug_dir; |
|
30734
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
418 | |
|
39957
be2eb199e368
Move Windows crash reports to cache directory.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39333
diff
changeset
|
419 | debug_dir = g_build_filename(purple_cache_dir(), "pidgin.RPT", NULL); |
|
29767
6b53ccad9d4a
Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents:
29740
diff
changeset
|
420 | locale_debug_dir = g_locale_from_utf8(debug_dir, -1, NULL, NULL, NULL); |
|
6b53ccad9d4a
Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents:
29740
diff
changeset
|
421 | |
|
6b53ccad9d4a
Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents:
29740
diff
changeset
|
422 | purple_debug_info("winpidgin", "Setting exchndl.dll LogFile to %s\n", debug_dir); |
|
6b53ccad9d4a
Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents:
29740
diff
changeset
|
423 | |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
30793
diff
changeset
|
424 | MySetLogFile(locale_debug_dir); |
|
29767
6b53ccad9d4a
Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents:
29740
diff
changeset
|
425 | |
|
6b53ccad9d4a
Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents:
29740
diff
changeset
|
426 | g_free(debug_dir); |
|
6b53ccad9d4a
Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents:
29740
diff
changeset
|
427 | g_free(locale_debug_dir); |
|
6b53ccad9d4a
Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents:
29740
diff
changeset
|
428 | } |
|
6b53ccad9d4a
Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents:
29740
diff
changeset
|
429 | |
|
33960
ce450446c56a
Win32: strengthen DLL loading; VV: fix farstream plugins loading on win32
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33898
diff
changeset
|
430 | purple_debug_info("winpidgin", "GTK+: %u.%u.%u\n", |
| 14286 | 431 | gtk_major_version, gtk_minor_version, gtk_micro_version); |
| 432 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
433 | messagewin_hwnd = winpidgin_message_window_init(); |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
434 | |
|
33960
ce450446c56a
Win32: strengthen DLL loading; VV: fix farstream plugins loading on win32
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33898
diff
changeset
|
435 | if (purple_debug_is_verbose()) |
|
ce450446c56a
Win32: strengthen DLL loading; VV: fix farstream plugins loading on win32
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33898
diff
changeset
|
436 | purple_debug_misc("winpidgin", "winpidgin_init end\n"); |
| 14286 | 437 | } |
| 438 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
439 | void winpidgin_post_init(void) { |
|
14762
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
440 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16058
diff
changeset
|
441 | 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
|
442 | 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
|
443 | |
| 15884 | 444 | purple_signal_connect(pidgin_conversations_get_handle(), |
| 445 | "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
|
446 | NULL); |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
447 | |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
448 | } |
|
f494a5f12981
[gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents:
14636
diff
changeset
|
449 | |
| 14286 | 450 | /* Windows Cleanup */ |
| 451 | ||
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15563
diff
changeset
|
452 | void winpidgin_cleanup(void) { |
| 15884 | 453 | purple_debug_info("winpidgin", "winpidgin_cleanup\n"); |
|
14319
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
454 | |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
455 | if(messagewin_hwnd) |
|
b9a35c4948dc
[gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
456 | DestroyWindow(messagewin_hwnd); |
| 14286 | 457 | |
| 458 | } | |
| 459 | ||
| 460 | /* DLL initializer */ | |
|
15697
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15678
diff
changeset
|
461 | /* suppress gcc "no previous prototype" warning */ |
|
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15678
diff
changeset
|
462 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
463 | 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
|
464 | dll_hInstance = hinstDLL; |
| 14286 | 465 | return TRUE; |
| 466 | } | |
|
14636
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 | static gboolean |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
469 | get_WorkingAreaRectForWindow(HWND hwnd, RECT *workingAreaRc) { |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
470 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
471 | HMONITOR monitor; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
472 | MONITORINFO info; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
473 | |
|
29740
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
474 | monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
475 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
476 | info.cbSize = sizeof(info); |
|
29740
d3333cd60e45
Avoid looking up functions by name that will be present on all supported Windows versions.
Daniel Atallah <datallah@pidgin.im>
parents:
29701
diff
changeset
|
477 | if(!GetMonitorInfo(monitor, &info)) |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
478 | return FALSE; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
479 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
480 | CopyRect(workingAreaRc, &(info.rcWork)); |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
481 | return TRUE; |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
482 | } |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
483 | |
|
37565
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
484 | typedef HRESULT (WINAPI* DwmIsCompositionEnabledFunction)(BOOL*); |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
485 | typedef HRESULT (WINAPI* DwmGetWindowAttributeFunction)(HWND, DWORD, PVOID, DWORD); |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
486 | static HMODULE dwmapi_module = NULL; |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
487 | static DwmIsCompositionEnabledFunction DwmIsCompositionEnabled = NULL; |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
488 | static DwmGetWindowAttributeFunction DwmGetWindowAttribute = NULL; |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
489 | #ifndef DWMWA_EXTENDED_FRAME_BOUNDS |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
490 | # define DWMWA_EXTENDED_FRAME_BOUNDS 9 |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
491 | #endif |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
492 | |
|
39999
2f878969929d
Stop returning structs directly from Windows functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39333
diff
changeset
|
493 | static void |
|
2f878969929d
Stop returning structs directly from Windows functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39333
diff
changeset
|
494 | get_actualWindowRect(HWND hwnd, RECT *winR) |
|
37565
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
495 | { |
|
39999
2f878969929d
Stop returning structs directly from Windows functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39333
diff
changeset
|
496 | GetWindowRect(hwnd, winR); |
|
37778
694ec370d84a
Fix what looks like a buggered merge that got introduced in fa3c41b69e47.
Daniel Atallah <datallah@pidgin.im>
parents:
37565
diff
changeset
|
497 | |
|
37565
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
498 | if (dwmapi_module == NULL) { |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
499 | dwmapi_module = GetModuleHandleW(L"dwmapi.dll"); |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
500 | if (dwmapi_module != NULL) { |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
501 | DwmIsCompositionEnabled = (DwmIsCompositionEnabledFunction) GetProcAddress(dwmapi_module, "DwmIsCompositionEnabled"); |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
502 | DwmGetWindowAttribute = (DwmGetWindowAttributeFunction) GetProcAddress(dwmapi_module, "DwmGetWindowAttribute"); |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
503 | } |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
504 | } |
|
37778
694ec370d84a
Fix what looks like a buggered merge that got introduced in fa3c41b69e47.
Daniel Atallah <datallah@pidgin.im>
parents:
37565
diff
changeset
|
505 | |
|
37565
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
506 | if (DwmIsCompositionEnabled != NULL && DwmGetWindowAttribute != NULL) { |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
507 | BOOL pfEnabled; |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
508 | if (SUCCEEDED(DwmIsCompositionEnabled(&pfEnabled))) { |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
509 | RECT tempR; |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
510 | if (SUCCEEDED(DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &tempR, sizeof(tempR)))) { |
|
39999
2f878969929d
Stop returning structs directly from Windows functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39333
diff
changeset
|
511 | *winR = tempR; |
|
37565
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
512 | } |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
513 | } |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
514 | } |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
515 | } |
|
fa3c41b69e47
win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents:
37507
diff
changeset
|
516 | |
|
37778
694ec370d84a
Fix what looks like a buggered merge that got introduced in fa3c41b69e47.
Daniel Atallah <datallah@pidgin.im>
parents:
37565
diff
changeset
|
517 | void winpidgin_ensure_onscreen(GtkWidget *win) { |
|
694ec370d84a
Fix what looks like a buggered merge that got introduced in fa3c41b69e47.
Daniel Atallah <datallah@pidgin.im>
parents:
37565
diff
changeset
|
518 | RECT winR, wAR, intR; |
|
35869
184849af4d62
cross-win32: fix gtk3 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35858
diff
changeset
|
519 | HWND hwnd = GDK_WINDOW_HWND(gtk_widget_get_window(win)); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
520 | |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
521 | g_return_if_fail(hwnd != NULL); |
|
39999
2f878969929d
Stop returning structs directly from Windows functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39333
diff
changeset
|
522 | get_actualWindowRect(hwnd, &winR); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
523 | |
| 15884 | 524 | purple_debug_info("win32placement", |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
525 | "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
|
526 | winR.left, winR.right, |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
527 | winR.top, winR.bottom); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
528 | |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
529 | if(!get_WorkingAreaRectForWindow(hwnd, &wAR)) { |
| 15884 | 530 | purple_debug_info("win32placement", |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
531 | "Couldn't get multimonitor working area\n"); |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
532 | if(!SystemParametersInfo(SPI_GETWORKAREA, 0, &wAR, FALSE)) { |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
533 | /* I don't think this will ever happen */ |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
534 | wAR.left = 0; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
535 | wAR.top = 0; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
536 | wAR.bottom = GetSystemMetrics(SM_CYSCREEN); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
537 | wAR.right = GetSystemMetrics(SM_CXSCREEN); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
538 | } |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
539 | } |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
540 | |
| 15884 | 541 | purple_debug_info("win32placement", |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
542 | "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
|
543 | wAR.left, wAR.right, |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
544 | wAR.top, wAR.bottom); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
545 | |
|
20138
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
546 | /** 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
|
547 | if(!(IntersectRect(&intR, &winR, &wAR) |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
548 | && EqualRect(&intR, &winR))) { |
| 15884 | 549 | purple_debug_info("win32placement", |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
550 | "conversation window out of working area, relocating\n"); |
|
20138
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 | /* Make sure the working area is big enough. */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
553 | if ((winR.right - winR.left) <= (wAR.right - wAR.left) |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
554 | && (winR.bottom - winR.top) <= (wAR.bottom - wAR.top)) { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
555 | /* Is it off the bottom? */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
556 | if (winR.bottom > wAR.bottom) { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
557 | winR.top = wAR.bottom - (winR.bottom - winR.top); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
558 | winR.bottom = wAR.bottom; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
559 | } |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
560 | /* Is it off the top? */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
561 | else if (winR.top < wAR.top) { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
562 | winR.bottom = wAR.top + (winR.bottom - winR.top); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
563 | winR.top = wAR.top; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
564 | } |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
565 | |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
566 | /* Is it off the left? */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
567 | if (winR.left < wAR.left) { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
568 | winR.right = wAR.left + (winR.right - winR.left); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
569 | winR.left = wAR.left; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
570 | } |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
571 | /* Is it off the right? */ |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
572 | else if (winR.right > wAR.right) { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
573 | winR.left = wAR.right - (winR.right - winR.left); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
574 | winR.right = wAR.right; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
575 | } |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
576 | |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
577 | } else { |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
578 | /* 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
|
579 | winR.right = wAR.left + (winR.right - winR.left); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
580 | winR.bottom = wAR.top + (winR.bottom - winR.top); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
581 | winR.left = wAR.left; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
582 | winR.top = wAR.top; |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
583 | } |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
584 | |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
585 | purple_debug_info("win32placement", |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
586 | "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
|
587 | winR.left, winR.right, |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
588 | winR.top, winR.bottom); |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
589 | |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
590 | MoveWindow(hwnd, winR.left, winR.top, |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
591 | (winR.right - winR.left), |
|
9d157e9beff9
applied changes from 1036f20a46ec1ba10dd2519fd09b44a607cdf202
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
592 | (winR.bottom - winR.top), TRUE); |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
593 | } |
|
30734
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
594 | |
|
14636
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
595 | } |
|
5306c329992c
[gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents:
14319
diff
changeset
|
596 | |
|
30734
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
597 | DWORD winpidgin_get_lastactive() { |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
598 | DWORD result = 0; |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
599 | |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
600 | LASTINPUTINFO lii; |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
601 | memset(&lii, 0, sizeof(lii)); |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
602 | lii.cbSize = sizeof(lii); |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
603 | if (GetLastInputInfo(&lii)) |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
604 | result = lii.dwTime; |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
605 | |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
606 | return result; |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
607 | } |
|
caafb5a4e95b
Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents:
30251
diff
changeset
|
608 |