mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-06-18 03:29:31 +00:00
Allow showing system soft touch keyboard
This commit is contained in:
parent
c3ea8c5aea
commit
dc5e7eee25
|
@ -23,7 +23,7 @@
|
|||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" >
|
||||
android:windowSoftInputMode="stateHidden|adjustNothing" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.util.Log;
|
|||
import android.view.InputDevice;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.example.inputmanagercompat.InputManagerCompat;
|
||||
|
||||
|
@ -42,6 +43,7 @@ class Apple2View extends GLSurfaceView implements InputManagerCompat.InputDevice
|
|||
|
||||
public final static long NATIVE_TOUCH_HANDLED = (1 << 0);
|
||||
public final static long NATIVE_TOUCH_REQUEST_SHOW_MENU = (1 << 1);
|
||||
public final static long NATIVE_TOUCH_REQUEST_SHOW_SYSTEM_KBD = (1 << 2);
|
||||
|
||||
public final static long NATIVE_TOUCH_KEY_TAP = (1 << 4);
|
||||
public final static long NATIVE_TOUCH_KBD = (1 << 5);
|
||||
|
@ -519,6 +521,16 @@ class Apple2View extends GLSurfaceView implements InputManagerCompat.InputDevice
|
|||
apple2MenuView.onKeyTapCalibrationEvent(ascii, scancode);
|
||||
}
|
||||
}
|
||||
|
||||
if ((nativeFlags & NATIVE_TOUCH_REQUEST_SHOW_SYSTEM_KBD) != 0) {
|
||||
clearFocus();
|
||||
requestFocus();
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (inputMethodManager != null) {
|
||||
inputMethodManager.showSoftInput(this, InputMethodManager.SHOW_FORCED);
|
||||
}
|
||||
}
|
||||
|
||||
} while (false);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -211,6 +211,8 @@ uint8_t floating_bus_hibit(const bool hibit);
|
|||
#define MOUSETEXT_CLOSEDAPPLE (MOUSETEXT_BEGIN+0x00)
|
||||
#define MOUSETEXT_HOURGLASS (MOUSETEXT_BEGIN+0x03)
|
||||
#define MOUSETEXT_CHECKMARK (MOUSETEXT_BEGIN+0x04)
|
||||
#define MOUSETEXT_CURSOR0 (MOUSETEXT_BEGIN+0x16)
|
||||
#define MOUSETEXT_CURSOR1 (MOUSETEXT_BEGIN+0x17)
|
||||
|
||||
#define ICONTEXT_BEGIN 0xA0 // offset + 0x22 length
|
||||
#define ICONTEXT_MENU_BEGIN ICONTEXT_BEGIN
|
||||
|
|
|
@ -89,6 +89,7 @@ typedef enum interface_touch_event_t {
|
|||
typedef enum interface_touch_event_flags {
|
||||
TOUCH_FLAGS_HANDLED = (1<<0),
|
||||
TOUCH_FLAGS_REQUEST_HOST_MENU = (1<<1),
|
||||
TOUCH_FLAGS_REQUEST_SYSTEM_KBD = (1<<2),
|
||||
TOUCH_FLAGS_KEY_TAP = (1<<4),
|
||||
TOUCH_FLAGS_KBD = (1<<5),
|
||||
TOUCH_FLAGS_JOY = (1<<6),
|
||||
|
|
|
@ -322,6 +322,7 @@ static inline int64_t _tap_key_at_point(float x, float y) {
|
|||
bool handled = true;
|
||||
bool isASCII = false;
|
||||
bool isCTRL = false;
|
||||
int64_t flags = 0x0LL;
|
||||
switch (key) {
|
||||
case ICONTEXT_LOWERCASE:
|
||||
key = 0;
|
||||
|
@ -399,6 +400,12 @@ static inline int64_t _tap_key_at_point(float x, float y) {
|
|||
scancode = SCODE_R_ALT;
|
||||
break;
|
||||
|
||||
case MOUSETEXT_CURSOR0:
|
||||
case MOUSETEXT_CURSOR1:
|
||||
key = 0;
|
||||
flags |= TOUCH_FLAGS_REQUEST_SYSTEM_KBD;
|
||||
break;
|
||||
|
||||
case ICONTEXT_MENU_SPROUT:
|
||||
key = 0;
|
||||
prefs_setLongValue(PREF_DOMAIN_KEYBOARD, PREF_KEYBOARD_VARIANT, KBD_VARIANT_USERALT);
|
||||
|
@ -454,7 +461,9 @@ static inline int64_t _tap_key_at_point(float x, float y) {
|
|||
_rerender_selected(kbd.selectedCol, kbd.selectedRow);
|
||||
|
||||
// return the key+scancode+handled
|
||||
int64_t flags = (handled ? TOUCH_FLAGS_HANDLED : 0x0LL);
|
||||
if (handled) {
|
||||
flags |= TOUCH_FLAGS_HANDLED;
|
||||
}
|
||||
|
||||
key = key & 0xff;
|
||||
scancode = scancode & 0xff;
|
||||
|
@ -686,6 +695,7 @@ static int64_t gltouchkbd_onTouchEvent(interface_touch_event_t action, int point
|
|||
if (trackingIndex == pointer_idx) {
|
||||
int64_t handledAndData = _tap_key_at_point(x, y);
|
||||
flags |= ((handledAndData & TOUCH_FLAGS_HANDLED) ? (TOUCH_FLAGS_HANDLED|TOUCH_FLAGS_KEY_TAP) : 0x0LL);
|
||||
flags |= (handledAndData & TOUCH_FLAGS_REQUEST_SYSTEM_KBD);
|
||||
flags |= (handledAndData & TOUCH_FLAGS_ASCII_AND_SCANCODE_MASK);
|
||||
trackingIndex = TRACKING_NONE;
|
||||
}
|
||||
|
@ -1027,6 +1037,9 @@ static void _initialize_keyboard_templates(void) {
|
|||
kbdTemplateUCase[MAINROW+3][0] = ICONTEXT_GOTO;
|
||||
kbdTemplateLCase[MAINROW+3][0] = ICONTEXT_GOTO;
|
||||
|
||||
kbdTemplateUCase[MAINROW+3][2] = MOUSETEXT_CURSOR1;
|
||||
kbdTemplateLCase[MAINROW+3][2] = MOUSETEXT_CURSOR1;
|
||||
|
||||
kbdTemplateUCase[MAINROW+3][3] = ICONTEXT_LEFTSPACE;
|
||||
kbdTemplateLCase[MAINROW+3][3] = ICONTEXT_LEFTSPACE;
|
||||
kbdTemplateAlt [MAINROW+3][3] = ICONTEXT_LEFTSPACE;
|
||||
|
|
Loading…
Reference in New Issue
Block a user