annotate gtk/win32/gtkwin32dep.c @ 14700:7fb8a8583c73

[gaim-migrate @ 17452] Depluginize the wingaim conv. flashing. IM window flashing is now always on, chat window flashing is a pref in the wingaim options plugin. Fix some callbacks where 'int' was used instead of 'GaimMessageFlags' committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 09 Oct 2006 03:02:32 +0000
parents 333989477bcd
children d1614d9ce7ab
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 "gaim.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
41 #include "debug.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
42 #include "notify.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
43
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
44 #include "resource.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
45 #include "idletrack.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
46 #include "zlib.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
47 #include "untar.h"
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
48
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
49 #include <libintl.h>
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
50
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
51 #include "gtkwin32dep.h"
14574
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
52 #include "win32dep.h"
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
53 #include "gtkconv.h"
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
54 #include "wspell.h"
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 /*
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
57 * GLOBALS
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
58 */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
59 HINSTANCE gaimexe_hInstance = 0;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
60 HINSTANCE gtkgaimdll_hInstance = 0;
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
61 HWND messagewin_hwnd;
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
62 static int gtkwin32_handle;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
63
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
64 typedef BOOL (CALLBACK* LPFNFLASHWINDOWEX)(PFLASHWINFO);
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
65 static LPFNFLASHWINDOWEX MyFlashWindowEx = NULL;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
66
14224
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 /*
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
69 * PUBLIC CODE
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
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
72 HINSTANCE gtkwgaim_hinstance(void) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
73 return gaimexe_hInstance;
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
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
76 int gtkwgaim_gz_decompress(const char* in, const char* out) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
77 gzFile fin;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
78 FILE *fout;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
79 char buf[1024];
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
80 int ret;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
81
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
82 if((fin = gzopen(in, "rb"))) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
83 if(!(fout = g_fopen(out, "wb"))) {
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
84 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
85 gzclose(fin);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
86 return 0;
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 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
89 else {
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
90 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
91 return 0;
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
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
94 while((ret = gzread(fin, buf, 1024))) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
95 if(fwrite(buf, 1, ret, fout) < ret) {
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
96 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
97 gzclose(fin);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
98 fclose(fout);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
99 return 0;
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 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
102 fclose(fout);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
103 gzclose(fin);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
104
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
105 if(ret < 0) {
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
106 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
107 return 0;
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
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
110 return 1;
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
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
113 int gtkwgaim_gz_untar(const char* filename, const char* destdir) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
114 char tmpfile[_MAX_PATH];
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
115 char template[]="wgaimXXXXXX";
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
116
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
117 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
118 if(gtkwgaim_gz_decompress(filename, tmpfile)) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
119 int ret;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
120 if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET))
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
121 ret = 1;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
122 else {
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
123 gaim_debug_error("gtkwgaim_gz_untar", "Failure untaring %s\n", tmpfile);
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
124 ret = 0;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
125 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
126 g_unlink(tmpfile);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
127 return ret;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
128 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
129 else {
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
130 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
131 return 0;
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 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
134
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
135 void gtkwgaim_notify_uri(const char *uri) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
136
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
137 /* We'll allow whatever URI schemes are supported by the
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
138 * default http browser.
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
139 */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
140
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
141 if (G_WIN32_HAVE_WIDECHAR_API()) {
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
142 SHELLEXECUTEINFOW wsinfo;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
143 wchar_t *w_uri;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
144
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
145 w_uri = g_utf8_to_utf16(uri, -1, NULL, NULL, NULL);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
146
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
147 memset(&wsinfo, 0, sizeof(wsinfo));
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
148 wsinfo.cbSize = sizeof(wsinfo);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
149 wsinfo.fMask = SEE_MASK_CLASSNAME;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
150 wsinfo.lpVerb = L"open";
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
151 wsinfo.lpFile = w_uri;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
152 wsinfo.nShow = SW_SHOWNORMAL;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
153 wsinfo.lpClass = L"http";
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
154
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
155 if(!ShellExecuteExW(&wsinfo))
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
156 gaim_debug_error("gtkwgaim", "Error opening URI: %s error: %d\n",
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
157 uri, (int) wsinfo.hInstApp);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
158
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
159 g_free(w_uri);
14574
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
160 } else {
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
161 SHELLEXECUTEINFOA sinfo;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
162 gchar *locale_uri;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
163
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
164 locale_uri = g_locale_from_utf8(uri, -1, NULL, NULL, NULL);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
165
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
166 memset(&sinfo, 0, sizeof(sinfo));
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
167 sinfo.cbSize = sizeof(sinfo);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
168 sinfo.fMask = SEE_MASK_CLASSNAME;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
169 sinfo.lpVerb = "open";
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
170 sinfo.lpFile = locale_uri;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
171 sinfo.nShow = SW_SHOWNORMAL;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
172 sinfo.lpClass = "http";
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
173
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
174 if(!ShellExecuteExA(&sinfo))
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
175 gaim_debug_error("gtkwgaim", "Error opening URI: %s error: %d\n",
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
176 uri, (int) sinfo.hInstApp);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
177
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
178 g_free(locale_uri);
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 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
181
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
182 #define WM_FOCUS_REQUEST (WM_APP + 13)
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
183
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
184 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
185
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
186 if (msg == WM_FOCUS_REQUEST) {
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
187 gaim_debug_info("gtkwgaim", "Got external Buddy List focus request.");
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
188 gaim_blist_set_visible(TRUE);
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
189 return TRUE;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
190 }
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
191
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
192 return DefWindowProc(hwnd, msg, wparam, lparam);
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
193 }
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
194
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
195 static HWND wgaim_message_window_init(void) {
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
196 HWND win_hwnd;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
197 WNDCLASSEX wcx;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
198 LPCTSTR wname;
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 wname = TEXT("WingaimMsgWinCls");
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
201
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
202 wcx.cbSize = sizeof(wcx);
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
203 wcx.style = 0;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
204 wcx.lpfnWndProc = message_window_handler;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
205 wcx.cbClsExtra = 0;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
206 wcx.cbWndExtra = 0;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
207 wcx.hInstance = gtkwgaim_hinstance();
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
208 wcx.hIcon = NULL;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
209 wcx.hCursor = NULL;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
210 wcx.hbrBackground = NULL;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
211 wcx.lpszMenuName = NULL;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
212 wcx.lpszClassName = wname;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
213 wcx.hIconSm = NULL;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
214
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
215 RegisterClassEx(&wcx);
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
216
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
217 /* Create the window */
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
218 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
219 NULL, NULL, gtkwgaim_hinstance(), 0))) {
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
220 gaim_debug_error("gtkwgaim",
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
221 "Unable to create message window.\n");
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
222 return NULL;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
223 }
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
224
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
225 return win_hwnd;
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
226 }
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
227
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
228 static int
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
229 halt_flash_filter(GtkWidget *widget, GdkEventFocus *event, gpointer data) {
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
230 if(MyFlashWindowEx) {
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
231 HWND hWnd = data;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
232 FLASHWINFO info;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
233
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
234 if(!IsWindow(hWnd))
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
235 return 0;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
236
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
237 memset(&info, 0, sizeof(FLASHWINFO));
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
238 info.cbSize = sizeof(FLASHWINFO);
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
239 info.hwnd = hWnd;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
240 info.dwFlags = FLASHW_STOP;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
241 info.dwTimeout = 0;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
242 MyFlashWindowEx(&info);
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
243 }
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
244 return 0;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
245 }
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 void
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
248 gtkwgaim_conv_blink(GaimConversation *conv, GaimMessageFlags flags) {
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
249 GaimGtkWindow *win;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
250 GtkWidget *window;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
251
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
252 /* Don't flash for our own messages or system messages */
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
253 if(flags & GAIM_MESSAGE_SEND || flags & GAIM_MESSAGE_SYSTEM)
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
254 return;
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 if(conv == NULL) {
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
257 gaim_debug_info("gtkwgaim", "No conversation found to blink.\n");
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
258 return;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
259 }
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 win = gaim_gtkconv_get_window(GAIM_GTK_CONVERSATION(conv));
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
262 if(win == NULL) {
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
263 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
264 return;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
265 }
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
266
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
267 window = win->window;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
268
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
269 if(MyFlashWindowEx) {
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
270 FLASHWINFO info;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
271 /* Don't flash if we have the window focused */
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
272 if(GetForegroundWindow() == GDK_WINDOW_HWND(window->window))
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
273 return;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
274
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
275 memset(&info, 0, sizeof(FLASHWINFO));
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
276 info.cbSize = sizeof(FLASHWINFO);
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
277 info.hwnd = GDK_WINDOW_HWND(window->window);
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
278 info.dwFlags = FLASHW_ALL | FLASHW_TIMER;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
279 info.dwTimeout = 0;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
280 MyFlashWindowEx(&info);
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
281 /* Stop flashing when window receives focus */
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
282 g_signal_connect(G_OBJECT(window), "focus-in-event",
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
283 G_CALLBACK(halt_flash_filter), info.hwnd);
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
284 }
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
285 }
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
286
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
287 static gboolean
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
288 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
289 GaimConversation *conv, GaimMessageFlags flags, void *data)
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
290 {
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
291 gtkwgaim_conv_blink(conv, flags);
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
292 return FALSE;
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
293 }
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
294
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
295 void gtkwgaim_init(HINSTANCE hint) {
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
296
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
297 gaim_debug_info("gtkwgaim", "gtkwgaim_init start\n");
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 gaimexe_hInstance = hint;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
300
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
301 /* IdleTracker Initialization */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
302 if(!wgaim_set_idlehooks())
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
303 gaim_debug_error("gtkwgaim", "Failed to initialize idle tracker\n");
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
304
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
305 wgaim_gtkspell_init();
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
306 gaim_debug_info("gtkwgaim", "GTK+ :%u.%u.%u\n",
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
307 gtk_major_version, gtk_minor_version, gtk_micro_version);
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
308
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
309 messagewin_hwnd = wgaim_message_window_init();
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
310
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
311 MyFlashWindowEx = (LPFNFLASHWINDOWEX) wgaim_find_and_loadproc("user32.dll", "FlashWindowEx");
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
312
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
313 gaim_debug_info("gtkwgaim", "gtkwgaim_init end\n");
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
314 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
315
14700
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
316 void gtkwgaim_post_init(void) {
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
317
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
318 gaim_signal_connect(gaim_gtk_conversations_get_handle(),
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
319 "displaying-im-msg", &gtkwin32_handle, GAIM_CALLBACK(gtkwgaim_conv_im_blink),
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
320 NULL);
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
321
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
322 }
7fb8a8583c73 [gaim-migrate @ 17452]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14574
diff changeset
323
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
324 /* Windows Cleanup */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
325
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
326 void gtkwgaim_cleanup(void) {
14257
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
327 gaim_debug_info("gtkwgaim", "gtkwgaim_cleanup\n");
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
328
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
329 if(messagewin_hwnd)
14933d9055a0 [gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14224
diff changeset
330 DestroyWindow(messagewin_hwnd);
14224
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 /* Idle tracker cleanup */
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
333 wgaim_remove_idlehooks();
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
334
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
335 }
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
336
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
337 /* DLL initializer */
14574
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
338 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
14224
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
339 gtkgaimdll_hInstance = hinstDLL;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
340 return TRUE;
ab8a105eff62 [gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
341 }
14574
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 typedef HMONITOR WINAPI gaim_MonitorFromWindow(HWND, DWORD);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
344 typedef BOOL WINAPI gaim_GetMonitorInfo(HMONITOR, LPMONITORINFO);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
345
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
346 static gboolean
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
347 get_WorkingAreaRectForWindow(HWND hwnd, RECT *workingAreaRc) {
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
348 static gaim_MonitorFromWindow *the_MonitorFromWindow;
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
349 static gaim_GetMonitorInfo *the_GetMonitorInfo;
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
350 static gboolean initialized = FALSE;
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 HMONITOR monitor;
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
353 MONITORINFO info;
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
354
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
355 if(!initialized) {
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
356 the_MonitorFromWindow = (gaim_MonitorFromWindow*)
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
357 wgaim_find_and_loadproc("user32", "MonitorFromWindow");
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
358 the_GetMonitorInfo = (gaim_GetMonitorInfo*)
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
359 wgaim_find_and_loadproc("user32", "GetMonitorInfoA");
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
360 initialized = TRUE;
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
361 }
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_MonitorFromWindow)
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 if(!the_GetMonitorInfo)
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
367 return FALSE;
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
368
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
369 monitor = the_MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
370
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
371 info.cbSize = sizeof(info);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
372 if(!the_GetMonitorInfo(monitor, &info))
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
373 return FALSE;
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 CopyRect(workingAreaRc, &(info.rcWork));
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
376 return TRUE;
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
377 }
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
378
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
379 void gtkwgaim_ensure_onscreen(GtkWidget *win) {
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
380 RECT windowRect, workingAreaRect, intersectionRect;
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
381 HWND hwnd = GDK_WINDOW_HWND(win->window);
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 g_return_if_fail(hwnd != NULL);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
384 GetWindowRect(hwnd, &windowRect);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
385
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
386 gaim_debug_info("win32placement",
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
387 "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
388 windowRect.left, windowRect.right,
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
389 windowRect.top, windowRect.bottom);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
390
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
391 if(!get_WorkingAreaRectForWindow(hwnd, &workingAreaRect)) {
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
392 gaim_debug_info("win32placement",
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
393 "Couldn't get multimonitor working area\n");
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
394 if(!SystemParametersInfo(SPI_GETWORKAREA, 0, &workingAreaRect, FALSE)) {
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
395 /* I don't think this will ever happen */
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
396 workingAreaRect.left = 0;
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
397 workingAreaRect.top = 0;
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
398 workingAreaRect.bottom = GetSystemMetrics(SM_CYSCREEN);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
399 workingAreaRect.right = GetSystemMetrics(SM_CXSCREEN);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
400 }
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
401 }
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
402
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
403 gaim_debug_info("win32placement",
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
404 "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
405 workingAreaRect.left, workingAreaRect.right,
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
406 workingAreaRect.top, workingAreaRect.bottom);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
407
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
408 /** 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
409 * 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
410 if(!(IntersectRect(&intersectionRect, &windowRect, &workingAreaRect)
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
411 && EqualRect(&intersectionRect, &windowRect))) {
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
412 gaim_debug_info("win32placement",
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
413 "conversation window out of working area, relocating\n");
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
414 MoveWindow(hwnd, workingAreaRect.left, workingAreaRect.top,
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
415 (windowRect.right - windowRect.left),
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
416 (windowRect.bottom - windowRect.top), TRUE);
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
417 }
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
418 }
333989477bcd [gaim-migrate @ 17298]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14257
diff changeset
419