func to save/restore window position, size?
Jasper Huijsmans
jasper at xfce.org
Tue Feb 10 22:08:01 CET 2004
Op di 10-02-2004, om 21:54 schreef Danny Milosavljevic:
> Hi,
>
> Am Die, den 10.02.2004 schrieb Jasper Huijsmans um 21:30:
> > Op di 10-02-2004, om 20:42 schreef Danny Milosavljevic:
> > ...
> > > >
> > > > Hmm, I'm not convinced this should be a library function, actually. I
> > > > can imagine different windows do different kind of things.
> > >
> > > Dunno :) Just got the impression I'd like to have some programs open at
> > > the same position&size they were last... but maybe it's not *that*
> > > common to make it worth a lib function. (although I feel that I really
> > > find it weird to have to do the remembering window pos&sizing for the
> > > program manually... maybe I'm just lazy ;))
> > >
> >
> > If you are not actually saving and restoring the data from disk in these
> > functions, I don't see you gain much by it at all.
> >
> > Correct me if I'm wrong, but you propose to have something like
> >
> > get_window_info();
> > set_window_info();
> >
> > and connect those to the relevant signals.
>
> hmmm... good idea ^^
>
> now for the signals... which one for the "load" ? :)
> [moving after showing the window looks weird, so is there a signal I get
> before the window is shown, but after the window is initialized enough
> to make the move,resize,... functions work]
>
gtk_window_move() already should take care of that for you. Stickyness
must be set before the window is realized.
> >
> > Defining hook functions and attaching those to the window, to me doesn't
> > sound easier or more convenient than simply connecting to the signals
> > yourself. I'm probably missing something.
>
> yeah, you are probably right :) I should think of the easy way first ^^
>
> >
> > Maybe it's better to really show me what you mean. If you write whatever
> > you need for xfce4-mixer and that works well, we can put it in the
> > library.
>
> Yeah, I will do that :)
>
> Now, a few Q's for the process itself ...
>
> - To save, can I use gtk_window_get_size ? Gtk docs mentions something
> about a race condition with the window manager... so if it causes weird
> problems, I'd rather not...
>
gtk_widget_size_request() should work fine, isn't it?
> - Is there a recommended order to call the set functions ? (resize,
> move, set_gravity)
>
You don't usually set gravity, do you need it? If you uset
gtk_widget_set_size_request() and gtk_window_move() you don't really
have to worry about order, i think.
> Can the set functions be called before the window is onscreen ?
>
Yes, and for some things you have to (stickyness).
> - how do I read window flags ? (I'd think sticky would be good to retain
> across mixer restarts)
if gtk can't perhaps netk_get_... ?
Jasper
More information about the Xfce4-dev
mailing list