pidgin/win32/gtkwin32dep.c

Mon, 12 Sep 2022 22:08:59 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 12 Sep 2022 22:08:59 -0500
changeset 41679
ddd97cdcbefc
parent 41605
2e2adf4729e7
child 41840
fe350460fb1c
permissions
-rw-r--r--

Remove the list_icon vfunc from PurpleProtocol.

This was replaced by the icon-name, icon-resource-path, and icon-search-path
properties.

Testing Done:
Compiled

Reviewed at https://reviews.imfreedom.org/r/1749/

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
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
5 *
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
9 * (at your option) any later version.
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
10 *
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
14 * GNU General Public License for more details.
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
15 *
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
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
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
19 *
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
20 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
21 #include <io.h>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
22 #include <stdlib.h>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
23 #include <stdio.h>
41198
b5b1bffc48fb Random Windows tweaks
Gary Kramlich <grim@reaperworld.com>
parents: 41087
diff changeset
24
b5b1bffc48fb Random Windows tweaks
Gary Kramlich <grim@reaperworld.com>
parents: 41087
diff changeset
25 /* winsock2.h needs to be include before windows.h or else it throws a warning
b5b1bffc48fb Random Windows tweaks
Gary Kramlich <grim@reaperworld.com>
parents: 41087
diff changeset
26 * saying it needs to be included first. We don't use it directly but it's
b5b1bffc48fb Random Windows tweaks
Gary Kramlich <grim@reaperworld.com>
parents: 41087
diff changeset
27 * included indirectly.
b5b1bffc48fb Random Windows tweaks
Gary Kramlich <grim@reaperworld.com>
parents: 41087
diff changeset
28 */
b5b1bffc48fb Random Windows tweaks
Gary Kramlich <grim@reaperworld.com>
parents: 41087
diff changeset
29 #include <winsock2.h>
40669
48dfed6f4f1f Fix Windows builds and tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40555
diff changeset
30 #include <windows.h>
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
31 #include <winuser.h>
35892
02bf3200b9cb cross-win32: make use of WIN32_LEAN_AND_MEAN define
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35891
diff changeset
32 #include <shellapi.h>
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
33
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
34 #include <glib.h>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
35 #include <glib/gstdio.h>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
36 #include <gtk/gtk.h>
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
37
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 40001
diff changeset
38 #include <purple.h>
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
39
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
40 #include "resource.h"
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
41
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
42 #include "gtkwin32dep.h"
39333
2da5959eb42c pidgin: Use gtk_window_present() to present buddy list
Mike Ruprecht <cmaiku@gmail.com>
parents: 38628
diff changeset
43 #include "gtkblist.h"
14762
f494a5f12981 [gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents: 14636
diff changeset
44 #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
45 #include "gtkconn.h"
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
46
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
47 /*
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
48 * GLOBALS
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
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
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
54 static gboolean pwm_handles_connections = TRUE;
14762
f494a5f12981 [gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents: 14636
diff changeset
55
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
56
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
57 /*
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
58 * PUBLIC CODE
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
59 */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
60
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
61 HINSTANCE winpidgin_exe_hinstance(void) {
15574
18d9d1c05994 Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents: 15563
diff changeset
62 return exe_hInstance;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
63 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
64
35605
8a0ae6cc73fc Fix win32 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33960
diff changeset
65 void winpidgin_set_exe_hinstance(HINSTANCE hint)
8a0ae6cc73fc Fix win32 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33960
diff changeset
66 {
8a0ae6cc73fc Fix win32 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33960
diff changeset
67 exe_hInstance = hint;
8a0ae6cc73fc Fix win32 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33960
diff changeset
68 }
8a0ae6cc73fc Fix win32 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33960
diff changeset
69
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
70 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
71 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
72 }
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
15574
18d9d1c05994 Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents: 15563
diff changeset
74 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
75 GFile *fin;
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
76 GFile *fout;
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
77 GInputStream *input;
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
78 GOutputStream *output;
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
79 GOutputStream *conv_out;
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
80 GZlibDecompressor *decompressor;
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
81 gssize size;
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
82 GError *error = NULL;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
83
38628
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
84 fin = g_file_new_for_path(in);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
85 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
86 g_object_unref(fin);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
87
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
88 if (input == NULL) {
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
89 purple_debug_error("winpidgin_gz_decompress",
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
90 "Failed to open: %s: %s\n",
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
91 in, error->message);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
92 g_clear_error(&error);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
93 return 0;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
94 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
95
38628
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
96 fout = g_file_new_for_path(out);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
97 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
98 G_FILE_CREATE_NONE, NULL, &error));
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
99 g_object_unref(fout);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
100
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
101 if (output == NULL) {
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
102 purple_debug_error("winpidgin_gz_decompress",
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
103 "Error opening file: %s: %s\n",
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
104 out, error->message);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
105 g_clear_error(&error);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
106 g_object_unref(input);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
107 return 0;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
108 }
38628
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
109
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
110 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
111 conv_out = g_converter_output_stream_new(output,
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
112 G_CONVERTER(decompressor));
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
113 g_object_unref(decompressor);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
114 g_object_unref(output);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
115
38628
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
116 size = g_output_stream_splice(conv_out, input,
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
117 G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE |
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
118 G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, NULL, &error);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
119
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
120 g_object_unref(input);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
121 g_object_unref(conv_out);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
122
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
123 if (size < 0) {
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
124 purple_debug_error("wpurple_gz_decompress",
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
125 "Error writing to file: %s\n",
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
126 error->message);
ea61e3b679a7 gtkwin32dep: Port gz decompression to GZlibDecompressor
Mike Ruprecht <cmaiku@gmail.com>
parents: 38553
diff changeset
127 g_clear_error(&error);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
128 return 0;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
129 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
130
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
131 return 1;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
132 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
133
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
134 #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
135 #define PIDGIN_WM_PROTOCOL_HANDLE (WM_APP + 14)
14319
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
136
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
137 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
138 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
139 {
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
140 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
141
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
142 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
143 }
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
144
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
145 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
146 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
147 {
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
148 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
149 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
150 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
151 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
152 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
153
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
154 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
155
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
156 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
157 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
158 } 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
159 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
160 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
161 }
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
162
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
163 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
164 }
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
165
14319
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
166 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
167
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
168 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
169 PidginBuddyList *blist;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
170 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
171 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
172 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
173 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
174 }
14319
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
175 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
176 } 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
177 char *proto_msg = (char *) lparam;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
178 purple_debug_info("winpidgin", "Got protocol handler request: %s\n", proto_msg ? proto_msg : "");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
179 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
180 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
181 } 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
182 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
183 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
184 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
185 } 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
186 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
187
8a938e6ea033 This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents: 21613
diff changeset
188 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
189
8a938e6ea033 This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents: 21613
diff changeset
190 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
191 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
192
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
193 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
194 "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
195 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
196 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
197
8a938e6ea033 This is a great patch from Lee Roach to make Pidgin on win32 deal with system suspend / resume. It seems to work really well, hopefully this'll make some folks happy. If something doesn't work right, it is probably my fault. Fixes #480.
Daniel Atallah <datallah@pidgin.im>
parents: 21613
diff changeset
198 return 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
199 } 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
200 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
201 /* 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
202 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
203 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
204 }
14319
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
205 }
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
206
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
207 return DefWindowProc(hwnd, msg, wparam, lparam);
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
208 }
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
209
15574
18d9d1c05994 Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents: 15563
diff changeset
210 static HWND winpidgin_message_window_init(void) {
14319
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
211 HWND win_hwnd;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
212 WNDCLASSEX wcx;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
213 LPCTSTR wname;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
214
15574
18d9d1c05994 Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents: 15563
diff changeset
215 wname = TEXT("WinpidginMsgWinCls");
14319
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
216
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
217 wcx.cbSize = sizeof(wcx);
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
218 wcx.style = 0;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
219 wcx.lpfnWndProc = message_window_handler;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
220 wcx.cbClsExtra = 0;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
221 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
222 wcx.hInstance = winpidgin_exe_hinstance();
14319
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
223 wcx.hIcon = NULL;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
224 wcx.hCursor = NULL;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
225 wcx.hbrBackground = NULL;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
226 wcx.lpszMenuName = NULL;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
227 wcx.lpszClassName = wname;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
228 wcx.hIconSm = NULL;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
229
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
230 RegisterClassEx(&wcx);
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
231
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
232 /* Create the window */
15574
18d9d1c05994 Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents: 15563
diff changeset
233 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
234 NULL, NULL, winpidgin_exe_hinstance(), 0))) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
235 purple_debug_error("winpidgin",
14319
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
236 "Unable to create message window.\n");
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
237 return NULL;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
238 }
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
239
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
240 return win_hwnd;
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
241 }
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
242
35605
8a0ae6cc73fc Fix win32 build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33960
diff changeset
243 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
244 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
245 LPFNSETLOGFILE MySetLogFile;
30739
72613eff8b0e Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents: 30734
diff changeset
246 gchar *exchndl_dll_path;
14762
f494a5f12981 [gaim-migrate @ 17452]
Daniel Atallah <datallah@pidgin.im>
parents: 14636
diff changeset
247
33960
ce450446c56a Win32: strengthen DLL loading; VV: fix farstream plugins loading on win32
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33898
diff changeset
248 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
249 purple_debug_misc("winpidgin", "winpidgin_init start\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
250
35901
5bcb306a4edf cross-win32: FHS support for win32
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35892
diff changeset
251 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
252 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
253 g_free(exchndl_dll_path);
72613eff8b0e Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents: 30734
diff changeset
254 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
255 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
256 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
257
39957
be2eb199e368 Move Windows crash reports to cache directory.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39333
diff changeset
258 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
259 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
260
6b53ccad9d4a Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents: 29740
diff changeset
261 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
262
33371
6d93866a4a3f Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents: 30793
diff changeset
263 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
264
6b53ccad9d4a Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents: 29740
diff changeset
265 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
266 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
267 }
6b53ccad9d4a Make Pidgin set the exchndl.dll log file to ~/.purple/pidgin.RPT
Daniel Atallah <datallah@pidgin.im>
parents: 29740
diff changeset
268
15574
18d9d1c05994 Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents: 15563
diff changeset
269 messagewin_hwnd = winpidgin_message_window_init();
14319
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
270
33960
ce450446c56a Win32: strengthen DLL loading; VV: fix farstream plugins loading on win32
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33898
diff changeset
271 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
272 purple_debug_misc("winpidgin", "winpidgin_init end\n");
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
273 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
274
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
275 /* Windows Cleanup */
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
276
15574
18d9d1c05994 Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents: 15563
diff changeset
277 void winpidgin_cleanup(void) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15697
diff changeset
278 purple_debug_info("winpidgin", "winpidgin_cleanup\n");
14319
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
279
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
280 if(messagewin_hwnd)
b9a35c4948dc [gaim-migrate @ 16939]
Daniel Atallah <datallah@pidgin.im>
parents: 14286
diff changeset
281 DestroyWindow(messagewin_hwnd);
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
282
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
283 }
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
284
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
285 /* DLL initializer */
15697
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15678
diff changeset
286 /* suppress gcc "no previous prototype" warning */
78ddac185d80 winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15678
diff changeset
287 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
14636
5306c329992c [gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents: 14319
diff changeset
288 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
289 dll_hInstance = hinstDLL;
14286
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
290 return TRUE;
9ff15ceacd34 [gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
291 }
14636
5306c329992c [gaim-migrate @ 17298]
Daniel Atallah <datallah@pidgin.im>
parents: 14319
diff changeset
292
37565
fa3c41b69e47 win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents: 37507
diff changeset
293 typedef HRESULT (WINAPI* DwmIsCompositionEnabledFunction)(BOOL*);
fa3c41b69e47 win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents: 37507
diff changeset
294 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
295 #ifndef DWMWA_EXTENDED_FRAME_BOUNDS
fa3c41b69e47 win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents: 37507
diff changeset
296 # 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
297 #endif
fa3c41b69e47 win32: Fix window placement on Windows >= Vista. Fixes #16830
Eion Robb <eion@robbmob.com>
parents: 37507
diff changeset
298
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
299 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
300 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
301
caafb5a4e95b Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents: 30251
diff changeset
302 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
303 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
304 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
305 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
306 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
307
caafb5a4e95b Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents: 30251
diff changeset
308 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
309 }
caafb5a4e95b Kill the win32 idle tracking code that works on old windows versions and move
Daniel Atallah <datallah@pidgin.im>
parents: 30251
diff changeset
310

mercurial