Kaydet (Commit) 12b1ca32 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Hacking on iOS keyboard handling

Change-Id: I0d842cc951cb5a3e7e990f835f541ccf1bd89df6
üst cbae2baa
...@@ -39,6 +39,7 @@ void touch_ui_damaged(int minX, int minY, int width, int height); ...@@ -39,6 +39,7 @@ void touch_ui_damaged(int minX, int minY, int width, int height);
void touch_ui_show_keyboard(); void touch_ui_show_keyboard();
void touch_ui_hide_keyboard(); void touch_ui_hide_keyboard();
bool touch_ui_keyboard_visible();
// 2) Those implmented in the lower layers to be called by the upper // 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 // layer, in cases where we don't want to include a bunch of the
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#import "lo.h" #import "lo.h"
static View *theView; static View *theView;
static BOOL keyboardShows;
@implementation AppDelegate @implementation AppDelegate
...@@ -78,6 +79,8 @@ static View *theView; ...@@ -78,6 +79,8 @@ static View *theView;
NSThread* thread = [[NSThread alloc] initWithTarget:self NSThread* thread = [[NSThread alloc] initWithTarget:self
selector:@selector(threadMainMethod:) selector:@selector(threadMainMethod:)
object:nil]; object:nil];
keyboardShows = NO;
[thread start]; [thread start];
return YES; return YES;
...@@ -158,6 +161,8 @@ static View *theView; ...@@ -158,6 +161,8 @@ static View *theView;
NSLog(@"keyboardWillShow: frame:%dx%d@(%d,%d)", NSLog(@"keyboardWillShow: frame:%dx%d@(%d,%d)",
(int) frameEnd.size.width, (int) frameEnd.size.height, (int) frameEnd.size.width, (int) frameEnd.size.height,
(int) frameEnd.origin.x, (int) frameEnd.origin.y); (int) frameEnd.origin.x, (int) frameEnd.origin.y);
keyboardShows = YES;
} }
- (void)keyboardDidHide:(NSNotification *)note - (void)keyboardDidHide:(NSNotification *)note
...@@ -166,6 +171,8 @@ static View *theView; ...@@ -166,6 +171,8 @@ static View *theView;
NSLog(@"keyboardDidHide"); NSLog(@"keyboardDidHide");
keyboardShows = NO;
touch_lo_keyboard_did_hide(); touch_lo_keyboard_did_hide();
} }
...@@ -186,6 +193,15 @@ void touch_ui_damaged(int minX, int minY, int width, int height) ...@@ -186,6 +193,15 @@ void touch_ui_damaged(int minX, int minY, int width, int height)
void touch_ui_show_keyboard() 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(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[theView->textView becomeFirstResponder]; [theView->textView becomeFirstResponder];
}); });
...@@ -198,4 +214,9 @@ void touch_ui_hide_keyboard() ...@@ -198,4 +214,9 @@ void touch_ui_hide_keyboard()
}); });
} }
bool touch_ui_keyboard_visible()
{
return keyboardShows;
}
// vim:set shiftwidth=4 softtabstop=4 expandtab: // vim:set shiftwidth=4 softtabstop=4 expandtab:
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
// NSLog(@"tapGesture: at: (%d,%d)", (int)location.x, (int)location.y); // NSLog(@"tapGesture: at: (%d,%d)", (int)location.x, (int)location.y);
touch_lo_tap(location.x, location.y); touch_lo_tap(location.x, location.y);
[self->textView becomeFirstResponder];
} else { } else {
// NSLog(@"tapGesture: %@", gestureRecognizer); // NSLog(@"tapGesture: %@", gestureRecognizer);
} }
......
...@@ -61,6 +61,10 @@ ...@@ -61,6 +61,10 @@
#include <globals.hrc> #include <globals.hrc>
#include <comcore.hrc> #include <comcore.hrc>
#if defined(ANDROID) || defined(IOS)
#include <touch/touch.h>
#endif
using namespace com::sun::star; using namespace com::sun::star;
using namespace util; using namespace util;
...@@ -2030,6 +2034,9 @@ void SwCrsrShell::ShowCrsr() ...@@ -2030,6 +2034,9 @@ void SwCrsrShell::ShowCrsr()
if( !m_bBasicHideCrsr ) if( !m_bBasicHideCrsr )
{ {
m_bSVCrsrVis = sal_True; m_bSVCrsrVis = sal_True;
#if defined(ANDROID) || defined(IOS)
touch_ui_show_keyboard();
#endif
UpdateCrsr(); UpdateCrsr();
} }
} }
...@@ -2042,6 +2049,9 @@ void SwCrsrShell::HideCrsr() ...@@ -2042,6 +2049,9 @@ void SwCrsrShell::HideCrsr()
// possibly reverse selected areas!! // possibly reverse selected areas!!
SET_CURR_SHELL( this ); SET_CURR_SHELL( this );
m_pVisCrsr->Hide(); m_pVisCrsr->Hide();
#if defined(ANDROID) || defined(IOS)
touch_ui_hide_keyboard();
#endif
} }
} }
...@@ -2510,7 +2520,12 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin ) ...@@ -2510,7 +2520,12 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd = m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd =
m_bGCAttr = m_bIgnoreReadonly = m_bSelTblCells = m_bBasicHideCrsr = m_bGCAttr = m_bIgnoreReadonly = m_bSelTblCells = m_bBasicHideCrsr =
m_bOverwriteCrsr = sal_False; 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_bSetCrsrInReadOnly = sal_True;
m_pVisCrsr = new SwVisCrsr( this ); m_pVisCrsr = new SwVisCrsr( this );
m_bMacroExecAllowed = rShell.IsMacroExecAllowed(); m_bMacroExecAllowed = rShell.IsMacroExecAllowed();
...@@ -2542,7 +2557,12 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin, ...@@ -2542,7 +2557,12 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin,
m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd = m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd =
m_bGCAttr = m_bIgnoreReadonly = m_bSelTblCells = m_bBasicHideCrsr = m_bGCAttr = m_bIgnoreReadonly = m_bSelTblCells = m_bBasicHideCrsr =
m_bOverwriteCrsr = sal_False; 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_bSetCrsrInReadOnly = sal_True;
m_pVisCrsr = new SwVisCrsr( this ); m_pVisCrsr = new SwVisCrsr( this );
......
...@@ -542,13 +542,19 @@ Java_org_libreoffice_android_AppSupport_scroll(JNIEnv * /* env */, ...@@ -542,13 +542,19 @@ Java_org_libreoffice_android_AppSupport_scroll(JNIEnv * /* env */,
} }
extern "C" void extern "C" void
lo_show_keyboard() touch_ui_show_keyboard()
{ {
} }
extern "C" void 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment