#54 callback of glutMenuStatusFunc never called

closed-fixed
nobody
None
5
2012-08-06
2004-10-12
No

Callbacks registered by glutMenuStatusFunc and
glutMenuStateFunc are never called.
When I have checked sources of freeglut-2.2.0 and nightly
CVS(2004-09-25), these seems to have no code to do
callback.

Here is a patch.

I have tested on Linux (SUSE 9.1).
On other platform (WIN32), mouse position passed to
callback
may be incorrect (when GLUT_MENU_NOT_IN_USE). Please
revise.

Discussion

  • Takeshi Nishimura

    Logged In: YES
    user_id=1121281

    The second attached file is a test program.

    Click left button, and you have
    -- BEGIN
    menustate: IN_USE
    in <window ID> <menu ID>
    menustatus: IN_USE <mouse position>
    in <window ID> <menu ID>
    -- END
    When you close all menus, you have
    -- BEGIN
    menustate: NOT_IN_USE
    in <window ID> <menu ID>
    menustatus: NOT_IN_USE <mouse position>
    in <window ID> <menu ID>
    -- END

    This behavior is little bit different from GLUT 3.7 (which
    outputs
    menustatus: only).
    I don't think this difference will cause real problem.

     
  • Takeshi Nishimura

    Test Program for MenuStatus callback

     
    Attachments
  • Richard Rauch

    Richard Rauch - 2004-10-12

    Logged In: YES
    user_id=854844

    Hm. I never used this feature.

    It seems that you are saying that GLUT lets you call
    glutMenuStatusFunc() once for the entire program. I had
    the impression that you bound it on a per-window or
    per-menu basis. (Of course, freeglut stores just one
    callback for the client. I figured that that was a bug in
    freeglut, based on my understanding of GLUT.)

    Out of curiosity, does this materially affect freeglut?
    The feature was instated in old GLUT, I think, so that you
    could avoid the (illegal) alteration of your menus while
    they were being displayed.

    I ask since I think that OpenGLUT can probably pass on
    implementing this fix. (OpenGLUT is not so concerned with
    precise compatibility with old GLUT.)

     
  • Takeshi Nishimura

    Logged In: YES
    user_id=1121281

    (I found this is same as the initial question of Bugs ID
    #864351. Sorry for redundancy.)

    Thank you for your reply.

    > I had
    > the impression that you bound it on a per-window or
    > per-menu basis.

    No.
    As the document says, MenuStatus callback function is global.
    The callback function is once called when any menus on any
    windows are activated, and once when none of menus is active.

    This is what the document says and my patch is intended to
    do so carefully.
    One difference comes from the fact that freeglut can
    activate multiple menus on multiple windows simultaneously.

    > Out of curiosity, does this materially affect freeglut?

    Excuse me, I cannot understand your words.
    I don't think this patch is incompatible with GLUT 3.7.
    Any ideas or suggestions are welcome.

    In order to close the difference between GLUT 3.7 and
    freeglut (described above), I will show you the patch to
    force at most one menu on the screen.

     
  • Takeshi Nishimura

    MenuStatus callback patch (revised)

     
  • Takeshi Nishimura

    Logged In: YES
    user_id=1121281

    Sorry, trivial mistake in the patch.
    Revised.

     
  • Richard Rauch

    Richard Rauch - 2004-10-14

    Logged In: YES
    user_id=854844

    Okay, I apparently misunderstood the documentation of GLUT
    for this function.

    When I asked "does this materially affect freeglut," what I
    meant was: Does it make any difference? I asked this because
    freeglut does menus in a way that is very different from how
    old GLUT did them.

    As I think about it again, I believe now that the answer is
    "Yes, it does matter."

     
  • Takeshi Nishimura

    Logged In: YES
    user_id=1121281

    At a glance of codes of WIN32, I don't know you can get the
    absolute coordinates of the mouse, not relative to the window.

    Is it useful to provide a helper function such as
    fgInvokeMenuStatusCallback(menu, in_use, mouse_in,
    x_in_win, y_in_win)
    ? It can use the coordinates (x_in_win, y_in_win) relative
    to the window "mouse_in" in order to translate to relative
    to the menu "menu".
    ("in_use" represents GLUT_MENU_IN_USE or GLUT_MENU_NOT_IN_USE.)

     
  • Takeshi Nishimura

    Logged In: YES
    user_id=1121281

    > This is what the document says and my patch is intended to
    > do so carefully.
    > One difference comes from the fact that freeglut can
    > activate multiple menus on multiple windows simultaneously.

    > In order to close the difference between GLUT 3.7 and
    > freeglut (described above), I will show you the patch to
    > force at most one menu on the screen.

    See Bugs#1051977.
    https://sourceforge.net/tracker/?func=detail&aid=1051977&group_id=1032&atid=101032

     
  • Diederick C. Niehorster

    glutMenuStatusFunc/glutMenuStateFunc now implemented in a (hopefully completely) GLUT compatible way. Mirroring the docs anyway

     
  • Diederick C. Niehorster

    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks