I am currently implementing a program in X11 using C. I got the program to handle right- and left-click events, however middle-clicking poses a problem. It seems my window manager (Gnome on Ubuntu 9.10) thinks it's better if, instead of having a single middle-click, I should have a series of other clicks instead. I assume it's got something to do with the middle-click being used for copying-pasting. I really don't want this, though, as I'm making a full-screen application with OpenGL, and such things aren't appropriate. Is there any way to have the middle mouse button just working like any other button?
My current code goes something like this:
switch(currentXEvent.type) {
case ButtonPress:
switch(currentXEvent.xbutton.button) {
case 1:
leftMouseButton(currentXEvent.xbutton.x, currentXEvent.xbutton.y);
break;
case 2:
middleMouseButton(currentXEvent.xbutton.x, currentXEvent.xbutton.y);
break;
}
}
My difficulty is that it behaves like leftMouseButton() has been pressed. Any ideas?