Mercurial > pidgin.yaz
annotate gtk/win32/gtkwin32dep.c @ 15282:5d53e67c2512
[gaim-migrate @ 18071]
updated potfiles.in from Jochen Kemnade
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 04 Jan 2007 17:11:48 +0000 |
parents | 2bcb8684bfb5 |
children | 03edbb70210f |
rev | line source |
---|---|
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
1 /* |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
2 * gaim |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
3 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
4 * File: gtkwin32dep.c |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
5 * Date: June, 2002 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
6 * Description: Windows dependant code for Gaim |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
7 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
8 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
9 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
14 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
19 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
23 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
24 */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
25 #define _WIN32_IE 0x500 |
14574
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
26 #ifndef WINVER |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
27 #define WINVER 0x0500 /* W2K */ |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
28 #endif |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
29 #include <windows.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
30 #include <io.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
31 #include <stdlib.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
32 #include <stdio.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
33 #include <winuser.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
34 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
35 #include <glib.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
36 #include <glib/gstdio.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
37 #include <gtk/gtk.h> |
14574
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
38 #include <gdk/gdkwin32.h> |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
39 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
40 #include "debug.h" |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
41 #include "notify.h" |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
42 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
43 #include "resource.h" |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
44 #include "idletrack.h" |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
45 #include "zlib.h" |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
46 #include "untar.h" |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
47 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
48 #include <libintl.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
49 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
50 #include "gtkwin32dep.h" |
14574
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
51 #include "win32dep.h" |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
52 #include "gtkconv.h" |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
53 #include "wspell.h" |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
54 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
55 /* |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
56 * GLOBALS |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
57 */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
58 HINSTANCE gaimexe_hInstance = 0; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
59 HINSTANCE gtkgaimdll_hInstance = 0; |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
60 HWND messagewin_hwnd; |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
61 static int gtkwin32_handle; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
62 |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
63 typedef BOOL (CALLBACK* LPFNFLASHWINDOWEX)(PFLASHWINFO); |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
64 static LPFNFLASHWINDOWEX MyFlashWindowEx = NULL; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
65 |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
66 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
67 /* |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
68 * PUBLIC CODE |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
69 */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
70 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
71 HINSTANCE gtkwgaim_hinstance(void) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
72 return gaimexe_hInstance; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
73 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
74 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
75 int gtkwgaim_gz_decompress(const char* in, const char* out) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
76 gzFile fin; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
77 FILE *fout; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
78 char buf[1024]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
79 int ret; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
80 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
81 if((fin = gzopen(in, "rb"))) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
82 if(!(fout = g_fopen(out, "wb"))) { |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
83 gaim_debug_error("gtkwgaim_gz_decompress", "Error opening file: %s\n", out); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
84 gzclose(fin); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
85 return 0; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
86 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
87 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
88 else { |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
89 gaim_debug_error("gtkwgaim_gz_decompress", "gzopen failed to open: %s\n", in); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
90 return 0; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
91 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
92 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
93 while((ret = gzread(fin, buf, 1024))) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
94 if(fwrite(buf, 1, ret, fout) < ret) { |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
95 gaim_debug_error("wgaim_gz_decompress", "Error writing %d bytes to file\n", ret); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
96 gzclose(fin); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
97 fclose(fout); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
98 return 0; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
99 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
100 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
101 fclose(fout); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
102 gzclose(fin); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
103 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
104 if(ret < 0) { |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
105 gaim_debug_error("gtkwgaim_gz_decompress", "gzread failed while reading: %s\n", in); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
106 return 0; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
107 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
108 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
109 return 1; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
110 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
111 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
112 int gtkwgaim_gz_untar(const char* filename, const char* destdir) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
113 char tmpfile[_MAX_PATH]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
114 char template[]="wgaimXXXXXX"; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
115 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
116 sprintf(tmpfile, "%s%s%s", g_get_tmp_dir(), G_DIR_SEPARATOR_S, _mktemp(template)); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
117 if(gtkwgaim_gz_decompress(filename, tmpfile)) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
118 int ret; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
119 if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET)) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
120 ret = 1; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
121 else { |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
122 gaim_debug_error("gtkwgaim_gz_untar", "Failure untarring %s\n", tmpfile); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
123 ret = 0; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
124 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
125 g_unlink(tmpfile); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
126 return ret; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
127 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
128 else { |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
129 gaim_debug_error("gtkwgaim_gz_untar", "Failed to gz decompress %s\n", filename); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
130 return 0; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
131 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
132 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
133 |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
134 void gtkwgaim_shell_execute(const char *target, const char *verb, const char *clazz) { |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
135 |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
136 g_return_if_fail(target != NULL); |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
137 g_return_if_fail(verb != NULL); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
138 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
139 if (G_WIN32_HAVE_WIDECHAR_API()) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
140 SHELLEXECUTEINFOW wsinfo; |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
141 wchar_t *w_uri, *w_verb, *w_clazz = NULL; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
142 |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
143 w_uri = g_utf8_to_utf16(target, -1, NULL, NULL, NULL); |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
144 w_verb = g_utf8_to_utf16(verb, -1, NULL, NULL, NULL); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
145 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
146 memset(&wsinfo, 0, sizeof(wsinfo)); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
147 wsinfo.cbSize = sizeof(wsinfo); |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
148 wsinfo.lpVerb = w_verb; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
149 wsinfo.lpFile = w_uri; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
150 wsinfo.nShow = SW_SHOWNORMAL; |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
151 if (clazz != NULL) { |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
152 w_clazz = g_utf8_to_utf16(clazz, -1, NULL, NULL, NULL); |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
153 wsinfo.fMask |= SEE_MASK_CLASSNAME; |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
154 wsinfo.lpClass = w_clazz; |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
155 } |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
156 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
157 if(!ShellExecuteExW(&wsinfo)) |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
158 gaim_debug_error("gtkwgaim", "Error opening URI: %s error: %d\n", |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
159 target, (int) wsinfo.hInstApp); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
160 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
161 g_free(w_uri); |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
162 g_free(w_verb); |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
163 g_free(w_clazz); |
14574
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
164 } else { |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
165 SHELLEXECUTEINFOA sinfo; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
166 gchar *locale_uri; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
167 |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
168 locale_uri = g_locale_from_utf8(target, -1, NULL, NULL, NULL); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
169 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
170 memset(&sinfo, 0, sizeof(sinfo)); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
171 sinfo.cbSize = sizeof(sinfo); |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
172 sinfo.lpVerb = verb; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
173 sinfo.lpFile = locale_uri; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
174 sinfo.nShow = SW_SHOWNORMAL; |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
175 if (clazz != NULL) { |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
176 sinfo.fMask |= SEE_MASK_CLASSNAME; |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
177 sinfo.lpClass = clazz; |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
178 } |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
179 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
180 if(!ShellExecuteExA(&sinfo)) |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
181 gaim_debug_error("gtkwgaim", "Error opening URI: %s error: %d\n", |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
182 target, (int) sinfo.hInstApp); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
183 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
184 g_free(locale_uri); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
185 } |
15237
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
186 |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
187 } |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
188 |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
189 void gtkwgaim_notify_uri(const char *uri) { |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
190 /* We'll allow whatever URI schemes are supported by the |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
191 * default http browser. |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
192 */ |
2bcb8684bfb5
[gaim-migrate @ 18026]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14966
diff
changeset
|
193 gtkwgaim_shell_execute(uri, "open", "http"); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
194 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
195 |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
196 #define WM_FOCUS_REQUEST (WM_APP + 13) |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
197 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
198 static LRESULT CALLBACK message_window_handler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
199 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
200 if (msg == WM_FOCUS_REQUEST) { |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
201 gaim_debug_info("gtkwgaim", "Got external Buddy List focus request."); |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
202 gaim_blist_set_visible(TRUE); |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
203 return TRUE; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
204 } |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
205 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
206 return DefWindowProc(hwnd, msg, wparam, lparam); |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
207 } |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
208 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
209 static HWND wgaim_message_window_init(void) { |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
210 HWND win_hwnd; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
211 WNDCLASSEX wcx; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
212 LPCTSTR wname; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
213 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
214 wname = TEXT("WingaimMsgWinCls"); |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
215 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
216 wcx.cbSize = sizeof(wcx); |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
217 wcx.style = 0; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
218 wcx.lpfnWndProc = message_window_handler; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
219 wcx.cbClsExtra = 0; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
220 wcx.cbWndExtra = 0; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
221 wcx.hInstance = gtkwgaim_hinstance(); |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
222 wcx.hIcon = NULL; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
223 wcx.hCursor = NULL; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
224 wcx.hbrBackground = NULL; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
225 wcx.lpszMenuName = NULL; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
226 wcx.lpszClassName = wname; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
227 wcx.hIconSm = NULL; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
228 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
229 RegisterClassEx(&wcx); |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
230 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
231 /* Create the window */ |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
232 if(!(win_hwnd = CreateWindow(wname, TEXT("WingaimMsgWin"), 0, 0, 0, 0, 0, |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
233 NULL, NULL, gtkwgaim_hinstance(), 0))) { |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
234 gaim_debug_error("gtkwgaim", |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
235 "Unable to create message window.\n"); |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
236 return NULL; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
237 } |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
238 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
239 return win_hwnd; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
240 } |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
241 |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
242 void |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
243 gtkwgaim_conv_blink(GaimConversation *conv, GaimMessageFlags flags) { |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
244 GaimGtkWindow *win; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
245 GtkWidget *window; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
246 |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
247 /* Don't flash for our own messages or system messages */ |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
248 if(flags & GAIM_MESSAGE_SEND || flags & GAIM_MESSAGE_SYSTEM) |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
249 return; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
250 |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
251 if(conv == NULL) { |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
252 gaim_debug_info("gtkwgaim", "No conversation found to blink.\n"); |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
253 return; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
254 } |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
255 |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
256 win = gaim_gtkconv_get_window(GAIM_GTK_CONVERSATION(conv)); |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
257 if(win == NULL) { |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
258 gaim_debug_info("gtkwgaim", "No conversation windows found to blink.\n"); |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
259 return; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
260 } |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
261 |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
262 window = win->window; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
263 |
14795
d1614d9ce7ab
[gaim-migrate @ 17560]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14700
diff
changeset
|
264 /* Don't flash if we have the window focused */ |
d1614d9ce7ab
[gaim-migrate @ 17560]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14700
diff
changeset
|
265 if(GetForegroundWindow() == GDK_WINDOW_HWND(window->window)) |
d1614d9ce7ab
[gaim-migrate @ 17560]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14700
diff
changeset
|
266 return; |
d1614d9ce7ab
[gaim-migrate @ 17560]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14700
diff
changeset
|
267 |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
268 if(MyFlashWindowEx) { |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
269 FLASHWINFO info; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
270 |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
271 memset(&info, 0, sizeof(FLASHWINFO)); |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
272 info.cbSize = sizeof(FLASHWINFO); |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
273 info.hwnd = GDK_WINDOW_HWND(window->window); |
14795
d1614d9ce7ab
[gaim-migrate @ 17560]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14700
diff
changeset
|
274 info.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG; |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
275 info.dwTimeout = 0; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
276 MyFlashWindowEx(&info); |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
277 } |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
278 } |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
279 |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
280 static gboolean |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
281 gtkwgaim_conv_im_blink(GaimAccount *account, const char *who, char **message, |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
282 GaimConversation *conv, GaimMessageFlags flags, void *data) |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
283 { |
14805
984657c2584d
[gaim-migrate @ 17570]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14795
diff
changeset
|
284 if (gaim_prefs_get_bool("/gaim/gtk/win32/blink_im")) |
984657c2584d
[gaim-migrate @ 17570]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14795
diff
changeset
|
285 gtkwgaim_conv_blink(conv, flags); |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
286 return FALSE; |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
287 } |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
288 |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
289 void gtkwgaim_init(HINSTANCE hint) { |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
290 |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
291 gaim_debug_info("gtkwgaim", "gtkwgaim_init start\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
292 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
293 gaimexe_hInstance = hint; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
294 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
295 /* IdleTracker Initialization */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
296 if(!wgaim_set_idlehooks()) |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
297 gaim_debug_error("gtkwgaim", "Failed to initialize idle tracker\n"); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
298 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
299 wgaim_gtkspell_init(); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
300 gaim_debug_info("gtkwgaim", "GTK+ :%u.%u.%u\n", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
301 gtk_major_version, gtk_minor_version, gtk_micro_version); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
302 |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
303 messagewin_hwnd = wgaim_message_window_init(); |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
304 |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
305 MyFlashWindowEx = (LPFNFLASHWINDOWEX) wgaim_find_and_loadproc("user32.dll", "FlashWindowEx"); |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
306 |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
307 gaim_debug_info("gtkwgaim", "gtkwgaim_init end\n"); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
308 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
309 |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
310 void gtkwgaim_post_init(void) { |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
311 |
14805
984657c2584d
[gaim-migrate @ 17570]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14795
diff
changeset
|
312 gaim_prefs_add_none("/gaim/gtk/win32"); |
984657c2584d
[gaim-migrate @ 17570]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14795
diff
changeset
|
313 gaim_prefs_add_bool("/gaim/gtk/win32/blink_im", TRUE); |
984657c2584d
[gaim-migrate @ 17570]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14795
diff
changeset
|
314 |
14700
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
315 gaim_signal_connect(gaim_gtk_conversations_get_handle(), |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
316 "displaying-im-msg", >kwin32_handle, GAIM_CALLBACK(gtkwgaim_conv_im_blink), |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
317 NULL); |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
318 |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
319 } |
7fb8a8583c73
[gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14574
diff
changeset
|
320 |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
321 /* Windows Cleanup */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
322 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
323 void gtkwgaim_cleanup(void) { |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
324 gaim_debug_info("gtkwgaim", "gtkwgaim_cleanup\n"); |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
325 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
326 if(messagewin_hwnd) |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
327 DestroyWindow(messagewin_hwnd); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
328 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
329 /* Idle tracker cleanup */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
330 wgaim_remove_idlehooks(); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
331 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
332 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
333 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
334 /* DLL initializer */ |
14574
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
335 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
336 gtkgaimdll_hInstance = hinstDLL; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
337 return TRUE; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
338 } |
14574
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
339 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
340 typedef HMONITOR WINAPI gaim_MonitorFromWindow(HWND, DWORD); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
341 typedef BOOL WINAPI gaim_GetMonitorInfo(HMONITOR, LPMONITORINFO); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
342 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
343 static gboolean |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
344 get_WorkingAreaRectForWindow(HWND hwnd, RECT *workingAreaRc) { |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
345 static gaim_MonitorFromWindow *the_MonitorFromWindow; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
346 static gaim_GetMonitorInfo *the_GetMonitorInfo; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
347 static gboolean initialized = FALSE; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
348 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
349 HMONITOR monitor; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
350 MONITORINFO info; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
351 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
352 if(!initialized) { |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
353 the_MonitorFromWindow = (gaim_MonitorFromWindow*) |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
354 wgaim_find_and_loadproc("user32", "MonitorFromWindow"); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
355 the_GetMonitorInfo = (gaim_GetMonitorInfo*) |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
356 wgaim_find_and_loadproc("user32", "GetMonitorInfoA"); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
357 initialized = TRUE; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
358 } |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
359 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
360 if(!the_MonitorFromWindow) |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
361 return FALSE; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
362 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
363 if(!the_GetMonitorInfo) |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
364 return FALSE; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
365 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
366 monitor = the_MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
367 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
368 info.cbSize = sizeof(info); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
369 if(!the_GetMonitorInfo(monitor, &info)) |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
370 return FALSE; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
371 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
372 CopyRect(workingAreaRc, &(info.rcWork)); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
373 return TRUE; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
374 } |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
375 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
376 void gtkwgaim_ensure_onscreen(GtkWidget *win) { |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
377 RECT windowRect, workingAreaRect, intersectionRect; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
378 HWND hwnd = GDK_WINDOW_HWND(win->window); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
379 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
380 g_return_if_fail(hwnd != NULL); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
381 GetWindowRect(hwnd, &windowRect); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
382 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
383 gaim_debug_info("win32placement", |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
384 "Window RECT: L:%ld R:%ld T:%ld B:%ld\n", |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
385 windowRect.left, windowRect.right, |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
386 windowRect.top, windowRect.bottom); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
387 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
388 if(!get_WorkingAreaRectForWindow(hwnd, &workingAreaRect)) { |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
389 gaim_debug_info("win32placement", |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
390 "Couldn't get multimonitor working area\n"); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
391 if(!SystemParametersInfo(SPI_GETWORKAREA, 0, &workingAreaRect, FALSE)) { |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
392 /* I don't think this will ever happen */ |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
393 workingAreaRect.left = 0; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
394 workingAreaRect.top = 0; |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
395 workingAreaRect.bottom = GetSystemMetrics(SM_CYSCREEN); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
396 workingAreaRect.right = GetSystemMetrics(SM_CXSCREEN); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
397 } |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
398 } |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
399 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
400 gaim_debug_info("win32placement", |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
401 "Working Area RECT: L:%ld R:%ld T:%ld B:%ld\n", |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
402 workingAreaRect.left, workingAreaRect.right, |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
403 workingAreaRect.top, workingAreaRect.bottom); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
404 |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
405 /** If the conversation window doesn't intersect perfectly with the working area, |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
406 * move it to the top left corner of the working area */ |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
407 if(!(IntersectRect(&intersectionRect, &windowRect, &workingAreaRect) |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
408 && EqualRect(&intersectionRect, &windowRect))) { |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
409 gaim_debug_info("win32placement", |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
410 "conversation window out of working area, relocating\n"); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
411 MoveWindow(hwnd, workingAreaRect.left, workingAreaRect.top, |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
412 (windowRect.right - windowRect.left), |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
413 (windowRect.bottom - windowRect.top), TRUE); |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
414 } |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
415 } |
333989477bcd
[gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
416 |