X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgbase%2Fdisplay.cpp;h=5d79ca5e9246210caa05472308e092f5b17c297b;hb=e9eec476bd26fb3f15d96d5bc91597770814768c;hp=3a755014c1996fe29083c2fda93e7958ad259c13;hpb=5b2c1ec3d21ae3d772354c75a8f522f856958127;p=libs%2Fgui.git diff --git a/source/gbase/display.cpp b/source/gbase/display.cpp index 3a75501..5d79ca5 100644 --- a/source/gbase/display.cpp +++ b/source/gbase/display.cpp @@ -187,7 +187,7 @@ void Display::tick() if(pending==0) break; - for(int i=0; idisplay, &event.xevent); @@ -197,6 +197,26 @@ void Display::tick() map::iterator j=priv->windows.find(event.xevent.xany.window); if(j!=priv->windows.end()) { + /* Filter keyboard autorepeat. If this packet is a KeyRelease and + the next one is a KeyPress with the exact same parameters, they + indicate autorepeat and must be dropped. */ + if(event.xevent.type==KeyRelease && !j->second->get_keyboard_autorepeat() && pending>0) + { + XKeyEvent &kev=event.xevent.xkey; + XEvent ev2; + XPeekEvent(priv->display, &ev2); + if(ev2.type==KeyPress) + { + XKeyEvent &kev2=ev2.xkey; + if(kev2.window==kev.window && kev2.time==kev.time && kev2.keycode==kev.keycode) + { + XNextEvent(priv->display, &ev2); + --pending; + continue; + } + } + } + j->second->event(event); } }