Re: gtk_grab_add trouble



Craig Emery <craig emery 3glab com> writes:
> according to the GTK+ FAQ to make a window modal you call gtk_grab_add (window) and
> then when it's destroyed called gtk_grab_remove (widndow).
> 
> However my code was using a different method!
> After showing the window I call gtk_main () (yes, for the second time) and in the
> destroy handler I call gtk_main_quit ().

This won't keep the other windows from getting events. You can do a
second gtk_main() along with gtk_grab_add() as well. i.e. the two
things are orthogonal. gtk_main() is "modal" in that it blocks your
app waiting for the dialog, but it has no user-visible
effect. gtk_grab_add() renders non-grabbed widgets insensitive, so the
user can't interact with them.

> Now after I call I get a SEGV with this backtrace:

Just some bug in your app I think.
 
> So I gather I'm freeing something twice or some such nonsense.

Try 'MALLOC_CHECK_=2 gdb myprogram' if you're on Linux, see 'man
malloc' for details on MALLOC_CHECK_.

> I did also notice that even though the FAQ says this is how to do modal windows, the
> window I've done a gtk_grab_add on can still be hidden by other windows in my
> application should I click on them etc. This isn't what I call modal.
> 

To keep a window on top, set which window it should be on top of with
gtk_window_set_transient_for(). Then reasonable window managers will
keep it on top.

Havoc





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