Originally posted by RigidBody:
[b]try
XQueryKeymap(display, keys_return)
Display *display;
char keys_return[32];
to get the actual state of the keyboard.
keys_return has a size of 32 byte, which is 256
bit. each key is represented by one bit.
for the pointer, use
Bool XQueryPointer(display, w, root_return, child_return, root_x_return, root_y_return, win_x_return, win_y_return, mask_return)
Display *display;
Window w;
Window *root_return, *child_return;
int *root_x_return, *root_y_return;
int *win_x_return, *win_y_return;
unsigned int *mask_return;[/b]
XQueryPointer i’m already using to avoid laginess of my mouse (an optical one if this is important).
the keyboard i did not poll like this yet, may try it.
still leaves the question why with XQueryPointer my mouse lags if i have heavy shaders. i wonder if the opengl-shader usage somehow blocks the x-server. can’t think of something else. or is my setup bad?
that’s my message loop
// sync to get all messages processed
// XSync(p_Display, False);
XFlush(p_Display);
// check messages
while(XPending(p_Display)){
XNextEvent(p_Display, &event);
// process event on your own
// ... ... ...
}
}
that’s how my window event mask is setup
int deAppDisplay::linGetEventMask(){
return StructureNotifyMask
| ExposureMask
| ButtonPressMask | ButtonReleaseMask
// | ButtonMotionMask | MotionNotify | PointerMotionMask | PointerMotionHintMask
| KeyPressMask | KeyReleaseMask
| EnterWindowMask | LeaveWindowMask
| FocusChangeMask;
}
something wrong there? i fiddled around a lot with those settings trying to find one which does not lag.