Re: Question about modal dialog in gtk application



On Wed, Apr 14, 2010 at 3:39 PM, Nicola Fontana <ntd entidi it> wrote:
Il giorno Wed, 14 Apr 2010 14:27:21 -0700
silverburgh <silverburgh meryl gmail com> ha scritto:

Can you please help me what happens if I use 'gtk_set_transient_for to
mark it "modal to only one window"' under the hood.

Normally (as far as what I know), there is 1 gtk main thread listen
for all ui events (mouse click, resize etc). And when a moral dialog
is poped up, that main ui tread is blocked until user clicks OK or
Cancel (hence the window is frozen).

But for the case of 'gtk_set_transient_for ', how will that work? how
can 1 window is interactive when the Main UI thread is blocked by a
moral dialog in the 2nd window? (like the case in Firefox).

A modal window freezes the other windows, period. This is what
"modal" means and what gtk_dialog_run() is supposed to do. This
has nothing to do with the stack order of the windows, although
it is common practice to keep the modal window above the stack.

gtk_window_set_transient_for() sends a hint to the window
manager, asking to keep one window above another, and can be done
either for modal and non-modal windows. So with gtk_widget_show()
and gtk_window_set_transient_for() you get a *non-modal* window
that stays on top of the parent window.

Nicola,

Thank you for your help and your detailed explanation.
But for FF case, when it pops up an alert dialog (done via
gtk_window_set_transient_for()), why the parent window is 'frozen' if
the alert dialog is a 'non-modal' window? (i.e. the scroll bar of the
parent window won't work, the menu bar won't work).

Thank you.



--
Nicola




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