XGetWindowAttributes: 1x1 pixel for GTK apps?
- From: Adenilson Cavalcanti <savagobr yahoo com>
- To: gtk-devel-list gnome org
- Subject: XGetWindowAttributes: 1x1 pixel for GTK apps?
- Date: Sun, 2 Sep 2007 15:51:02 -0700 (PDT)
Friends
I'm trying to get the dimensions (width and height) of current 'in focus' window using XGetWindowAttributes.
It works fine with KDE or Xlib based applications, but fails with
all GTK based applications (window_attr.width and window_attr.height
reports just '1'). The same behavior happens in Ubuntu 6.06, 6.10, 7.04
when running Metacity as window manager (but not with Compiz or Beryl).
Following bellow a test app that demonstrates what I'm saying:
/*******************************************************************/
#include <X11/Xlib.h>
#include <stdio.h>
int main(void)
{
Display *display;
int res = -1, tmp, revert_to;
Window window;
XWindowAttributes window_attr;
display = XOpenDisplay(NULL);
if (!res)
return -1;
while (1) {
printf("will grab a window in 3s...\n");
sleep(3);
tmp = XGetInputFocus(display, &window, &revert_to);
if ((tmp == BadValue) || (tmp == BadWindow))
return -1;
tmp = XGetWindowAttributes(display, window, &window_attr);
if ((tmp == BadDrawable) || (tmp == BadWindow))
return -1 ;
printf("width = %d\theigth = %d\n", window_attr.width,
window_attr.height);
}
return 0;
}
/*******************************************************************/
I already searched the internet for any information concerning
this, with no success. The gtk-app-devel-list doesn't return anything
(as also gtk-devel-list).
The only reference in bugzilla to XGetWindowAttributes is:
"GDK cannot give input focus to an override_redirect window"
http://bugzilla.gnome.org/show_bug.cgi?id=143349
Maybe I'm forgetting something related to Xlib, do you guys have
any idea of what is wrong here? Any of you know a way to known the
window dimensions of GTK apps *using xlib*?
Best regards
Adenilson
Sick sense of humor? Visit Yahoo! TV's
Comedy with an Edge to see what's on, when.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]