Menus Sometimes Not Working Under OS4.1FE

This forum is for general developer support questions.
Post Reply
User avatar
Daedalus
Posts: 42
Joined: Sat Jun 18, 2011 12:30 am
Location: From Ireland, living in Glasgow
Contact:

Menus Sometimes Not Working Under OS4.1FE

Post by Daedalus »

Hi,
I'm working on a simple little game in AmiBlitz. It pretty much all works fine, except that in certain cases while playing, the intuition menus on my window no longer respond when selected. However, they still respond to keyboard shortcuts, and all other events (gadgets, mouse clicks and window close) are still recognised and acted upon. As far as I can tell, this appears to be related to having the menu open when the window needs to be redrawn - the game window can be redrawn every second in certain circumstances and having the intuition menu open blocks this as expected.

It doesn't happen under OS3.9, either with the native menus or Magic Menus, so OS4.1FE appears to show different behaviour in this case.

Is this a known phenomenon / expected behaviour? And is there anything that can be done to work around it?

Thanks!
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Menus Sometimes Not Working Under OS4.1FE

Post by broadblues »

Does it make a difference if you run on Update 6 ? If not then you shouldn't blame 4.1FE :-) Rather OS 4 in general....

As why, need more info, have you set IDCMP_MENUVERIFY ? If so do you respond to it quickly (not doing so would block the menu)?

If you set menus themselves to non blocking does it work better?

There are a couple of application that have bugs causing delayed menus (Audio Evolution being one) but what exactly they do wrong I don't know, there a specific timeout in intuition to enable them to continue working IIRC.
User avatar
Daedalus
Posts: 42
Joined: Sat Jun 18, 2011 12:30 am
Location: From Ireland, living in Glasgow
Contact:

Re: Menus Sometimes Not Working Under OS4.1FE

Post by Daedalus »

I haven't tried it under Update 6, or with non-blocking menus. I was just thinking about it and thought I'd ask in case there was some feature of the new menu system that I was running into without realising, but I'll try the others this evening when I get home. I'll also have a look at my source because I don't remember using the MENUVERIFY flag, but I could be wrong.

Thanks for the reply!
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: Menus Sometimes Not Working Under OS4.1FE

Post by thomasrapp »

MENUVERIFY is unlikely because it would block the menus from opening. But I understand that your menus do open and act normally, just don't send selections to your program. I rather suspect other IDCMP messages which might appear while your program is blocked from responding, for example INTUITICKS.

Or perhaps you "forgot" to reply a previous MENUPICK message.
User avatar
Daedalus
Posts: 42
Joined: Sat Jun 18, 2011 12:30 am
Location: From Ireland, living in Glasgow
Contact:

Re: Menus Sometimes Not Working Under OS4.1FE

Post by Daedalus »

Yes, the menus open and act normally, but no event is received by my program. The program is still listening for messages and receives the event from any keyboard shortcuts that are assigned to the menu items, just not when the item is selected using the mouse which makes me think that my program is responding to all messages as it should.

The only thing I can think of is that, since opening the menu blocks my program from updating the window, once it is released and redraws the event queue is flushed for some reason or the menu event is swallowed by the redraw process. I'll try to do some more investigations tonight and see what I can figure out...

Edit: I realise now that using the phrase "no longer respond" in my first post was a little ambiguous, sorry about that. They do indeed respond, and checkmarks can be enabled and disabled, MX items can be switched, but no events are received by my main loop.
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Menus Sometimes Not Working Under OS4.1FE

Post by broadblues »

Okay I understand your problem better now. I original took it that menus were delayed in opening, if in fact they do open promptly but you don't appear to get the message then I can think of a few possibilties to investigate.

1. No IDCMP_MENUPICK - unlikely as you seem to sugest the issue is intermittant.
2. Is your event loop processing *all* recieved messages? Ie looping till GetMsg returns 0 ? I'm assuming your not using reaction here.
3. There is a queue limit as you say, but I find it unlikely you would be filling it if you are getting the keyboard shortcuts. Actually just checking the openwindow tags that limit is for mouse move events only, so not likely the cause at all.
User avatar
Daedalus
Posts: 42
Joined: Sat Jun 18, 2011 12:30 am
Location: From Ireland, living in Glasgow
Contact:

Re: Menus Sometimes Not Working Under OS4.1FE

Post by Daedalus »

Well, I've done some more testing, and the problem *only* happens when the window tries to refresh while the menu is open. So, if I open the menu and select the item I want before a refresh is needed then everything works as required. It's only when my program tries to refresh the window that the event message goes missing. Also, immediately after the refresh, everything works fine again and event messages are received as normal so there's nothing stuck in the queue. Non-blocking menus don't cause any problems - everything works as it should.

I'm just using GadTools (and only one gadget), no Reaction, ARexx or anything else to listen for, so I was only looking for event messages. But I've made sure to check for all messages now and there are none...
User avatar
Daedalus
Posts: 42
Joined: Sat Jun 18, 2011 12:30 am
Location: From Ireland, living in Glasgow
Contact:

Re: Menus Sometimes Not Working Under OS4.1FE

Post by Daedalus »

Okay, got to the bottom of this issue. It seems that the events queue is being flushed when I refresh the gadgets in the window. I was doing that by detaching and reattaching the GTList since the autodocs advise against forcing a refresh. This method appears to retain the queue under OS3 but that could be a (dangerous) coincidence if the GTList was recreated at the same address. So I've worked around the need to redraw the gadgets and it all works fine now.

Thanks for the feedback!
Post Reply