Gtk3 Modal Dialogs (RESOLVED)

I’m porting my XP layer using from GTK2 to GTK3. One of the things the apps expect support for is modal dialogs. Previously I implemented this via a GtkWindow or GtkDialog that had a number of signals attached to it, and then a call to gtk_main for the duration of the dialog. In GTK3 I find that the signals on the dialog don’t work, things like mouse click/move etc. I’m using gtk_window_set_transient_for as well. If you want to look at some code see GDialog::DoModal and GWindow::Attach for starters. E.g. my dialog’s “button-press-event” doesn’t get called while in the nested gtk_main.

Not sure where to go to fix this.

Any ideas?


Can’t say for sure if we’re talking apples and oranges, but the latest post on talks about the action area of custom dialogs. Rather than reacting to events, dialogs return a response ID which you then handle with a switch/case or if/else construct.

There’s a full example in D, but it shouldn’t be that hard to port to CPP.

No I don’t think we are talking about the same thing. But thanks for responding. At the moment my “dialogs” are just GtkWindows. And the client app is expecting to be able to populate it with whatever controls it wants and get events for those controls. I’m going to try tracing a mouse click through GTK and see how far it gets. Maybe I can work out where it gets stuck?

Ugh. After tracing through GTK and watching where the signal for a click gets emitted it’s bubbling up into my code, but getting stuck in a lower layer than I expected (due to my own bugs). So no issue in the GTK side of things. Yay for open source though.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.