Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: X11 and repeat rates... bahhh [Solved]  (Read 1247 times)

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
X11 and repeat rates... bahhh [Solved]
« on: October 02, 2005, 01:01:56 PM »

Well, X sends out key events kinda messed up (IMHO)... when auto repeat is enabled (typically it is), you get the first event.. then you get repeated KyDown/KeyUp events when repeat kicks in... Now, I wish X could send out a flag saying something to the effect that this is a regenerated key.. or maybe that this event happened at the same time as the last event (maybe it does.. I'll have to look further), but anyway.. Knda sucks.. I found a little hack by running xet r off when the lib starts to turn of repeats.. But, more thought needs to go into this.

Edit
Ok, well, I added some code to check for this (without using the xset), and well, it works 95% time.. depending on how fast the user is pressing and releaseing keys... In some situations the user may press one key, hold it, press another key, and the key will show as repeat... Though, most of the time the workaround prevents repeats.. But, for needed 100% accuracy, there is still the option to use xset.
Logged

Anonymous

  • Guest
X11 and repeat rates... bahhh [Solved]
« Reply #1 on: October 16, 2005, 04:44:52 PM »

I found an X method that also disables the repeat rate.. Though, still no way.. SO I will migrate to that soon...

Just a little code snippet I found for dealing with mouse cursor.. Just put here as I have no convienient place for it atm.
Code: [Select]

void XvVideoOutput::hide_cursor(void)
{
Cursor no_ptr;
Pixmap bm_no;
XColor black, dummy;
Colormap colormap;
static char no_data[] = { 0,0,0,0,0,0,0,0 };

colormap = DefaultColormap(XJ_disp, DefaultScreen(XJ_disp));
XAllocNamedColor(XJ_disp, colormap, "black", &black, &dummy);
bm_no = XCreateBitmapFromData(XJ_disp, XJ_win, no_data, 8, 8);
no_ptr = XCreatePixmapCursor(XJ_disp, bm_no, bm_no, &black, &black, 0, 0);

XDefineCursor(XJ_disp, XJ_win, no_ptr);
XFreeCursor(XJ_disp, no_ptr);
}
Logged