Mercurial > pidgin
comparison 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 |
comparison
equal
deleted
inserted
replaced
14699:cd1ddfa8868c | 14700:7fb8a8583c73 |
---|---|
47 #include "untar.h" | 47 #include "untar.h" |
48 | 48 |
49 #include <libintl.h> | 49 #include <libintl.h> |
50 | 50 |
51 #include "gtkwin32dep.h" | 51 #include "gtkwin32dep.h" |
52 | |
53 #include "win32dep.h" | 52 #include "win32dep.h" |
54 | 53 #include "gtkconv.h" |
55 #include "wspell.h" | 54 #include "wspell.h" |
56 | 55 |
57 /* | 56 /* |
58 * GLOBALS | 57 * GLOBALS |
59 */ | 58 */ |
60 HINSTANCE gaimexe_hInstance = 0; | 59 HINSTANCE gaimexe_hInstance = 0; |
61 HINSTANCE gtkgaimdll_hInstance = 0; | 60 HINSTANCE gtkgaimdll_hInstance = 0; |
62 HWND messagewin_hwnd; | 61 HWND messagewin_hwnd; |
62 static int gtkwin32_handle; | |
63 | |
64 typedef BOOL (CALLBACK* LPFNFLASHWINDOWEX)(PFLASHWINFO); | |
65 static LPFNFLASHWINDOWEX MyFlashWindowEx = NULL; | |
66 | |
63 | 67 |
64 /* | 68 /* |
65 * PUBLIC CODE | 69 * PUBLIC CODE |
66 */ | 70 */ |
67 | 71 |
219 } | 223 } |
220 | 224 |
221 return win_hwnd; | 225 return win_hwnd; |
222 } | 226 } |
223 | 227 |
228 static int | |
229 halt_flash_filter(GtkWidget *widget, GdkEventFocus *event, gpointer data) { | |
230 if(MyFlashWindowEx) { | |
231 HWND hWnd = data; | |
232 FLASHWINFO info; | |
233 | |
234 if(!IsWindow(hWnd)) | |
235 return 0; | |
236 | |
237 memset(&info, 0, sizeof(FLASHWINFO)); | |
238 info.cbSize = sizeof(FLASHWINFO); | |
239 info.hwnd = hWnd; | |
240 info.dwFlags = FLASHW_STOP; | |
241 info.dwTimeout = 0; | |
242 MyFlashWindowEx(&info); | |
243 } | |
244 return 0; | |
245 } | |
246 | |
247 void | |
248 gtkwgaim_conv_blink(GaimConversation *conv, GaimMessageFlags flags) { | |
249 GaimGtkWindow *win; | |
250 GtkWidget *window; | |
251 | |
252 /* Don't flash for our own messages or system messages */ | |
253 if(flags & GAIM_MESSAGE_SEND || flags & GAIM_MESSAGE_SYSTEM) | |
254 return; | |
255 | |
256 if(conv == NULL) { | |
257 gaim_debug_info("gtkwgaim", "No conversation found to blink.\n"); | |
258 return; | |
259 } | |
260 | |
261 win = gaim_gtkconv_get_window(GAIM_GTK_CONVERSATION(conv)); | |
262 if(win == NULL) { | |
263 gaim_debug_info("gtkwgaim", "No conversation windows found to blink.\n"); | |
264 return; | |
265 } | |
266 | |
267 window = win->window; | |
268 | |
269 if(MyFlashWindowEx) { | |
270 FLASHWINFO info; | |
271 /* Don't flash if we have the window focused */ | |
272 if(GetForegroundWindow() == GDK_WINDOW_HWND(window->window)) | |
273 return; | |
274 | |
275 memset(&info, 0, sizeof(FLASHWINFO)); | |
276 info.cbSize = sizeof(FLASHWINFO); | |
277 info.hwnd = GDK_WINDOW_HWND(window->window); | |
278 info.dwFlags = FLASHW_ALL | FLASHW_TIMER; | |
279 info.dwTimeout = 0; | |
280 MyFlashWindowEx(&info); | |
281 /* Stop flashing when window receives focus */ | |
282 g_signal_connect(G_OBJECT(window), "focus-in-event", | |
283 G_CALLBACK(halt_flash_filter), info.hwnd); | |
284 } | |
285 } | |
286 | |
287 static gboolean | |
288 gtkwgaim_conv_im_blink(GaimAccount *account, const char *who, char **message, | |
289 GaimConversation *conv, GaimMessageFlags flags, void *data) | |
290 { | |
291 gtkwgaim_conv_blink(conv, flags); | |
292 return FALSE; | |
293 } | |
224 | 294 |
225 void gtkwgaim_init(HINSTANCE hint) { | 295 void gtkwgaim_init(HINSTANCE hint) { |
296 | |
226 gaim_debug_info("gtkwgaim", "gtkwgaim_init start\n"); | 297 gaim_debug_info("gtkwgaim", "gtkwgaim_init start\n"); |
227 | 298 |
228 gaimexe_hInstance = hint; | 299 gaimexe_hInstance = hint; |
229 | 300 |
230 /* IdleTracker Initialization */ | 301 /* IdleTracker Initialization */ |
231 if(!wgaim_set_idlehooks()) | 302 if(!wgaim_set_idlehooks()) |
232 gaim_debug_error("gtkwgaim", "Failed to initialize idle tracker\n"); | 303 gaim_debug_error("gtkwgaim", "Failed to initialize idle tracker\n"); |
233 | 304 |
234 wgaim_gtkspell_init(); | 305 wgaim_gtkspell_init(); |
235 gaim_debug_info("gtkwgaim", "GTK+ :%u.%u.%u\n", | 306 gaim_debug_info("gtkwgaim", "GTK+ :%u.%u.%u\n", |
236 gtk_major_version, gtk_minor_version, gtk_micro_version); | 307 gtk_major_version, gtk_minor_version, gtk_micro_version); |
237 | 308 |
238 messagewin_hwnd = wgaim_message_window_init(); | 309 messagewin_hwnd = wgaim_message_window_init(); |
239 | 310 |
311 MyFlashWindowEx = (LPFNFLASHWINDOWEX) wgaim_find_and_loadproc("user32.dll", "FlashWindowEx"); | |
312 | |
240 gaim_debug_info("gtkwgaim", "gtkwgaim_init end\n"); | 313 gaim_debug_info("gtkwgaim", "gtkwgaim_init end\n"); |
314 } | |
315 | |
316 void gtkwgaim_post_init(void) { | |
317 | |
318 gaim_signal_connect(gaim_gtk_conversations_get_handle(), | |
319 "displaying-im-msg", >kwin32_handle, GAIM_CALLBACK(gtkwgaim_conv_im_blink), | |
320 NULL); | |
321 | |
241 } | 322 } |
242 | 323 |
243 /* Windows Cleanup */ | 324 /* Windows Cleanup */ |
244 | 325 |
245 void gtkwgaim_cleanup(void) { | 326 void gtkwgaim_cleanup(void) { |