projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
glutGet window position should be relative to parent
[freeglut]
/
src
/
x11
/
fg_state_x11.c
diff --git
a/src/x11/fg_state_x11.c
b/src/x11/fg_state_x11.c
index
3aa19b1
..
79a7ac9
100644
(file)
--- a/
src/x11/fg_state_x11.c
+++ b/
src/x11/fg_state_x11.c
@@
-88,15
+88,23
@@
int fgPlatformGlutGet ( GLenum eWhat )
case GLUT_WINDOW_HEADER_HEIGHT:
{
int x, y;
case GLUT_WINDOW_HEADER_HEIGHT:
{
int x, y;
- Window w;
+ Window p,w;
if( fgStructure.CurrentWindow == NULL )
return 0;
if( fgStructure.CurrentWindow == NULL )
return 0;
+ if (fgStructure.CurrentWindow->Parent)
+ /* For child window, we should return relative to upper-left
+ * of parent's client area.
+ */
+ p = fgStructure.CurrentWindow->Parent->Window.Handle;
+ else
+ p = fgDisplay.pDisplay.RootWindow;
+
XTranslateCoordinates(
fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle,
XTranslateCoordinates(
fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle,
- fgDisplay.pDisplay.RootWindow,
+ p,
0, 0, &x, &y, &w);
switch ( eWhat )
0, 0, &x, &y, &w);
switch ( eWhat )
@@
-105,7
+113,8
@@
int fgPlatformGlutGet ( GLenum eWhat )
case GLUT_WINDOW_Y: return y;
}
case GLUT_WINDOW_Y: return y;
}
- if ( w == 0 )
+ if ( w == 0 || fgStructure.CurrentWindow->Parent)
+ /* logic below needs w, and child windows don't have borders */
return 0;
XTranslateCoordinates(
fgDisplay.pDisplay.Display,
return 0;
XTranslateCoordinates(
fgDisplay.pDisplay.Display,
@@
-155,6
+164,7
@@
int fgPlatformGlutGet ( GLenum eWhat )
else
{
XVisualInfo * visualInfo;
else
{
XVisualInfo * visualInfo;
+ int result;
#ifdef EGL_VERSION_1_0
EGLint vid = 0;
XVisualInfo visualTemplate;
#ifdef EGL_VERSION_1_0
EGLint vid = 0;
XVisualInfo visualTemplate;
@@
-166,13
+176,15
@@
int fgPlatformGlutGet ( GLenum eWhat )
visualTemplate.visualid = vid;
visualInfo = XGetVisualInfo(fgDisplay.pDisplay.Display, VisualIDMask, &visualTemplate, &num_visuals);
#else
visualTemplate.visualid = vid;
visualInfo = XGetVisualInfo(fgDisplay.pDisplay.Display, VisualIDMask, &visualTemplate, &num_visuals);
#else
+ {
const GLXFBConfig fbconfig =
fgStructure.CurrentWindow->Window.pContext.FBConfig;
visualInfo =
glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, fbconfig );
const GLXFBConfig fbconfig =
fgStructure.CurrentWindow->Window.pContext.FBConfig;
visualInfo =
glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, fbconfig );
+ }
#endif
#endif
- const int result = visualInfo->visual->map_entries;
+ result = visualInfo->visual->map_entries;
XFree(visualInfo);
XFree(visualInfo);