|
[code:1]
//gcc -O2 -o test test.c -L/usr/X11R6/lib -lX11
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xos.h>
#include <X11/Xutil.h>
#include <stdio.h>
int main() {
Display *display;
Window focus;
XWindowAttributes win_attr;
int revert;
display = XOpenDisplay(NULL);
XGetInputFocus(display,&focus,&revert);
XGetWindowAttributes(display, focus, &win_attr);
printf("%x\n",focus);
printf("width:%d,height:%d\n",win_attr.width,win_attr.height);
}
[/code:1]
运行结果是:
[root@localhost test]# ./test
300001c
width:1,height:1 |
|