Mercurial > pidgin.yaz
changeset 10910:d8b0b9c5ffd7
[gaim-migrate @ 12663]
Eliminate a couple hacks to work around win32 GTK+ bug #169753 (fixed in GTK+ 2.6.5). Improved another hack in place to work around GTK+ bug #107320. I suppose I could have made some of this dependent on GTK+ version, but it was a win32 only hack and there is no good reason not to use the latest GTK+ runtime.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 13 May 2005 00:10:54 +0000 |
parents | bd6c0aa9ff6c |
children | 1012f463d2b9 |
files | plugins/docklet/docklet.c |
diffstat | 1 files changed, 24 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/docklet/docklet.c Mon May 09 20:46:30 2005 +0000 +++ b/plugins/docklet/docklet.c Fri May 13 00:10:54 2005 +0000 @@ -83,35 +83,34 @@ } #ifdef _WIN32 -#if 0 /* XXX NEW STATUS */ -/* This is workaround for a bug in windows GTK+. Clicking outside of the - parent menu (including on a submenu-item) close the whole menu before - the "activate" event is thrown for the given submenu-item. Fixed by - replacing "activate" by "button-release-event". */ -static gboolean -docklet_menu_do_away_message(GtkWidget *widget, GdkEventButton *event, gpointer user_data) -{ - do_away_message(widget, user_data); - return FALSE; -} - -static gboolean -docklet_menu_create_away_mess(GtkWidget *widget, GdkEventButton *event, gpointer user_data) -{ - create_away_mess(widget, user_data); - return FALSE; -} -#endif - /* This is a workaround for a bug in windows GTK+. Clicking outside of the menu does not get rid of it, so instead we get rid of it as soon as the pointer leaves the menu. */ +static gboolean hide_docklet_menu(gpointer data) +{ + if (data != NULL) { + gtk_menu_popdown(GTK_MENU(data)); + } + return FALSE; +} static gboolean -docklet_menu_leave(GtkWidget *menu, GdkEventCrossing *event, void *data) +docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data) { - if(event->detail == GDK_NOTIFY_ANCESTOR) { + static guint hide_docklet_timer = 0; + if (event->type == GDK_LEAVE_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) { gaim_debug(GAIM_DEBUG_INFO, "tray icon", "menu leave-notify-event\n"); - gtk_menu_popdown(GTK_MENU(menu)); + /* Add some slop so that the menu doesn't annoyingly disappear when mousing around */ + if (hide_docklet_timer == 0) { + hide_docklet_timer = gaim_timeout_add(500, + hide_docklet_menu, menu); + } + } else if (event->type == GDK_ENTER_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) { + gaim_debug(GAIM_DEBUG_INFO, "tray icon", "menu enter-notify-event\n"); + if (hide_docklet_timer != 0) { + /* Cancel the hiding if we reenter */ + gaim_timeout_remove(hide_docklet_timer); + hide_docklet_timer = 0; + } } return FALSE; } @@ -159,11 +158,7 @@ a = (struct away_message *)awy->data; entry = gtk_menu_item_new_with_label(a->name); -#ifdef _WIN32 - g_signal_connect(G_OBJECT(entry), "button-release-event", G_CALLBACK(docklet_menu_do_away_message), a); -#else g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(do_away_message), a); -#endif gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry); awy = g_slist_next(awy); @@ -173,11 +168,7 @@ gaim_separator(docklet_awaymenu); entry = gtk_menu_item_new_with_label(_("New...")); -#ifdef _WIN32 - g_signal_connect(G_OBJECT(entry), "button-release-event", G_CALLBACK(docklet_menu_create_away_mess), NULL); -#else g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(create_away_mess), NULL); -#endif gtk_menu_shell_append(GTK_MENU_SHELL(docklet_awaymenu), entry); entry = gtk_menu_item_new_with_label(_("Away")); @@ -213,7 +204,8 @@ gaim_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(gaim_core_quit), NULL, 0, 0, NULL); #ifdef _WIN32 - g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave), NULL); + g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); + g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); #endif gtk_widget_show_all(menu); gtk_menu_popup(GTK_MENU(menu), NULL, NULL,