mirror of https://github.com/ClassiCube/ClassiCube
Webclient: Fix touching anywhere while keyboard was open causing touch mode to get turned off
This commit is contained in:
parent
3e49f0f2a7
commit
2adced2900
20
src/Window.c
20
src/Window.c
|
|
@ -2943,7 +2943,7 @@ void Window_Create(int width, int height) {
|
||||||
rect.size.height = height;
|
rect.size.height = height;
|
||||||
|
|
||||||
winClass = Window_MakeClass();
|
winClass = Window_MakeClass();
|
||||||
winHandle = objc_msgSend(winClass, sel_registerName("alloc"));
|
winHandle = objc_msgSend(winClass, sel_registerName("alloc")); // todo buffered mode
|
||||||
objc_msgSend(winHandle, sel_registerName("initWithContentRect:styleMask:backing:defer:"), rect, (NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask), 0, false);
|
objc_msgSend(winHandle, sel_registerName("initWithContentRect:styleMask:backing:defer:"), rect, (NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask), 0, false);
|
||||||
|
|
||||||
Window_CommonCreate();
|
Window_CommonCreate();
|
||||||
|
|
@ -3317,9 +3317,7 @@ static EM_BOOL OnTouchStart(int type, const EmscriptenTouchEvent* ev, void* data
|
||||||
RescaleXY(&x, &y);
|
RescaleXY(&x, &y);
|
||||||
Input_AddTouch(t->identifier, x, y);
|
Input_AddTouch(t->identifier, x, y);
|
||||||
}
|
}
|
||||||
/* Don't intercept touchstart events while keyboard is open, that way */
|
return true;
|
||||||
/* user can still touch to move the caret position in input textbox. */
|
|
||||||
return !keyboardOpen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static EM_BOOL OnTouchMove(int type, const EmscriptenTouchEvent* ev, void* data) {
|
static EM_BOOL OnTouchMove(int type, const EmscriptenTouchEvent* ev, void* data) {
|
||||||
|
|
@ -3334,9 +3332,7 @@ static EM_BOOL OnTouchMove(int type, const EmscriptenTouchEvent* ev, void* data)
|
||||||
RescaleXY(&x, &y);
|
RescaleXY(&x, &y);
|
||||||
Input_UpdateTouch(t->identifier, x, y);
|
Input_UpdateTouch(t->identifier, x, y);
|
||||||
}
|
}
|
||||||
/* Don't intercept touchmove events while keyboard is open, that way */
|
return true;
|
||||||
/* user can still touch to move the caret position in input textbox. */
|
|
||||||
return !keyboardOpen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static EM_BOOL OnTouchEnd(int type, const EmscriptenTouchEvent* ev, void* data) {
|
static EM_BOOL OnTouchEnd(int type, const EmscriptenTouchEvent* ev, void* data) {
|
||||||
|
|
@ -3351,9 +3347,7 @@ static EM_BOOL OnTouchEnd(int type, const EmscriptenTouchEvent* ev, void* data)
|
||||||
RescaleXY(&x, &y);
|
RescaleXY(&x, &y);
|
||||||
Input_RemoveTouch(t->identifier, x, y);
|
Input_RemoveTouch(t->identifier, x, y);
|
||||||
}
|
}
|
||||||
/* Don't intercept touchend events while keyboard is open, that way */
|
return true;
|
||||||
/* user can still touch to move the caret position in input textbox. */
|
|
||||||
return !keyboardOpen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static EM_BOOL OnFocus(int type, const EmscriptenFocusEvent* ev, void* data) {
|
static EM_BOOL OnFocus(int type, const EmscriptenFocusEvent* ev, void* data) {
|
||||||
|
|
@ -3853,6 +3847,12 @@ void Window_OpenKeyboard(const struct OpenKeyboardArgs* args) {
|
||||||
elem.setAttribute('placeholder', UTF8ToString($2));
|
elem.setAttribute('placeholder', UTF8ToString($2));
|
||||||
elem.value = UTF8ToString($0);
|
elem.value = UTF8ToString($0);
|
||||||
|
|
||||||
|
elem.addEventListener('touchstart', function(ev) { ev.stopPropagation(); }, false);
|
||||||
|
elem.addEventListener('touchmove', function(ev) { ev.stopPropagation(); }, false);
|
||||||
|
elem.addEventListener('touchend', function(ev) { ev.stopPropagation(); }, false);
|
||||||
|
elem.addEventListener('mousedown', function(ev) { ev.stopPropagation(); }, false);
|
||||||
|
elem.addEventListener('mousemove', function(ev) { ev.stopPropagation(); }, false);
|
||||||
|
|
||||||
elem.addEventListener('input',
|
elem.addEventListener('input',
|
||||||
function(ev) {
|
function(ev) {
|
||||||
ccall('Window_OnTextChanged', 'void', ['string'], [ev.target.value]);
|
ccall('Window_OnTextChanged', 'void', ['string'], [ev.target.value]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue