From 12b1ca3236aa167c007c6c87e0d2f2d06c495821 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 13 Oct 2013 23:17:19 +0300 Subject: Hacking on iOS keyboard handling Change-Id: I0d842cc951cb5a3e7e990f835f541ccf1bd89df6 --- .../LibreOffice/LibreOffice/AppDelegate.m | 21 +++++++++++++++++++++ ios/experimental/LibreOffice/LibreOffice/View.m | 2 -- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'ios') diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m index dddf3acd458b..c3ed9ebb7832 100644 --- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m +++ b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m @@ -16,6 +16,7 @@ #import "lo.h" static View *theView; +static BOOL keyboardShows; @implementation AppDelegate @@ -78,6 +79,8 @@ static View *theView; NSThread* thread = [[NSThread alloc] initWithTarget:self selector:@selector(threadMainMethod:) object:nil]; + keyboardShows = NO; + [thread start]; return YES; @@ -158,6 +161,8 @@ static View *theView; NSLog(@"keyboardWillShow: frame:%dx%d@(%d,%d)", (int) frameEnd.size.width, (int) frameEnd.size.height, (int) frameEnd.origin.x, (int) frameEnd.origin.y); + + keyboardShows = YES; } - (void)keyboardDidHide:(NSNotification *)note @@ -166,6 +171,8 @@ static View *theView; NSLog(@"keyboardDidHide"); + keyboardShows = NO; + touch_lo_keyboard_did_hide(); } @@ -186,6 +193,15 @@ void touch_ui_damaged(int minX, int minY, int width, int height) void touch_ui_show_keyboard() { +#if 0 + // Horrible hack + static bool beenHere = false; + if (!beenHere) { + beenHere = true; + touch_lo_keyboard_did_hide(); + return; + } +#endif dispatch_async(dispatch_get_main_queue(), ^{ [theView->textView becomeFirstResponder]; }); @@ -198,4 +214,9 @@ void touch_ui_hide_keyboard() }); } +bool touch_ui_keyboard_visible() +{ + return keyboardShows; +} + // vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/ios/experimental/LibreOffice/LibreOffice/View.m b/ios/experimental/LibreOffice/LibreOffice/View.m index 3cd332b1f514..de7b31144ac3 100644 --- a/ios/experimental/LibreOffice/LibreOffice/View.m +++ b/ios/experimental/LibreOffice/LibreOffice/View.m @@ -54,8 +54,6 @@ // NSLog(@"tapGesture: at: (%d,%d)", (int)location.x, (int)location.y); touch_lo_tap(location.x, location.y); - - [self->textView becomeFirstResponder]; } else { // NSLog(@"tapGesture: %@", gestureRecognizer); } -- cgit