pidgin/win32/gtkwin32dep.c

Fri, 04 Apr 2014 16:32:22 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Fri, 04 Apr 2014 16:32:22 +0200
changeset 35750
db721872a325
parent 35610
24b06c5e7760
child 35857
b7fc060d5c94
permissions
-rw-r--r--

Remote smileys: display them

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

mercurial