How do I assign mouse input to the proper window with multiple GLX windows?
March 22, 2007 9:19 PM   Subscribe

How do I assign mouse input to the proper window with multiple GLX windows?

I am programming an application that can render to several possible types of windows (GLUT, MFC, etc.) depending on platform. It is configured so that multiple windows can be displayed simultaneously.
I am having some trouble adding GLX window support under Linux. I can set up multiple windows and display different content on each: that works just fine. But if someone clicks on a window, I don't know how to assign the click to the proper window (though I can register its location in x, y coords). I'm having a hard time finding documentation (or a tutorial) that helps with this issue. Does anyone know where I can find some good information online?
For now, all of the windows are on the same display.
Also, it is important that this be done with GLX windows, so please do not suggest that I just use GLUT and be done with it.
Thank you.
posted by Java_Man to Computers & Internet (3 answers total)
You may need to implement a socket mechanism to ensure Java calls are sent to the GLX application's main processing thread, as sockets are one reliable way for inter-application processing to occur with GLX. See Listing 4 of this page for example code. Then, focus calls back to GLX via the messaging socket should do the trick.
posted by paulsc at 11:06 PM on March 22, 2007

Response by poster: I should have specified that--despite my handle--this is all being implemented in C++.
posted by Java_Man at 5:05 AM on March 23, 2007

Best answer: There's a field called 'window' in most X event structures, such as XButtonEvent and XMotionEvent. Use it.
posted by jepler at 7:58 AM on March 23, 2007

« Older How to prevent plagarism?   |   finding a doctor. Newer »
This thread is closed to new comments.