From 7a211d052e38a17885be37fb8d7985757f88fc90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Fri, 11 Apr 2014 17:36:36 +0200 Subject: [PATCH] 2014-04-11 17:36 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/gtqtc/gtqtc.h * contrib/gtqtc/gtqtc1.cpp * overload inputMethodEvent() in console object and insert commitString() data into GT keyboard input queue. It's necessary for Android working with SoftwareInputPanel and it fixes problem with eaten standard characters. QT documentation says that QInputMethodEvent are generated only when Qt::WA_InputMethodEnabled attribute is set but tests shows that it's not true and these events are generated instead of keyPress/keyRelease ones for simple text input. CTRL modifier, ESC, INS, HOME, END, PGUP, PGDN and Fn keys still does not work with GTQTC in Android builds. * src/rtl/tbrowse.prg ! fixed compilation with HB_BRW_STATICMOUSE ! do not cover dummy ivar with HB_COMPAT_C53 macro * minor simplification * src/vm/arrays.c * removed old commented code not used with current GC --- ChangeLog.txt | 22 ++++++++++++++++++++++ contrib/gtqtc/gtqtc.h | 1 + contrib/gtqtc/gtqtc1.cpp | 23 +++++++++++++++++++++++ src/rtl/tbrowse.prg | 19 ++++++++++--------- src/vm/arrays.c | 2 -- 5 files changed, 56 insertions(+), 11 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index ba6da40003..fa20f770dd 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,28 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2014-04-11 17:36 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/gtqtc/gtqtc.h + * contrib/gtqtc/gtqtc1.cpp + * overload inputMethodEvent() in console object and insert + commitString() data into GT keyboard input queue. + It's necessary for Android working with SoftwareInputPanel + and it fixes problem with eaten standard characters. + QT documentation says that QInputMethodEvent are generated + only when Qt::WA_InputMethodEnabled attribute is set but + tests shows that it's not true and these events are generated + instead of keyPress/keyRelease ones for simple text input. + CTRL modifier, ESC, INS, HOME, END, PGUP, PGDN and Fn keys + still does not work with GTQTC in Android builds. + + * src/rtl/tbrowse.prg + ! fixed compilation with HB_BRW_STATICMOUSE + ! do not cover dummy ivar with HB_COMPAT_C53 macro + * minor simplification + + * src/vm/arrays.c + * removed old commented code not used with current GC + 2014-04-03 14:26 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbnetio/netiosrv.c * fully consume RPC messages even if RPC is disabled. It allows to diff --git a/contrib/gtqtc/gtqtc.h b/contrib/gtqtc/gtqtc.h index 85b407b752..4a97350a88 100644 --- a/contrib/gtqtc/gtqtc.h +++ b/contrib/gtqtc/gtqtc.h @@ -361,6 +361,7 @@ public: void repaintChars( const QRect & rect ); protected: + void inputMethodEvent( QInputMethodEvent * event ); void keyPressEvent( QKeyEvent * event ); void keyReleaseEvent( QKeyEvent * event ); void mousePressEvent( QMouseEvent * event ); diff --git a/contrib/gtqtc/gtqtc1.cpp b/contrib/gtqtc/gtqtc1.cpp index 5e625d2419..26aeae84d1 100644 --- a/contrib/gtqtc/gtqtc1.cpp +++ b/contrib/gtqtc/gtqtc1.cpp @@ -2474,6 +2474,10 @@ QTConsole::QTConsole( PHB_GTQTC pStructQTC, QWidget *parent ) : QWidget( parent */ /* setAttribute( Qt::WA_InputMethodEnabled ); */ +#if defined( HB_OS_ANDROID ) || defined( HB_OS_WIN_CE ) + setInputMethodHints( Qt::ImhNoPredictiveText ); +#endif + setFocusPolicy( Qt::StrongFocus ); setMouseTracking( true ); @@ -3058,6 +3062,25 @@ bool QTConsole::event( QEvent * event ) return QWidget::event( event ); } +void QTConsole::inputMethodEvent( QInputMethodEvent * event ) +{ + /* It's for SoftwareInputPanel in Andorid. */ + + QString qStr = event->commitString(); + + if( qStr.size() > 0 ) + { + for( int i = 0; i < qStr.size(); ++i ) + { + HB_WCHAR wc = qStr[ i ].unicode(); + hb_gt_qtc_addKeyToInputQueue( pQTC, HB_INKEY_NEW_UNICODE( wc ) ); + } + event->accept(); + } + else + QWidget::inputMethodEvent( event ); +} + void QTConsole::keyReleaseEvent( QKeyEvent * event ) { if( selectMode && ( event->modifiers() & Qt::ShiftModifier ) == 0 ) diff --git a/src/rtl/tbrowse.prg b/src/rtl/tbrowse.prg index 4195898efe..af7a182cf5 100644 --- a/src/rtl/tbrowse.prg +++ b/src/rtl/tbrowse.prg @@ -132,8 +132,9 @@ CREATE CLASS TBrowse VAR bGoTopBlock AS BLOCK INIT {|| NIL } // 12. Code block executed by TBrowse:goTop() VAR bGoBottomBlock AS BLOCK INIT {|| NIL } // 13. Code block executed by TBrowse:goBottom() -#ifdef HB_COMPAT_C53 VAR dummy INIT "" // 14. ??? In Clipper it's character variable with internal C level structure containing browse data + +#ifdef HB_COMPAT_C53 VAR cBorder AS CHARACTER // 15. character value defining characters drawn around object VAR cMessage // 16. character string displayed on status bar VAR keys AS ARRAY // 17. array with SetKey() method values @@ -291,7 +292,9 @@ CREATE CLASS TBrowse METHOD dispFrames() // display TBrowse border, columns' headings, footings and separators METHOD dispRow( nRow ) // display TBrowse data +#ifndef HB_BRW_STATICMOUSE FRIEND FUNCTION _mBrwPos // helper function for MRow() and MCol() methods +#endif ENDCLASS @@ -1304,15 +1307,13 @@ METHOD doConfigure() CLASS TBrowse IF cColSep == NIL cColSep := ::cColSep ENDIF - cHeadSep := oCol:headSep - IF ! HB_ISSTRING( cHeadSep ) .OR. cHeadSep == "" - cHeadSep := ::cHeadSep - hb_default( @cHeadSep, "" ) + cHeadSep := hb_defaultValue( oCol:headSep, "" ) + IF cHeadSep == "" + cHeadSep := hb_defaultValue( ::cHeadSep, "" ) ENDIF - cFootSep := oCol:footSep - IF ! HB_ISSTRING( cFootSep ) .OR. cFootSep == "" - cFootSep := ::cFootSep - hb_default( @cFootSep, "" ) + cFootSep := hb_defaultValue( oCol:footSep, "" ) + IF cFootSep == "" + cFootSep := hb_defaultValue( ::cFootSep, "" ) ENDIF aCol := Array( _TBCI_SIZE ) aCol[ _TBCI_COLOBJECT ] := oCol diff --git a/src/vm/arrays.c b/src/vm/arrays.c index ffd723a69c..cbeab24267 100644 --- a/src/vm/arrays.c +++ b/src/vm/arrays.c @@ -120,8 +120,6 @@ static HB_GARBAGE_FUNC( hb_arrayGarbageRelease ) HB_STACK_TLS_PRELOAD hb_arrayPushBase( pBaseArray ); hb_objDestructorCall( hb_stackItemFromTop( -1 ) ); -// /* Clear object properities before hb_stackPop(), [druzus] */ -// pBaseArray->uiClass = 0; hb_stackPop(); }