Re: Custom content in GtkMenus?



It seems that gdk_pointer_grab doesn't seem to work on windows at all. For example:

        Wnd = gtk_window_new(GTK_WINDOW_POPUP);
        gtk_window_set_decorated(GTK_WINDOW(Wnd), FALSE);
        gtk_window_set_type_hint(GTK_WINDOW(Wnd), GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU);
        gtk_widget_add_events(Wnd, gtk_widget_get_events(Wnd) | GDK_BUTTON_PRESS_MASK);
            g_signal_connect (G_OBJECT(Wnd),
                        "button-press-event",
                        G_CALLBACK(PopupButtonEvent),
                        this);
            GdkGrabStatus s = gdk_pointer_grab( GDK_WINDOW(Wnd),
                                                TRUE,
                                                GDK_BUTTON_PRESS_MASK,
                                                NULL,
                                                NULL,
                                                GDK_CURRENT_TIME);
            if (s == GDK_GRAB_SUCCESS)
                // Show the window

Does not call PopupButtonEvent under any circumstance that I can see. However if I use gtk_grab_add it does 
kinda work. In that I get press events when the mouse is clicked over a GTK window. What I want is events 
when the mouse is clicked anywhere.

Also if I launch this popup over a GtkDialog that is a transient for another GtkWindow, I stop getting any 
button-press-event over Wnd, whereas if I launch it over a normal GtkWindow it works fine. Why does the 
transient change things?

It seems so close to working just how I want it. I'd even put up with not having click events outside my 
app... but not getting events while a transient dialog is open too is a showstopper.

Also I'm not getting much in the way of answers by posting here, am I not following some protocol?
--
Matthew Allen
http://www.memecode.com




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