Bug 103143 - glutShowWindow / glutHideWindow calls fail on MacOS, not Linux.
Summary: glutShowWindow / glutHideWindow calls fail on MacOS, not Linux.
Status: RESOLVED DUPLICATE of bug 100836
Alias: None
Product: XQuartz
Classification: Unclassified
Component: quartz-wm (show other bugs)
Version: 2.7.11 (xserver-1.18.4)
Hardware: x86-64 (AMD64) Mac OS X (All)
: medium blocker
Assignee: Jeremy Huddleston Sequoia
QA Contact: Jeremy Huddleston Sequoia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-08 08:35 UTC by Alex Garrett
Modified: 2017-10-08 19:11 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Alex Garrett 2017-10-08 08:35:16 UTC
MacOS Sierra 10.12.6
XQuartz 2.7.11
Freeglut 2.3.1 or 3.0.0 

Code: 
     // This is standard freeglut code
     glutSetWindow(<Window ID>)
     glutHideWindow() // or glutShowWindow 

Error:

xp_attach_gl_context returned: 2
X Error of failed request:  0
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  26 (X_GLXMakeContextCurrent)
  Serial number of failed request:  13960
  Current serial number in output stream:  13960

OS/X test FAIL:

build code for Darwin
Run from Mac terminal (brings up XQuartz)

     $ aGlutApp

Click gui button, to activate show or hide glut call. App crashes with supplied error. 

Linux Test OK:

Build same code for Linux (Ubuntu, Debian).
Run from xterm.
Click button and window hides / is shown.

OS/X test OK:

From Mac terminal
$ xinit
From supplied xterm
$ aGlutApp

The App now has no title bar / frame (no window manager). 
Click button and window hides / is shown.

OS/X tsst FAIL:

From Mac terminal
$ xinit
From supplied xterm
$ quartz-wm 
$ aGlutApp

The App now has title bar / frame, is using default window manager.
Click button and get crash, XServer error as supplied.

With no locally provided X configuration files, the default configuration of the window manager may be at fault.  

Not sure how to work around this, would wish to supply such code to run on other standard configuration Mac's. 
 
Thx
Comment 1 Alex Garrett 2017-10-08 09:00:50 UTC
I do not see an uninstall option, in a new download of server (XQuartz-2.7.11.dmg), so ran another install. Assumption: test against a fresh install.

Same X error generated by app code.
Comment 2 Alex Garrett 2017-10-08 10:44:46 UTC
Tested workaround.

NB the tested glut code underpins a GUI, that wraps an openGL application. 

OpenGL in mind, I feel a little misdirected, in that I am sure I have repeatedly read, from official sources, that GLUT is old and should not be used, and that FreeGlut is an acceptable replacement.

And yet, on Mac OS, with no change to source code, but a change in 'linkage', I have identified a workaround.

# LINKDIR =  -L/usr/local/lib       # avoid freeglut's libglut.*
COMMONLIBS = -framework GLUT        # link to Apple supplied glut

So linking against Apple's GLUT, the target window can now hide / show, as per Glut / Freeglut API definition.

The app's windows are now not X11 based (as in no XQuartz). Freeglut has the dependency on X11.

I'll leave identification of window manager quartz-wm issue to others, more knowledgeable. Perhaps if I switched for another WM, that would fix the problem!

But I'm looking for an easy user experience (just download the app and run), so this solution is sufficient.
Comment 3 Jeremy Huddleston Sequoia 2017-10-08 19:11:41 UTC

*** This bug has been marked as a duplicate of bug 100836 ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.