Re: Going nuts with window positioning

Le mer 22/01/2003 Ã 07:41, Steve Fox a Ãcrit :
Back in November or so, some folks were kind enough to help me get
window position and size remembering to work. Well, size works great,
but positioning is a bit flaky. So I'm hoping someone can help me fix
this for good.

  my ($h, $w) = $win->window->get_size;
  my ($x, $y) = $win->window->get_position;

This is what I'm doing now. The 

  my ($x, $y, $w, $h) = @{$win->allocation};

stuff seemed less reliable than using get_position.

Any way, I've found that if the window fires up and the user moves it,
get_position will return good values and life is good. But if the user
doesn't not move the window at all it return x:4 y:20 (maybe these
numbers are non-zero due to a bug my window manager theme).

So to try to compensate for this problem, I've been trying to synthesize
a "configure" event right before my window exit function is called.
"configure" is the only event that fires when a window is moved
(discovered by connecting the window to the "event" signal and printing
out the type). However, it seems that the equivalent of
gtk_main_do_event is not supported in Gtk-Perl?

Can anyone suggest a method to help me fix this? I will be extremely

I don't have the solution to your problem but I tried to do the same
thing (open application at the latest position and size).

To do that, I connect to the 'size_allocate' signal of a window. Then I
retreive the size. For position, I don't even try to retreive it. Why ?
Because it is already done by Gnome (I suppose). App windows always open
at the previous position. Other application sub windows use to be
positionned in the middle of the screen or in the middle of the parent
window. This is generaly what we want.

So you can try if Gnome resolve your problem (but this can create other
dependancies to your app). You also stop trying to position your window
(because some windows managers, don't care about the window position and
you can do nothing against that). You can even try if Gtk2 don't have
this window position problem. But for Gtk (and Gtk-Perl) I have never
found a good working solution.


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