We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3398 - OSX menus unresponsive to mouse input until focus lost & regained.
Summary: OSX menus unresponsive to mouse input until focus lost & regained.
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.4
Hardware: x86 Mac OS X 10.11
: P2 normal
Assignee: Alex Szpakowski
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-26 21:45 UTC by Devon Sean McCullough
Modified: 2017-08-11 21:10 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Devon Sean McCullough 2016-07-26 21:45:57 UTC
/// sdl-menu-bug.c

// Menu Bar	(Apple)   sdl-menu-bug   Window   View
// unresponsive until the app loses and regains focus.

#include <SDL2/SDL.h>

  int
main () {
    SDL_Init (SDL_INIT_EVERYTHING);
    SDL_CreateWindow ("SDL2 Menu Bug", 100, 100, 800, 600, SDL_WINDOW_OPENGL);
    for (;;) {SDL_Event event;
      SDL_WaitEvent (&event);
      if (event.type == SDL_QUIT) { SDL_Quit (); return 0; }}}

// Local Variables:
// compile-command: "cc -g -O0 -F/Library/Frameworks -I SDL2-includes sdl-menu-bug.c -o sdl-menu-bug -framework SDL2 -Wl,-framework,Cocoa && ./sdl-menu-bug"
// End:
Comment 1 Philipp Wiesemann 2016-08-01 20:45:43 UTC
Maybe this is a similar problem like in bug #3365.
Comment 2 Devon Sean McCullough 2016-08-01 22:21:03 UTC
(In reply to Philipp Wiesemann from comment #1)
> Maybe this is a similar problem like in bug #3365.

Very different as SDL_WaitEvent calls SDL_PumpEvents() every 10ms.

		Peace
			--Devon

P.S. An initial 5s delay merely delays the black window's appearance,
then the buggy behavior is unchanged.

An initial PumpEvents before the delay merely gets a spinning beachball
while waiting for the black window to appear, otherwise unchanged.

Moving, minimizing and un-minimizing the window do not affect the bug.

In all cases the menus appear at once but are unresponsive to mouse input
until the window loses and then gains focus.
Comment 3 Devon Sean McCullough 2016-08-01 22:36:08 UTC
The menus do respond to keyboard shortcuts at all times.
Clover-Q, Clover-H and Clover-Alt-H always work.
Hiding and un-hiding does not affect the bug.
Comment 4 Devon Sean McCullough 2016-08-01 22:39:40 UTC
Delete Comment 3 line 3 please - obviously un-hiding gains focus.
Comment 5 Jim Van Verth 2016-08-05 21:34:20 UTC
This might be related to the line

[NSApp activateIgnoringOtherApps:YES]

in Cocoa_RegisterApp(). Commenting it out allows the menu to activate -- assuming
that the window activates. Without that line, it looks like file access (for me, 
anyway) prevents the window from activating.

I tried moving this to after window creation (as another framework does), but it 
didn't make any difference.