Re: Window size and position



Thanks for all the answers.

I found the reason why the window was moving slightly eveytime I
stored/restored its position.
From developer.gnome.org:
http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html#gtk-window-get-position

---
gtk_window_get_position() is not 100% reliable because the X Window
System does not specify a way to obtain the geometry of the decorations
placed on a window by the window manager. Thus GTK+ is using a "best
guess" that works with most window managers.

Moreover, nearly all window managers are historically broken with
respect to their handling of window gravity. So moving a window to its
current position as returned by gtk_window_get_position() tends to
result in moving the window slightly. Window managers are slowly getting
better over time.

If a window has gravity GDK_GRAVITY_STATIC the window manager frame is
not relevant, and thus gtk_window_get_position() will always produce
accurate results. However you can't use static gravity to do things like
place a window in a corner of the screen, because static gravity ignores
the window manager decorations.

If you are saving and restoring your application's window positions, you
should know that it's impossible for applications to do this without
getting it somewhat wrong because applications do not have sufficient
knowledge of window manager state. The Correct Mechanism is to support
the session management protocol (see the "GnomeClient" object in the
GNOME libraries for example) and allow the window manager to save your
window sizes and positions.
---

Mathias




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