Re: [gtk-list] restarting gtk_main()
- From: Jan Kratochvil <short ucw cz>
- To: gtk-list redhat com
- Cc: dat98jas ludat lth se
- Subject: Re: [gtk-list] restarting gtk_main()
- Date: Fri, 12 Feb 1999 16:48:41 +0100
> I am curently developing a GTK+ replacement for xdm. One of the main
> features will be a possibility to restart the X-server in a different
> resolution when loging in. However, for this to work I have to enter and
> exit the gtk_main()-routine each time somone logs in. After a gtk restart,
> some widgets does not get updated properly.
>
> This is what I do:
>
> ----BEGIN PSEUDO CODE----
>
> gtk_setlocale(..
> gtk_init(...
>
> <create the loginwindow with its childwidgets>
>
> gtk_main();
>
> <when somone logs in, gtk_main_quit() is called, and we return here>
>
> ----END SPEUDO CODE----
>
> Do I have to explicit destroy each widget, or is it sufficient to destroy
> the toplevel window before calling gtk_main_quit()?
I'm using multiple gtk_main() cycles and:
a) gtk_init() under GTK1.0 should be called ONLY ONCE. Multiple calls
under GTK1.0 will crash, under GTK1.1 are gracefully ignored.
So when running under GTK1.0 gtk_init() should be guarded around.
b) Widget state is not reset, for example GtkEntry fields remain filled
in by user. Simple text_set() etc. functions will be OK.
c) Don't know anything about gtk_setlocale(), I'm not using it.
The normal way to temporarily "close down" the application is to do
gtk_widget_hide() on the main window. Unfortunately when you then
restart the X server, GDK will complain about fatal X server shutdown
(connection closed).
The problem is that after gtk/gdk initialization (like connection
setup to X server) you can't close it all as the only way to cleanup
all GTK/GDK stuff is to call the atexit() chain - for example needed
function gdk_exit_func() is in gdk.c and is declared "static". So you
should probably do normal exit() and get restarted by some parent
process.
Probably Owen Taylor (thanks for all those great and correct answers
to the list!) would say why some shutdown isn't implemented in GTK+.
Lace
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]