Re: SDL joystick events are intercepted by WebView on Android

"Noxalus" <[email protected]>
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
I finally found a way to solve my problem overriding some WebView methods:


Code:

    import android.webkit.WebView;
    import android.content.Context;
    import android.view.*;
    import org.libsdl.app.*;

    public class CustomWebView extends WebView
    {
        public CustomWebView(Context context)
        {
            super(context);
        }

        @Override
        public boolean dispatchKeyEvent(KeyEvent event)
        {
            // Dispatch the key events on the SDL canvas (including joystick buttons)
            SurfaceView surfaceView = (SurfaceView)SDLActivity.getLayout().getChildAt(0);

            return surfaceView.dispatchKeyEvent(event);
        }

        @Override
        public boolean onGenericMotionEvent(MotionEvent event)
        {
            // Dispatch the motion events on the SDL canvas (including joystick axes)
            SurfaceView surfaceView = (SurfaceView)SDLActivity.getLayout().getChildAt(0);

            return surfaceView.dispatchGenericMotionEvent(event);
        }
    }

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.