Со мной можно связаться andrewcrew закорючка rambler.ru или по аське 552718211.
Пользователь решил продолжить мысль [time]Mon Mar 1 18:41:05 2010[/time]:
На всякий случай выложу пример простейшего перехвата клавиатуры и мыши сюда
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
Display *dis;
Window win;
XEvent report;
Window nw = None;
void update_focus()
{
if (nw != None)
XSelectInput (dis, nw, FocusChangeMask);
while (1)
{
int revert_to;
XGetInputFocus(dis, &nw, &revert_to);
// Catch not empty and not system window
if (nw != None)
break;
usleep(1000);
}
XSelectInput (dis, nw, FocusChangeMask | KeyPressMask);
}
int main()
{
dis = XOpenDisplay(NULL);
Window rw = RootWindow(dis, DefaultScreen(dis));
XGrabButton(dis, Button1, AnyModifier, rw, 0, ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
win = XCreateSimpleWindow(dis, RootWindow(dis, 0), 1, 1, 10, 10,0, BlackPixel (dis, 0), BlackPixel(dis, 0));
XFlush(dis);
XSelectInput (dis, win, FocusChangeMask);
update_focus();
while (1)
{
XNextEvent(dis, &report);
switch (report.type)
{
case KeyPress:
{
printf("KeyPress\n");
break;
}
case ButtonPress:
{
printf("ButtonPress\n");
// Unfreeze and resend grabbed event
XAllowEvents(dis, ReplayPointer, CurrentTime);
break;
}
//case FocusIn:
case FocusOut:
{
update_focus();
break;
}
}
}
return(0);
}
Компилировать и запускать командой
gcc -lX11 ./EventSample.c -o EventSample && ./EventSample