Re: [hatari-devel] Re: Hatari SDL2

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Thomas,

On Aug 17, 2014, at 5:17 PM, Thomas Huth <th.huth@xxxxxx> wrote:

>> 
>> 3. In SDLMain.m, I changed the SDL_main call in
>> applicationDidFinishLaunching to status = SDL_Init
>> (SDL_INIT_EVERYTHING); I tried just using SDL_INIT_VIDEO, but it did
>> not make a difference.
> 
> Mhh, could you please have one more try: Undo change #3, i.e. put the
> call to SDL_main back into applicationDidFinishLaunching.
> Then go to src/main.c and rename the main() function there to
> SDL_main(). I'm curious if that makes a difference.
> 

Actually, this gets me 90% of the way to a working SDL 2 version of OS X Hatari. The last remaining problem is because of behavior change in SDL2. In SDL 1.x, system events (Cmd-Q, Cmd-F, etc.) were trapped by SDL. In SDL 2, these system shortcuts are passed to the OS by default. That makes sense for 99% of SDL applications. Unfortunately, the OS X version of Hatari selected shortcuts (Cmd-F, Cmd-M, etc.) that conflict with the OS shortcut. However, if I use the standard Hatari shortcut keys (AltGr-M, AltGr-F), then Hatari behaves as I would expect. A side-effect of using AltGr-F is that it also appears to be bound to the Create Blank Floppy menu item. Therefore, when I go into full-screen mode, I see the Create Blank Floppy window appear behind the Hatari window as I enter full-screen mode. The Create Blank Floppy window is still there when I exit full-screen mode.

These are the problems I see now:
1. If I use Cmd-F to enter full-screen mode, Hatari will start entering full-screen mode and immediately crash. If I use AltGr-F, Hatari can enter full-screen mode successfully. I am assuming that OS X is trying to do its own full-screen logic that crashes Hatari.
2. When entering full-screen mode, sometimes both mouse cursors (ST and Mac) are on the screen. It seems to depend on the state of the Mac cursor prior to entering full-screen mode.
3. I have to move the mouse in full-screen mode in order for Hatari to take up the entire screen.
4. The A and B drive icons appear to be blockier in full-screen mode than they are in the SDL 1.x version.
5. Right now, the Preferences menu item does not work. I am not sure why that is the case. 

To work around the behavior change, I attempted to set SDL_HINT_GRAB_KEYBOARD to 1 in SDLMain.m. I did this in the identical place where SDL_ENABLEAPPEVENTS is commented out to prevent this exact behavior. Unfortunately, I am either using this variable incorrectly, have it the wrong place, or misunderstand what it does. I say this because the OS X system shortcut is still being executed. I commented out the line where I set SDL_HINT_GRAB_KEYBOARD in case it was getting in the way of the Preferences window. Unfortunately, it did not help.

For those of us with US keyboards (Mac or Windows), the AltGr key corresponds to the right Option key. For Windows users, it is the right Alt key that you already use in Hatari for the shortcuts.

Even with all of my comments, I feel a lot better about the possibility of getting the OS X version of Hatari running under SDL 2. I definitely see a lot of improvements in the framework since SDL 1.x.





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/