Re: [gtk-list] Re: Quitting gracefully in Gtk--
- From: Carl Johan Lejdfors <kem96cjl student2 lu se>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Quitting gracefully in Gtk--
- Date: Tue, 06 Jul 1999 09:49:10 +0200
I'm reposting it to the gtkmm-list. It really should have gone there in the
first place.
Sorry for any inconvenience.
/Calle
Karl Nelson wrote:
> In message <3780E886.DCB284A2@student2.lu.se>Carl Johan Lejdfors writes
> >Hello,
> >
> >I have som questions concerning some features of Gtk--.
> >
> >1. If I have a class like:
> >
> > class My_Window : public Gtk_Window {
> >
> > public:
> >
> > gint delete_event_impl( GdkEventAny* ) {
> > Gtk_Main::instance()->quit();
> > return 0;
> > }
> > void on_quit_activate() {
> > Gtk_Main::instance()->quit();
> > }
> >
> > //code deletet for purpose of clarity
> > }
> >
> >with a some stuff on it and a menubar with a Quit button.
> >Then when I delete the window everything works fine.
> >However when I press the Quit button the window dissappears
> >and I get a Seg-fault or Bus error.
>
> Hmm. I don't get that on my version, but then I am not using
> on_quit_activate. The skeleton I have always used is this:
>
> class MainWindowClass : public Gtk_Window
> {
> gint delete_event_impl(GdkEventAny *)
> {app->quit();
> return 0;
> }
> };
>
> MainWindowClass::MainWindowClass(void) : Gtk_Window(GTK_WINDOW_TOPLEVEL)
> {
> // Connect the Quit button to the application quit
> connect_to_method(button->clicked,app,&Gtk_Main::quit);
> }
>
> If this doesn't work, get a backtrace of the offending event and
> mail it to the gtkmm maillist.
>
> >There is the same problem with the planet example included with the
> >distribution.
> >I suspect this has to do with the other delete event-handlers not being
> >called properly
> >(if I change the return from delete_event_impl() to a 1 the program also
> >seg-faults.)
>
> I have never actually tried that, but it seems likely that some
> part of Gtk-- probably died on the quit and returning 1 is
> causing it to continue using that piece. I will have to spec it
> out more closely.
>
> (You mention the planet demo. Is that from the Gtk-- distribution or
> the GtkGLArea-- dist?)
>
> >Is there a way to quit more gracefully? Is it due to some error in Gtk--
> >or the compilation
> >(I run Gtk-- 1.0.1 on top of gtk+-1.2.3 with glib-1.2.3 on an IRIX 6.5
> >with the native compiler)
>
> There should be. It always exits gracefully on my Linux System.
> (I am currently trying to get acces to an IRIX system to test
> other code which has problems on that compiler. I will check
> this as well when I do. It seems likely that the IRIX compiler
> is "weak" in support of some structures and that some of the
> less than portable tricks we use of Linux are breaking down.)
>
> >2. Why does a window resize (on my platform anyway) generate one
> >configure event followed by *two* expose events?
>
> It is not uncommon for a single change to result in multiple expose
> events. There is a count field in the expose event that indicates
> the number of pending expose events for the window. If you are
> redrawing the entire window at each expose event just skip all
> event that do not have a count of 0. A single bring forward
> can generate more then 4 exposes depending on the number of windows
> that overlap.
>
> Hope it helps.
>
> --Karl
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]