Bug 699726 - GLUT_ACTION_ON_WINDOW_CLOSE does not exist on macOS
Summary: GLUT_ACTION_ON_WINDOW_CLOSE does not exist on macOS
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: master
Hardware: Macintosh MacOS X
: P4 normal
Assignee: MuPDF bugs
URL:
Keywords:
: 699374 699833 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-09-06 09:30 UTC by Mojca Miklavec
Modified: 2019-09-05 14:33 UTC (History)
4 users (show)

See Also:
Customer:
Word Size: ---


Attachments
glutGetModifiers() may only be used in on_keyboard, on_special, on_mouse and on_wheel. (449 bytes, patch)
2019-09-02 10:04 UTC, Yorick Hardy
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mojca Miklavec 2018-09-06 09:30:36 UTC
The following line does not seem to work (or make sense?) on macOS:

glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);


Maybe it could be replaced by something like

#if defined(GLUT_ACTION_ON_WINDOW_CLOSE)
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
#endif

but I have no idea about how GLUT is supposed to work.
Comment 1 Mojca Miklavec 2018-09-06 09:33:48 UTC
I forgot to include the actual error report:

platform/gl/gl-main.c:1677:16: error: use of undeclared identifier 'GLUT_ACTION_ON_WINDOW_CLOSE'
        glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
                      ^
platform/gl/gl-main.c:1677:45: error: use of undeclared identifier 'GLUT_ACTION_GLUTMAINLOOP_RETURNS'
        glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
                                                   ^

I have tested on macOS 10.13. The user reporting the problem on IRC (https://ghostscript.com/mupdfirclogs/2018/03/20.html) worked around it with "HAVE_GLUT=no" (not a real solution).
Comment 2 Mojca Miklavec 2018-10-09 06:34:46 UTC
There were some changes in 1.14.0. Maybe those fixed the issue (I cannot reliably test right now since I have other issues with font installation).
Comment 3 Alan Braslau 2018-10-22 22:20:59 UTC
mupdf compiles under MacOS X now, but gives the runtime error:

mupdf-gl[52876:870240] GLUT Warning: glutCurrentModifiers: do not call outside core input callback.

in a loop.
Comment 4 Tor Andersson 2018-11-07 14:17:15 UTC
*** Bug 699833 has been marked as a duplicate of this bug. ***
Comment 5 Tor Andersson 2018-11-07 19:37:07 UTC
*** Bug 699374 has been marked as a duplicate of this bug. ***
Comment 6 Yorick Hardy 2019-09-02 10:04:44 UTC
Created attachment 18067 [details]
glutGetModifiers() may only be used in on_keyboard, on_special, on_mouse and on_wheel.

The messages "glutCurrentModifiers: do not call outside core input callback" are due to the use of glutGetModifiers() outside of the on_keyboard, on_special, on_mouse and on_wheel callbacks.

Do we lose anything if we simply omit the calls?
Comment 7 Tor Andersson 2019-09-02 13:12:56 UTC
Omitting glutGetModifiers from on_motion will mean that when drag selecting you cannot change select by word/line dynamically, you will have had to hold down ctl or ctl+shift at the start of the mouse down. This is not a big enough deal to worry about; I have a fix in the works.
Comment 8 Tor Andersson 2019-09-05 14:33:15 UTC
commit e30303148f78081a8cf48a36a1ad3144897da812
Author: Tor Andersson <tor.andersson@artifex.com>
Date:   Mon Sep 2 15:12:21 2019 +0200

    Bug 699726: Don't call glutGetModifiers from motion callbacks.
    
    The only valid callbacks for this function are the mouse and keyboard
    callbacks.