PDA

View Full Version : GLUT menu creation problem (Blue Book v5, Linux)



musasabi
01-29-2012, 01:04 PM
I'm reading through the Blue Book (my first foray into OpenGL) and compiling my code on Arch Linux. When I'm at school, I do it on my laptop. When I'm at home, I use my desktop. Both are sync'd with Dropbox and both are running the same versions of all software.

The interesting thing, though, is that when a project requires me to bind a menu to the right mouse button, for instance, it doesn't work on my desktop but it does work on my laptop.


glutCreateMenu(ProcessMenu);
glutAddMenuEntry("Toggle depth test", 1);
glutAddMenuEntry("Toggle cull backface", 2);
glutAddMenuEntry("Set Fill Mode", 3);
glutAddMenuEntry("Set Line Mode", 4);
glutAddMenuEntry("Set Point Mode", 5);

glutAttachMenu(GLUT_RIGHT_BUTTON);

The above code simply has a menu with the options listed pop up when I right click on the window. But, again, it works on my laptop, but not on my desktop.

The only difference I'm aware of is that my laptop uses a standard trackpad, whereas my desktop has the Microsoft Wireless 7000 keyboard/mouse combo. What's odd is that right clicking works for everything else graphical.

Any ideas?

Dark Photon
01-30-2012, 06:35 AM
Any ideas?
The window manager on your desktop may not be configured to pass the right ButtonPress/ButtonRelease events to the application for some reason. That would be weird, but it's something to check.

You can check this by writing a little app that creates an X window with ButtonPressMask enabled (so it receives mouse button events), and then just print something when you receive ButtonPress and ButtonRelease events.

...actually, there's already one out there. Just run "xev", move your mouse into the rectangle, and then click your right mouse button (if you don't have it installed, it's probably part of an "xorg-x11-utils" package or similar -- install that). If that works, and you don't have any window-manager behavior overrides for your specific application, then it's probably something your application is doing wrong to receive those events.

Try glutMouseFunc and see if you can receive them that way.