xbindkeys doesn’t work on russian layout in Gnome

So, I’m using Elementary OS for a long time and one day I decided to install Gnome DE for variety. I started to customizing it for myself and everything was ok, until I got to xbindkeys. I’m using this program in my Pantheon DE (default DE for Elementary OS) for mapping mouse arrows as desktop switchers – it’s very comfortable.

So in Gnome (Xorg) it works at half. In US keyboard layout everything is good, it works very well. But when I switch to the russian keyboard layout it just stops working. Daemon is still working, but nothing happened. I decided to run xbindkeys -v to get more information. I realized that e.xbutton.button is the same at all layouts, but e.xbutton.state is strange on russian layout – 8208. I found this post, get the patch from it, get xbindkeys source by typing: git clone http://git.savannah.gnu.org/cgit/xbindkeys.git. Git didn’t want to apply patch by git apply -v xbindkeys_patch.patch, it says, what can’t find wanted line. I opened file, which should be edited, and realized, that it already has this fixed. Very interesting! I builded it and installed it as sayng in the ‘INSTALL’ file:

$   ./configure $   make $   sudo make install 

Now the following happened: xbindkeys now received mouse button in russian layout and switch desktop, but… But it takes a second or 1.5 seconds. On US layout everything works immediately like before.

I decided to dig deeper. Using the best debuging principles (prinf-debuging) I found a problem in source code. This program uses Xlib API and it calls to XNextEvent() function, which takes this extremely lot of time on russian layout.

So it happens only in Gnome session. And I don’t know what to do next. I would appreciate any help.