mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Add keyboard type to Window_OpenKeyboard (not used yet)
This commit is contained in:
parent
c508f680a3
commit
ecddb28d34
@ -422,7 +422,7 @@ static void LInput_Select(void* widget, cc_bool wasSelected) {
|
||||
/* TODO: Only draw outer border */
|
||||
if (wasSelected) return;
|
||||
LWidget_Draw(widget);
|
||||
Window_OpenKeyboard();
|
||||
Window_OpenKeyboard(KEYBOARD_TYPE_TEXT);
|
||||
}
|
||||
|
||||
static void LInput_Unselect(void* widget) {
|
||||
|
@ -944,7 +944,7 @@ static void EditHotkeyScreen_Init(void* screen) {
|
||||
|
||||
MenuInputWidget_Create(&s->input, 500, &text, &desc);
|
||||
Menu_InitBack(&s->cancel, Menu_SwitchHotkeys);
|
||||
Window_OpenKeyboard();
|
||||
Window_OpenKeyboard(KEYBOARD_TYPE_TEXT);
|
||||
Window_SetKeyboardText(&text);
|
||||
}
|
||||
|
||||
@ -1149,7 +1149,7 @@ static void GenLevelScreen_Init(void* screen) {
|
||||
ButtonWidget_Init(&s->flatgrass, 200, GenLevelScreen_Flatgrass);
|
||||
ButtonWidget_Init(&s->vanilla, 200, GenLevelScreen_Notchy);
|
||||
Menu_InitBack(&s->cancel, Menu_SwitchPause);
|
||||
Window_OpenKeyboard();
|
||||
Window_OpenKeyboard(KEYBOARD_TYPE_NUMBER);
|
||||
}
|
||||
|
||||
static const struct ScreenVTABLE GenLevelScreen_VTABLE = {
|
||||
@ -1505,7 +1505,7 @@ static void SaveLevelScreen_Init(void* screen) {
|
||||
Menu_InitBack(&s->cancel, Menu_SwitchPause);
|
||||
MenuInputWidget_Create(&s->input, 500, &String_Empty, &desc);
|
||||
TextWidget_Init(&s->desc);
|
||||
Window_OpenKeyboard();
|
||||
Window_OpenKeyboard(KEYBOARD_TYPE_TEXT);
|
||||
}
|
||||
|
||||
static const struct ScreenVTABLE SaveLevelScreen_VTABLE = {
|
||||
@ -2252,7 +2252,7 @@ static void MenuOptionsScreen_Input(void* screen, void* widget) {
|
||||
s->numWidgets = MENUOPTS_MAX_OPTS + 1 + 3;
|
||||
MenuOptionsScreen_Layout(screen);
|
||||
MenuOptionsScreen_RedrawInput(s);
|
||||
Window_OpenKeyboard();
|
||||
Window_OpenKeyboard(KEYBOARD_TYPE_TEXT);
|
||||
Window_SetKeyboardText(&value);
|
||||
}
|
||||
|
||||
|
@ -1278,7 +1278,7 @@ void ChatScreen_OpenInput(const String* text) {
|
||||
s->suppressNextPress = true;
|
||||
s->grabsInput = true;
|
||||
Camera_CheckFocus();
|
||||
Window_OpenKeyboard();
|
||||
Window_OpenKeyboard(KEYBOARD_TYPE_TEXT);
|
||||
Window_SetKeyboardText(text);
|
||||
|
||||
String_Copy(&s->input.base.text, text);
|
||||
|
24
src/Window.c
24
src/Window.c
@ -401,9 +401,9 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
/* TODO: Do we still need to unlock it though? */
|
||||
}
|
||||
|
||||
void Window_OpenKeyboard(void) { SDL_StartTextInput(); }
|
||||
void Window_OpenKeyboard(int type) { SDL_StartTextInput(); }
|
||||
void Window_SetKeyboardText(const String* text) { }
|
||||
void Window_CloseKeyboard(void) { SDL_StopTextInput(); }
|
||||
void Window_CloseKeyboard(void) { SDL_StopTextInput(); }
|
||||
|
||||
void Window_EnableRawMouse(void) {
|
||||
RegrabMouse();
|
||||
@ -934,9 +934,9 @@ static void InitRawMouse(void) {
|
||||
rawMouseSupported = false;
|
||||
}
|
||||
|
||||
void Window_OpenKeyboard(void) { }
|
||||
void Window_OpenKeyboard(int type) { }
|
||||
void Window_SetKeyboardText(const String* text) { }
|
||||
void Window_CloseKeyboard(void) { }
|
||||
void Window_CloseKeyboard(void) { }
|
||||
|
||||
void Window_EnableRawMouse(void) {
|
||||
DefaultEnableRawMouse();
|
||||
@ -1818,9 +1818,9 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
Mem_Free(bmp->scan0);
|
||||
}
|
||||
|
||||
void Window_OpenKeyboard(void) { }
|
||||
void Window_OpenKeyboard(int type) { }
|
||||
void Window_SetKeyboardText(const String* text) { }
|
||||
void Window_CloseKeyboard(void) { }
|
||||
void Window_CloseKeyboard(void) { }
|
||||
|
||||
static cc_bool rawMouseInited, rawMouseSupported;
|
||||
static int xiOpcode;
|
||||
@ -2034,9 +2034,9 @@ static void Cursor_DoSetVisible(cc_bool visible) {
|
||||
}
|
||||
}
|
||||
|
||||
void Window_OpenKeyboard(void) { }
|
||||
void Window_OpenKeyboard(int type) { }
|
||||
void Window_SetKeyboardText(const String* text) { }
|
||||
void Window_CloseKeyboard(void) { }
|
||||
void Window_CloseKeyboard(void) { }
|
||||
|
||||
void Window_EnableRawMouse(void) {
|
||||
DefaultEnableRawMouse();
|
||||
@ -3500,12 +3500,12 @@ EMSCRIPTEN_KEEPALIVE void Window_OnTextChanged(const char* src) {
|
||||
Event_RaiseString(&InputEvents.TextChanged, &str);
|
||||
}
|
||||
|
||||
void Window_OpenKeyboard(void) {
|
||||
void Window_OpenKeyboard(int type) {
|
||||
if (!Input_TouchMode) return;
|
||||
keyboardOpen = true;
|
||||
Platform_LogConst("OPEN SESAME");
|
||||
|
||||
EM_ASM({
|
||||
EM_ASM_({
|
||||
var elem = window.cc_inputElem;
|
||||
if (!elem) {
|
||||
elem = document.createElement('textarea');
|
||||
@ -3521,7 +3521,7 @@ void Window_OpenKeyboard(void) {
|
||||
}
|
||||
elem.focus();
|
||||
elem.click();
|
||||
});
|
||||
}, type);
|
||||
}
|
||||
|
||||
void Window_SetKeyboardText(const String* text) {
|
||||
@ -3890,7 +3890,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||
Mem_Free(bmp->scan0);
|
||||
}
|
||||
|
||||
void Window_OpenKeyboard(void) {
|
||||
void Window_OpenKeyboard(int type) {
|
||||
JNIEnv* env;
|
||||
JavaGetCurrentEnv(env);
|
||||
JavaCallVoid(env, "openKeyboard", "()V", NULL);
|
||||
|
@ -34,7 +34,8 @@ struct Bitmap;
|
||||
struct DynamicLibSym;
|
||||
/* The states the window can be in. */
|
||||
enum WindowState { WINDOW_STATE_NORMAL, WINDOW_STATE_MINIMISED, WINDOW_STATE_FULLSCREEN };
|
||||
/* Can't name these Window/Display, because it conflicts with X11's Window/Display typedef */
|
||||
enum KeyboardType { KEYBOARD_TYPE_TEXT, KEYBOARD_TYPE_PASSWORD, KEYBOARD_TYPE_NUMBER };
|
||||
/* Can't name these structs Window/Display, because it conflicts with X11's Window/Display typedef */
|
||||
|
||||
/* Data for the display monitor. */
|
||||
CC_VAR extern struct _DisplayData {
|
||||
@ -129,7 +130,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp);
|
||||
|
||||
/* Displays on-screen keyboard for platforms that lack physical keyboard input. */
|
||||
/* NOTE: On desktop platforms, this won't do anything. */
|
||||
void Window_OpenKeyboard(void);
|
||||
void Window_OpenKeyboard(int type);
|
||||
/* Sets the text used for keyboard input. */
|
||||
/* NOTE: This is only used for mobile on-screen keyboard input with the web client, */
|
||||
/* because it is backed by a HTML input, rather than true keyboard input events. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user