| 249 return win_hwnd; |
249 return win_hwnd; |
| 250 } |
250 } |
| 251 |
251 |
| 252 static gboolean stop_flashing(GtkWidget *widget, GdkEventFocus *event, gpointer data) { |
252 static gboolean stop_flashing(GtkWidget *widget, GdkEventFocus *event, gpointer data) { |
| 253 GtkWindow *window = data; |
253 GtkWindow *window = data; |
| |
254 gpointer handler_id; |
| |
255 |
| 254 winpidgin_window_flash(window, FALSE); |
256 winpidgin_window_flash(window, FALSE); |
| |
257 |
| |
258 if ((handler_id = g_object_get_data(G_OBJECT(window), "flash_stop_handler_id"))) |
| |
259 g_signal_handler_disconnect(G_OBJECT(window), (gulong) GPOINTER_TO_UINT(handler_id)); |
| |
260 |
| 255 return FALSE; |
261 return FALSE; |
| 256 } |
262 } |
| 257 |
263 |
| 258 void |
264 void |
| 259 winpidgin_window_flash(GtkWindow *window, gboolean flash) { |
265 winpidgin_window_flash(GtkWindow *window, gboolean flash) { |
| 273 FLASHWINFO info; |
279 FLASHWINFO info; |
| 274 |
280 |
| 275 memset(&info, 0, sizeof(FLASHWINFO)); |
281 memset(&info, 0, sizeof(FLASHWINFO)); |
| 276 info.cbSize = sizeof(FLASHWINFO); |
282 info.cbSize = sizeof(FLASHWINFO); |
| 277 info.hwnd = GDK_WINDOW_HWND(gdkwin); |
283 info.hwnd = GDK_WINDOW_HWND(gdkwin); |
| 278 if (flash) |
284 if (flash) { |
| 279 info.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG; |
285 info.dwFlags = FLASHW_ALL | FLASHW_TIMER; |
| 280 else |
286 } else |
| 281 info.dwFlags = FLASHW_STOP; |
287 info.dwFlags = FLASHW_STOP; |
| 282 info.dwTimeout = 0; |
|
| 283 info.dwTimeout = 0; |
288 info.dwTimeout = 0; |
| 284 |
289 |
| 285 MyFlashWindowEx(&info); |
290 MyFlashWindowEx(&info); |
| 286 } else |
291 } else |
| 287 FlashWindow(GDK_WINDOW_HWND(gdkwin), flash); |
292 FlashWindow(GDK_WINDOW_HWND(gdkwin), flash); |
| 312 if (GetForegroundWindow() == GDK_WINDOW_HWND(GTK_WIDGET(window)->window)) |
317 if (GetForegroundWindow() == GDK_WINDOW_HWND(GTK_WIDGET(window)->window)) |
| 313 return; |
318 return; |
| 314 |
319 |
| 315 winpidgin_window_flash(window, TRUE); |
320 winpidgin_window_flash(window, TRUE); |
| 316 /* Stop flashing when window receives focus */ |
321 /* Stop flashing when window receives focus */ |
| 317 g_signal_connect(G_OBJECT(window), "focus-in-event", |
322 if (g_object_get_data(G_OBJECT(window), "flash_stop_handler_id") == NULL) { |
| 318 G_CALLBACK(stop_flashing), window); |
323 gulong handler_id = g_signal_connect(G_OBJECT(window), "focus-in-event", |
| |
324 G_CALLBACK(stop_flashing), window); |
| |
325 g_object_set_data(G_OBJECT(window), "flash_stop_handler_id", GUINT_TO_POINTER(handler_id)); |
| |
326 } |
| 319 } |
327 } |
| 320 |
328 |
| 321 static gboolean |
329 static gboolean |
| 322 winpidgin_conv_im_blink(PurpleAccount *account, const char *who, char **message, |
330 winpidgin_conv_im_blink(PurpleAccount *account, const char *who, char **message, |
| 323 PurpleConversation *conv, PurpleMessageFlags flags, void *data) |
331 PurpleConversation *conv, PurpleMessageFlags flags, void *data) |