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

- 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

Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
#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);


	return menuitem;

static void do_test_cb() {

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

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

	if (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_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);

	return 0;

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