Hi,

Am Donnerstag, den 20.10.2005, 22:49 +0400 schrieb Alex Smirnov:
> Hi, friends!
> 
> For Win32 I can use GetSystemMetrics in this case. So in Windows it
> works. But in Linux (Gnome/GTK) GetSystemMetrics is seems to be not
> realized jet - this function presents, code can be compiled, but
> GetSystemMetrics returns some strange and illegal values.
> 
> So code, that is working in Windows will not work in Linux(Gnome/GTK).
> 
> But I think that there MUST BE an information about Title Bar height
> in Gnome/GTK. So the question is HOW can we get this information using
> Gnome or GTK API. Is there any Gnome or GTK guru to help?  :-) 

Note that depending on the presence of a window frame is bad. The frame
(and thus the frame size / orientation) can change while the application
is running (every time the user switches to another window theme). It
can also change depending on the window title, or window flags, or when
you change the display resolution, or start another window manager (i.e.
terminate the current one) while the application is running. Maybe the
window itself is animating (opening/closing animation) and thus the
window frame (and thus the size) changes rapidly. Maybe the window is
minimized/hidden and has no frame yet. Maybe it is docked within windows
of other applications (i.e. tabs) -> they have one common frame. Maybe
it is running on a small display and hence nothing has window frames at
all. Maybe the window frame (and frame size) changes depending on if the
window is maximized or not.

gtk does not provide a way to determine the current frame extents.

That said, it is possible to find out the current frame extents, via
xlib, if the window manager cooperates. 
> 
http://standards.freedesktop.org/wm-spec/wm-spec-1.4.html#id2511948

_NET_FRAME_EXTENTS, left, right, top, bottom, CARDINAL[4]/32

via the gdk xlib interface:

  unsigned long* extents;

  extents = NULL;

  if (gdk_property_get (w->window,
    gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE),
    gdk_atom_intern ("CARDINAL", FALSE),
    0,
    sizeof(unsigned long) * 4,
    FALSE,
    NULL,
    NULL,
    NULL,
    (guchar**)& extents
  ) && extents) {
    printf("%d %d %d %d\n", extents[0], extents[1], extents[2],
extents[3]);
    XFree (extents);
  }

you can get it with the normal Xlib function too, which is
XGetWindowProperty, but I'm way too tired to find out how to call that
right now :)

There are xlib bindings for fpc, so it shouldn't be hard to get it
working.

Hope that helps.

> Regards. Alexey

cheers,
   Danny


_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to