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