file_chooser's parent: is NULL OK?

The second parameter to gtk_file_chooser_dialog_new() is
GtkWindow *parent.

I've been in the habit of putting my app's main window in as the parent, but I notice that this sometimes produces undesirable results.

For example, using the file chooser to save a displayed graph to file: when the file chooser is closed I'd like focus to return to the graph window -- but (at least with my desktop setup) if the main window is given as the file chooser's parent, then it's the main window that gets focused on closing the file chooser (and the graph is pushed into the background).

I've experimented, and see that if I pass NULL for parent, focus seems to return to the previously focused window when the chooser is closed, which is fine. I just wanted to check if passing NULL in this context is "officially OK", or if it invokes undefined behavior.

Allin Cottrell
Department of Economics
Wake Forest University, NC

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