开发者

How to disable the automatic middle-click mouse events in X (Xlib)?

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. 开发者_JAVA技巧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?


To do this, you have to grab controls from the server. Then the window manager is left out of the processing chain. The most comfortable way is to use libSDL. It creates the appropriate context for a fullscreen OpenGL application and is easier to handle than Xlib+GLX.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜