Re: file_chooser's parent: is NULL OK?



On 2005.02.03 13:23, Allin Cottrell wrote:
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).

Could you use the graph's window as the parent? That should take care of the loss of focus, and as a side benefit you could arrange for the chooser to go away if the graph is destroyed.

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.

Iirc, NULL = unparented, so the wm just treats it as an independent window.

Peter




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