Re: gdkwindow-win32.c and mouse events



Find attached a sample program.  You'll also notice that clicking
outside of the menu does not close the menu (another bug).  My
workaround was to use the leave-notify-event event to close the menu,
which doesn't work with the new bug since this event does not get
processed.

- Herman

--- Tor Lillqvist <tml iki fi> wrote:
> Herman Bloggs writes:
>  > Revision 1.102 of gdkwindow-win32.c breaks handling of mouse
> events in
>  > popup menus.
> 
> More details, or sample program please... I don't notice anything
> immediately wrong with the GIMP's right mouse button popup menus. (I
> use the gtk-2-2 branch, but then gdkwindow-win32.c is identical in
> both branches.)
> 
> --tml
> 
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
#include <gtk/gtk.h>

GtkWidget *new_menu_item(GtkWidget *menu, const char *str, GtkSignalFunc sf, gpointer data) {
	GtkWidget *menuitem;

        menuitem = gtk_menu_item_new_with_mnemonic(str);

	if (menu)
		gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);

	if (sf)
		g_signal_connect(G_OBJECT(menuitem), "activate", sf, data);

	gtk_widget_show_all(menuitem);

	return menuitem;
}

static void do_test_cb() {
        gtk_main_quit();
}

static gboolean menu_leave_cb(GtkWidget *menu, GdkEventCrossing *event, void *data) {
	if(event->detail == GDK_NOTIFY_ANCESTOR) {
		gtk_menu_popdown(GTK_MENU(menu));
                gtk_main_quit();
        }
	return FALSE;
}

static void docklet_menu() {
	static GtkWidget *menu = NULL;

	if (menu) {
		gtk_widget_destroy(menu);
	}

	menu = gtk_menu_new();

        new_menu_item(menu, "Test Menu Item 1", G_CALLBACK(do_test_cb), NULL);
        new_menu_item(menu, "Test Menu Item 2", G_CALLBACK(do_test_cb), NULL);
        new_menu_item(menu, "Test Menu Item 3", G_CALLBACK(do_test_cb), NULL);

	g_signal_connect(menu, "leave-notify-event", G_CALLBACK(menu_leave_cb), NULL);

	gtk_widget_show_all(menu);
	gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
}

int main(int argc, char* argv[]) {
	gtk_init(&argc, &argv);
        docklet_menu();
	gtk_main();

	return 0;
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]