Disable keypress when stylus hovers over screen for Galaxy Note, also fixed bug in my prev commit

This commit is contained in:
pelya
2012-06-08 18:53:20 +03:00
parent 4175915a1c
commit 4e69f9645f
4 changed files with 25 additions and 3 deletions

View File

@@ -68,6 +68,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Message;
import java.util.concurrent.Semaphore;
public class MainActivity extends Activity {
@Override
@@ -145,7 +146,20 @@ public class MainActivity extends Activity {
p.LoadLibraries();
p.mAudioThread = new AudioThread(p);
System.out.println("libSDL: Loading settings");
Settings.Load(p);
final Semaphore loaded = new Semaphore(0);
class Callback2 implements Runnable
{
public MainActivity Parent;
public void run()
{
Settings.Load(Parent);
loaded.release();
}
}
Callback2 cb = new Callback2();
cb.Parent = p;
p.runOnUiThread(cb);
loaded.acquireUninterruptibly();
if(!Globals.CompatibilityHacksStaticInit)
p.LoadApplicationLibrary(p);
}

View File

@@ -198,6 +198,15 @@ class Settings
for( int i = 0; i < Globals.MultitouchGesturesUsed.length; i++ )
Globals.MultitouchGesturesUsed[i] = true;
System.out.println("android.os.Build.MODEL: " + android.os.Build.MODEL);
if( (android.os.Build.MODEL.equals("GT-N7000") || android.os.Build.MODEL.equals("SGH-I717"))
/* && android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.GINGERBREAD_MR1 */ )
{
// Samsung Galaxy Note generates a keypress when you hover a stylus over the screen, and that messes up OpenTTD dialogs
// And I don't know whether this is true for ICS update for Galaxy Note
Globals.RemapHwKeycode[112] = SDL_1_2_Keycodes.SDLK_UNKNOWN;
}
try {
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
if( settingsFile.readInt() != SETTINGS_FILE_VERSION )

View File

@@ -635,7 +635,6 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
@Override
public boolean onKeyDown(int keyCode, final KeyEvent event) {
//System.out.println("Got key down event, id " + keyCode);
if( nativeKey( keyCode, 1 ) == 0 )
return super.onKeyDown(keyCode, event);
return true;

View File

@@ -792,7 +792,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint
return 1;
}
if( TranslateKey(key) == SDLK_NO_REMAP )
if( TranslateKey(key) == SDLK_NO_REMAP || TranslateKey(key) == SDLK_UNKNOWN )
return 0;
SDL_ANDROID_MainThreadPushKeyboardKey( action ? SDL_PRESSED : SDL_RELEASED, TranslateKey(key) );