diff options
author | Tor Lillqvist <tml@collabora.com> | 2013-10-13 23:17:19 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2013-10-13 23:17:39 +0300 |
commit | 12b1ca3236aa167c007c6c87e0d2f2d06c495821 (patch) | |
tree | 71471cdb910c3d0990c4c9bac4c97396e7d472a5 | |
parent | cbae2baa412437b624a1f01671ec16d9fdc358bb (diff) |
Hacking on iOS keyboard handling
Change-Id: I0d842cc951cb5a3e7e990f835f541ccf1bd89df6
-rw-r--r-- | include/touch/touch.h | 1 | ||||
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/AppDelegate.m | 21 | ||||
-rw-r--r-- | ios/experimental/LibreOffice/LibreOffice/View.m | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 24 | ||||
-rw-r--r-- | vcl/android/androidinst.cxx | 10 |
5 files changed, 52 insertions, 6 deletions
diff --git a/include/touch/touch.h b/include/touch/touch.h index ebe4b19b8084..1f0d7efa40b0 100644 --- a/include/touch/touch.h +++ b/include/touch/touch.h @@ -39,6 +39,7 @@ void touch_ui_damaged(int minX, int minY, int width, int height); void touch_ui_show_keyboard(); void touch_ui_hide_keyboard(); +bool touch_ui_keyboard_visible(); // 2) Those implmented in the lower layers to be called by the upper // layer, in cases where we don't want to include a bunch of the 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); } diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 12f79afb2889..83dfc087d1d5 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -61,6 +61,10 @@ #include <globals.hrc> #include <comcore.hrc> +#if defined(ANDROID) || defined(IOS) +#include <touch/touch.h> +#endif + using namespace com::sun::star; using namespace util; @@ -2030,6 +2034,9 @@ void SwCrsrShell::ShowCrsr() if( !m_bBasicHideCrsr ) { m_bSVCrsrVis = sal_True; +#if defined(ANDROID) || defined(IOS) + touch_ui_show_keyboard(); +#endif UpdateCrsr(); } } @@ -2042,6 +2049,9 @@ void SwCrsrShell::HideCrsr() // possibly reverse selected areas!! SET_CURR_SHELL( this ); m_pVisCrsr->Hide(); +#if defined(ANDROID) || defined(IOS) + touch_ui_hide_keyboard(); +#endif } } @@ -2510,7 +2520,12 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin ) m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd = m_bGCAttr = m_bIgnoreReadonly = m_bSelTblCells = m_bBasicHideCrsr = m_bOverwriteCrsr = sal_False; - m_bCallChgLnk = m_bHasFocus = m_bSVCrsrVis = m_bAutoUpdateCells = sal_True; + m_bCallChgLnk = m_bHasFocus = m_bAutoUpdateCells = sal_True; +#if defined(ANDROID) || defined(IOS) + m_bSVCrsrVis = touch_ui_keyboard_visible(); +#else + m_bSVCrsrVis = sal_True; +#endif m_bSetCrsrInReadOnly = sal_True; m_pVisCrsr = new SwVisCrsr( this ); m_bMacroExecAllowed = rShell.IsMacroExecAllowed(); @@ -2542,7 +2557,12 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin, m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd = m_bGCAttr = m_bIgnoreReadonly = m_bSelTblCells = m_bBasicHideCrsr = m_bOverwriteCrsr = sal_False; - m_bCallChgLnk = m_bHasFocus = m_bSVCrsrVis = m_bAutoUpdateCells = sal_True; + m_bCallChgLnk = m_bHasFocus = m_bAutoUpdateCells = sal_True; +#if defined(ANDROID) || defined(IOS) + m_bSVCrsrVis = touch_ui_keyboard_visible(); +#else + m_bSVCrsrVis = sal_True; +#endif m_bSetCrsrInReadOnly = sal_True; m_pVisCrsr = new SwVisCrsr( this ); diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 1ac4a83871da..c48fa325bae4 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -542,13 +542,19 @@ Java_org_libreoffice_android_AppSupport_scroll(JNIEnv * /* env */, } extern "C" void -lo_show_keyboard() +touch_ui_show_keyboard() { } extern "C" void -lo_hide_keyboard() +touch_ui_hide_keyboard() { } +extern "C" bool +touch_ui_keyboard_visible() +{ + return true; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |