wxOSX/Carbon: wxGLCanvas mouse offset in non-floating window classes
I mainly program plugins using wxWidgets within a Carbon bundle which is
loaded at runtime. The host-applications where my plugins are running in
provide a native window handle (WindowRef
), which I can use to add my custom,
wxWidgets-based GUI-classes.
To use the native window handle with wxWidgets
classes I had to write a wxTopLevelWindow
wrapper class, which does all the
WindowRef
encapsulation. So far, this works pretty well, but under some
circumstances I got vertical mouse offsets within a wxGLCanvas
if the window
class of the native window handle is not of the type "kFloatingWindowClass
".
I am able to bypass the problem if I display an info panel (wxPanel
) over the
whole wxGlCanvas
and if the user hides the info panel then the mouse offset
is gone.
Now my questions:
- Is there a "simple" explanation for this behaviour?
- Is it possible to use certain method calls to imitate info panel effect
without using the panel itself? I tried several combinations of
Update()
andRefresh()
calls of all involved components, but none of them worked so far. Even the use ofwxSizer
couldn't help here.
Window hierarchy used by plugin-applications:
wxCustomTopLevelWindow (WindowRef provided by host-application) wxPanel (par开发者_如何学Goent window for all application panel) wxPanel (application info panel) wxPanel (application main panel) wxPanel (opengl main panel) wxGlCanvas (main opengl canvas)
Any ideas? Any help is very appreciated.
Is it a co-ordinate system mismatch? Some Mac OS X APIs use the top-left as the origin (positive y goes down), whereas others use the lower-left (positive y goes up).
This can seem intermittent, as the error will be small near the vertical center of the screen; farther from the center, the co-ordinate will appear to be wildly inaccurate (indeed, it's on the opposite side of the screen).
I am able to bypass the problem if I display an info panel (
wxPanel
) over the wholewxGlCanvas
and if the user hides the info panel then the mouse offset is gone.
This could be a red herring, if you were popping up this panel in the middle of the screen and closing it with the mouse.
精彩评论