Mercurial > pidgin
changeset 17064:c3add818a46c
Don't stop all windows from flashing when any Windows Pidgin window is focused. I also noticed that we were registering a callback for the focus-in-event for each flash start and never unregistering it, so this fixes that too. Fixes #554.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sun, 13 May 2007 05:26:38 +0000 |
parents | 1ae4c1a45750 |
children | e84580eaabbc |
files | pidgin/win32/gtkwin32dep.c |
diffstat | 1 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/win32/gtkwin32dep.c Sat May 12 20:34:56 2007 +0000 +++ b/pidgin/win32/gtkwin32dep.c Sun May 13 05:26:38 2007 +0000 @@ -251,7 +251,13 @@ static gboolean stop_flashing(GtkWidget *widget, GdkEventFocus *event, gpointer data) { GtkWindow *window = data; + gpointer handler_id; + winpidgin_window_flash(window, FALSE); + + if ((handler_id = g_object_get_data(G_OBJECT(window), "flash_stop_handler_id"))) + g_signal_handler_disconnect(G_OBJECT(window), (gulong) GPOINTER_TO_UINT(handler_id)); + return FALSE; } @@ -275,12 +281,11 @@ memset(&info, 0, sizeof(FLASHWINFO)); info.cbSize = sizeof(FLASHWINFO); info.hwnd = GDK_WINDOW_HWND(gdkwin); - if (flash) - info.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG; - else + if (flash) { + info.dwFlags = FLASHW_ALL | FLASHW_TIMER; + } else info.dwFlags = FLASHW_STOP; info.dwTimeout = 0; - info.dwTimeout = 0; MyFlashWindowEx(&info); } else @@ -314,8 +319,11 @@ winpidgin_window_flash(window, TRUE); /* Stop flashing when window receives focus */ - g_signal_connect(G_OBJECT(window), "focus-in-event", - G_CALLBACK(stop_flashing), window); + if (g_object_get_data(G_OBJECT(window), "flash_stop_handler_id") == NULL) { + gulong handler_id = g_signal_connect(G_OBJECT(window), "focus-in-event", + G_CALLBACK(stop_flashing), window); + g_object_set_data(G_OBJECT(window), "flash_stop_handler_id", GUINT_TO_POINTER(handler_id)); + } } static gboolean