summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidinputcontext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Release left button before showing the popup context menu"Eskil Abrahamsen Blomfeldt2019-10-211-3/+0
| | | | | | | | | | | | | | | | This partially reverts commit 5e8b16f0e4247cc978b08480450526cfa3b25029. Releasing the mouse button synthetically made it impossible to use tap and hold gestures. When investigating, it seems that other changes have fixed the original issue that 5e8b16f0e4247cc978b08480450526cfa3b25029 was meant to address, so this is no longer needed. [ChangeLog][Android] Fixed regression that made it impossible for an application to use the tap-and-hold gesture. Fixes: QTBUG-72408 Change-Id: I53f687d047a4ad0fdf3c8c96a00ed1b11d09f047 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* QAndroidInputContext: Generate a QInputMethodEvent in reset()Vova Mshanetskiy2019-06-281-0/+1
| | | | | | | | | | | | | Although QPlatformInputContext::reset() documentation says that reset() should not send any QInputMethodEvents, implementations on Windows, macOS and iOS do send a QInputMethodEvent which clears preedit text in their reimplementations of reset(). Text editing controls depend on that and may not clear preedit text if such event is not sent. Change-Id: I75ab73946cb06e93e5fc5e98e0cc503a7de5c2e0 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* QAndroidInputContext: Do not stop composing when user taps the cursorVova Mshanetskiy2019-06-281-1/+19
| | | | | | | | | | | | | | | There is no need to tell the editor to stop composing if user taps so close to the cursor position that the cursor will not move anyway. If we do stop composing in such case, then since there will be no cursor position change notification, we will never start composing again (before the cursor is actually moved), and the current composing region will remain being displayed as normal text instead of being displayed as composing text. Change-Id: I4ebe6442e1ba8c365d6754c1a8487235d177c732 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* QAndroidInputContext: Consider preedit text in getCursorCapsMode()Vova Mshanetskiy2019-06-281-2/+7
| | | | | | | | | | Fixes auto-capitalization in AnySoftKeyboard. It was typing the whole first word in a sentence in upper case. Change-Id: I605a1aee39d432a3474c0bf706445d354562285f Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* QAndroidInputContext: Improve compatibility with virtual keyboardsVova Mshanetskiy2019-06-051-200/+426
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit improves QAndroidInputContext's conformance to Android's InputConnection interface and/or consistency of it's behavior with Android's native EditText control. * Composing region is now completely independent from cursor and selection, as required by InputConnection documentation. Also, Qt will now never clear composing region (i.e. call finishComposingText()) without receiving a command to do so from the keyboard. This is important for the following reasons: - Some keyboards misbehave if we change composing region without receiving a command from them. Notably, Samsung Keyboard does (QTBUG-68822). - Due to asynchronous nature of interaction between QAndroidInputContext and the keyboard, when user drags cursor handle quickly, the keyboard may call setComposingRegion() to mark a word, which is no longer under the cursor. This was causing text corruption (QTBUG-43156, QTBUG-59958). Also SwiftKey makes such calls when user presses Enter key (QTBUG-57819). - For similar reasons selecting a word with a double-tap could cause text corruption. The keyboard may call setComposingRegion() in response to the first tap after the second tap has been processed and the word has already been already selected. This is achieved by keeping track of start and end of composing region independently from the editor. Whenever possible (i.e. when there is no selection and the cursor is inside composing region), the composing text is represented as preedit text inside editor. And whenever that is imposible, the editor is told to commit, but QAndroidInputContext keeps information about composing region internally to be able to correctly interract with the keyboard. * deleteSurroundingText() has been re-written to work correctly when there are selection and/or composing region. Some keyboards (e.g Ginger Keyboard) do call deleteSurroundingText() when there is non-empty composing region. * All operations are now performed inside a batch edit (i.e. QAndroidInputContext now calls beginBatchEdit() and endBatchEdit() on itself) to ensure that an intermediate state is never reported to the keyboard, whenever an operation requires more than one QInputMethodEvent. BatchEditLock helper class was added to call begin/endBatchEdit() in RAII style. m_blockUpdateSelection has been removed because m_batchEditNestingLevel is now used instead of it. * Selection start and end positions are now reported to the keyboard so that start <= end. Some keyboards can not handle start > end. * getTextBefore/AfterCursor() now exclude selected text from their return values. While Android docs say "text before/after cursor", what they really mean is "text before/after selection" because "the cursor and the selection are one and the same thing". Some keyboards (e.g. Gboard) were behaving incorrectly when selected text was being returned. * getExtractedText() now tries to obtain and return the whole text from the editor. This is to fix compatibility with some buggy keyboards (e.g. Samsung Keyboard, Minuum) that ignore startOffset field and assume that selectionStart and selectionEnd are absolute values. Then they issue commands with wrong indexes in some cases. Fixes: QTBUG-43156 Fixes: QTBUG-59958 Fixes: QTBUG-57819 Fixes: QTBUG-68822 Change-Id: I7e71f3bcfbb2c32248d653a4197293db03579a79 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* QAndroidInputContext: Don't allow clearing selection by dragging handlesVova Mshanetskiy2019-06-051-39/+27
| | | | | | | | | Android's native text editing controls do not allow user to clear selection by dragging selection handles. Qt apps should behave in the same way. Change-Id: I9a7c3a2aafa484eed8ff2bbd46dd48c705195291 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* QAndroidInputContext: Fix unneeded preedit commits when dragging handlesVova Mshanetskiy2019-06-051-11/+52
| | | | | | | | | | | | | | | | | | | If the cursor handle was dragged by only a few pixels, position of the cursor did not actually change, but finishComposingText() was called anyway. So the keyboard was thinking that nothing changed and a word is still being composed, but the app was thinking that there is no preedit string. This was resulting in invalid handling of following key presses. This commit essentially inlines QPlatformInputContext::setSelectionOnFocusObject() into QAndroidInputContext::handleLocationChanged(). This allows us to call finishComposingText() and to send a QInputMethodEvent only when position of the cursur actually changes. This also allows us to add a QInputMethodEvent::Cursor attribute into the event for consistency with QAndroidInputContext::longPress(). Change-Id: I2fc82f138f717991f34024cdf521236845dc0adf Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* QAndroidInputContext: Fix getTextBefore/AfterCursor() in mid. of preeditVova Mshanetskiy2019-05-081-30/+47
| | | | | | | | | | | | | getTextBeforeCursor() and getTextAfterCursor() were not properly handling the case when the cursor is in the middle of preedit string (just as TODO comments inside these functions were saying). This was causing problems with Gboard when the user focuses a text editor by tapping in the middle of a word. Fixes: QTBUG-58063 Change-Id: I4a580a74d79965816557bfb342337975348d1c45 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QAndroidInputContext: Fix most "Input method out of sync" warningsVova Mshanetskiy2019-05-131-0/+2
| | | | | | | | | | | | | | | | According to Android docs start == end in a call to setComposingRegion() means finish composing. But this case was not being handled properly: m_composingText was being assigned an empty string, but m_composingTextStart was being assigned the value of start, which is never -1. There is one other possible cause of "Input method out of sync" warnings, but it is tightly coupled with another bug, so it will be fixed by a separate commit. Change-Id: Ie475df84f330453ce4fc623e8b631b435d7d0042 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QAndroidInputContext: Fix start value of Cursor attribute in longPress()Vova Mshanetskiy2019-05-101-1/+1
| | | | | | | | | | | | The value of start for a QInputMethodEvent::Cursor attribute must be specified relative to the start of preedit string, but longPress() was specifying it relative to start of surrounding text. This was causing QQuickTextInput to return wrong values of cursor and anchor rectangles. And this was causing invalid positioning of cursor selection handles after a long press. Change-Id: Ief67e86dd90b09ebf2ba191a2b0311ff803afdd9 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android: Fix deleting of new lines when using backspaceAndy Shaw2019-05-031-4/+22
| | | | | | | | | | | | With some keyboards (ASOP, SwiftKey) it was not deleting any new lines when using backspace. So this ensures that it is correctly deleting at these points. Tested with the Samsung, Gboard and SwiftKey keyboards. Fixes: QTBUG-74824 Fixes: QTBUG-57798 Change-Id: Id2e4f96c18c3fec0e7f444b55dd3db2653625fd0 Done-with: Vova Mshanetskiy <vovams163@gmail.com> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Android: If there is no surrounding text then don't try to delete itAndy Shaw2019-01-281-0/+4
| | | | | | | | | | | If there is no surrounding text then we can save time by not sending an event to delete it as there is nothing to be deleted. This prevents the underlying widget from being confused as to where the cursor and anchor is later on when entering in new text. Fixes: QTBUG-65584 Change-Id: Ic6325c119327048dffd2baa68520871fb56370d5 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Use jint instead of jboolean where applicable and initialize variablesAndy Shaw2019-01-081-14/+14
| | | | | | | | | | | This amends change c6af7cf666d43c68c90ad829c3a55d84ee8e4a3e which had incorrectly used jboolean to store the result of getCursorCapsMode() and thus lost the information it was passing. The variables are also initialized in case there is a lock problem when calling runOnQtThread. Fixes: QTBUG-72783 Change-Id: Ibdc21e348c25ee4fdff242d14b3722c6551b042c Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Use the AndroidDeadlockProtector when using a blockingqueued connectionAndy Shaw2019-01-041-6/+4
| | | | | | | | | | | | This amends 2afe4a1a074096a3a6476aae21e732c418717da7 to account for cases where it was crashing when it was using the QueuedConnection. The problem came from the fact it was blocking while waiting for a surface update which was pending to come later on, but the Android thread was already blocked which prevented it from being processed. Fixes: QTBUG-72101 Change-Id: I43e355cf1a7792599f23827903d065b1b1298902 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android: Don't use blocking queued when suspending the applicationAndy Shaw2018-11-301-1/+6
| | | | | | | | | | | If the application gets suspended when a blocking queued connection is made then it will cause the application to hang when being resumed. Therefore a check is needed to still post the event to the other thread but in a non blocking manner so that it does not cause a hang on return. Fixes: QTBUG-72101 Change-Id: I6d53c97ed6d9d500559da2a9fd195226d1fc9905 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-141-2/+14
|\ | | | | | | Change-Id: Ic4c1a8041dcfd143861c39e0014fbdaaa3fb25c6
| * Detect when we are at the sentence boundaryAndy Shaw2018-09-131-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | On Samsung devices this would cause it to always to captalize each word even if it was not a new sentence. Therefore we use QTextBoundaryFinder to determine if it is a new sentence or not. Task-number: QTBUG-69398 Task-number: QTBUG-66531 Change-Id: I24bf36f09a2570acfefd4343551cb1720ddc6279 Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Android: Cleanup the threading handlingBogDan Vatra2018-04-151-117/+104
| | | | | | | | | | | | | | | | Make sure all the call that are coming from Android UI thread are delegate to Qt thread. Change-Id: Ice1a25d01d107d7221b88c65b96dc1459c7f77f0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Make sure we finish composing before we do any operations on textBogDan Vatra2018-04-151-0/+6
| | | | | | | | | | | | | | | | We must finish composing before we move cursor or we do operation on text like cut, copy, paste and select all Change-Id: Ibb09f2c3e526e237b77689a1c2d253aecd563237 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* | Release left button before showing the popup context menuBogDan Vatra2018-04-151-0/+7
| | | | | | | | | | | | | | | | If we release the left button after the popup context menu is visible, the left button will hide the menu immediately. Change-Id: Ie6edf85beb683fd83247e90e7edb4faa5aff6d35 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Android: rewrite edit context menuBogDan Vatra2018-04-151-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | - get rid of the old tool bar with edit controls which was also dropped by Google after they realized that is not intuitive at all. - we now introduce a nice context menu as we see in modern Android devices. This menu works on all Android devices starting with API 16. [ChangeLog][Android] Say hello to Android edit context menu Change-Id: I00d0d83fe8876335c72d7b183db4c1b53746d6b7 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Hide cursor handle after ~4s on inactivityBogDan Vatra2018-03-141-0/+16
| | | | | | | | | | | | | | | | | | When the VK is hidden keep cursor handle the cursor handle visible for ~4s after user last activity. Task-number: QTBUG-66806 Change-Id: I8122c5886efaeee86bb691ad971aa7a3e3d7f8e1 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Remove text selection handles when keyboard is hiddenBogDan Vatra2018-03-141-0/+9
| | | | | | | | | | | | | | Task-number: QTBUG-58700 Change-Id: I094f31250ec879b0f08f27499794946cac2084e6 Reviewed-by: Corey Pendleton <corey.pendleton@garmin.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Refactor cursor & selection handlesBogDan Vatra2018-03-141-32/+76
|/ | | | | | | | | - turn CursorHandleShowMode in a QFlag for better control - add ScopedValueChangeBack which is useful to control m_blockUpdateSelection - implement longPress word selection Change-Id: Ieed709644db991e10077d5be5d5a59f16f4fc3a8 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Check selection handles positionBogDan Vatra2018-01-271-6/+42
| | | | | | | | | | | | | | | This patch fixes the strange behavior when selecting text. This patch (on a Left To Right text) makes sure that: - the left handle will select text only on the left & above of the right handle - the right handle will select text only on the right & below of the left handle For RTL is way more complicated: - the left handle is acuatually the right handle but on the left side and it acts as a right handle - the right handle is acuatually the left handle but on the right side and it acts as a left handle Change-Id: Ifca591398103199d5aef479f0a080161c9f44c0e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Android: Hide handler(s) if the cursor is not visible anymoreBogDan Vatra2018-01-271-0/+10
| | | | | | | | | | | | | On Android if the edit control is bigger than the remaining screen we resize it, this caused the handler(s) to remain outside the control. A better fix will be to ensure that the cursor/selection remains visible when the control is resized but I don't know if this is the desired behavior on all platforms. Task-number: QTBUG-62994 Task-number: QTBUG-58700 Change-Id: If43eb7bc1ecde426697694a8f26118e95fccb80c Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Android: Set correct input hints when queried through getCursorCapsModeJohan Klokkhammer Helsing2017-12-151-3/+3
| | | | | | | | | | | | | | getCursorCapsMode() now matches the Java implementation in QtActivityDelegate.showSoftwareKeyboard() which is given to the Android keyboard on InputConnection creation. The reason we only saw this bug with some Android keyboards was that many keyboards never call getCursorCapsMode and just rely on the initial hints. Task-number: QTBUG-51865 Change-Id: I2aae024d9c77ea14e087e3f51a413d15a684179c Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Allow the users to disable the text handlesBogDan Vatra2017-12-121-0/+4
| | | | | | | The user can set QT_QPA_NO_TEXT_HANDLES to 1 to disable the text handles. Change-Id: I974af4d79c86259288035fe20b6a9d0c6d047af8 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Android: stop composing before pasting new textPaul Olav Tvete2017-08-211-1/+2
| | | | | | | | | | We have to exit composition mode before inserting text. Otherwise, the state of the input method will be out of sync with the contents of the text editor. Task-number: QTBUG-61717 Change-Id: I58bf3988ae9e0acf3302e810e46bb0ebeda30d17 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android: Fix RTL selection handles directionsBogDan Vatra2017-06-131-2/+3
| | | | | | | | Invert the selection handles icons when the selected text is rtl. Task-number: QTBUG-61073 Change-Id: I8339a14d1e4d9e79d218516daf3ac783911f6026 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Fix QRect calculation in inputItemRectangleDmitry Chmerev2017-01-111-4/+4
| | | | | | | | | | | | | Because of QRect's width and height are caluculated values, they got spoiled after x and y values setting. This bug affects, in particular, Android software keyboard appearance: it could overlap focused input field. Change-Id: I27ccca27111219818722951fe6f463388d76c702 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android: fix (partially) text deletion when the cursor is movedBogDan Vatra2016-12-131-0/+5
| | | | | | | | | | | | | | | | - wait until the handle location changes the cursor position - don't update cursor position if: * a batchEdit is in progress * the UpdateSelection is blocked - finish the composing before update the cursor - add the missing .java files There are still corner situations when the text gets deleted/moved, but those are pretty rare and they will be fix in another patch. Task-number: QTBUG-57507 Change-Id: I230d7f64625fb556e1be3069694a71e9bc91323a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Plugins: optimize string usageAnton Kudryavtsev2016-10-181-6/+5
| | | | | | | | | | | | | Prefer QStringRef methods to avoid allocations. Use startsWith/endsWith rather than comparing substrings; and avoid substrings where references suffice. Use new QStringList::join(QL1S). Change-Id: I46c44aca96578633370006d613eb0ac13f7cfc03 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Android: Show the edit menu when things are selectedOlivier Goffart2016-08-211-1/+17
| | | | | Change-Id: I3647fa39469c87bcc08bb439546e5e61c535c71d Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android selection handlesOlivier Goffart2016-08-181-23/+148
| | | | | | | | | This commits implement the cursor and selection handle in the platform plugin. Task-number: QTBUG-34867 Change-Id: Icb3fd9ddfd9f4152e2004078a92a3d9502e9113c Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-04-051-4/+9
|\ | | | | | | | | | | | | | | | | Conflicts: examples/corelib/ipc/ipc.pro src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
| * Merge remote-tracking branch 'origin/5.6' into 5.7Simon Hausmann2016-03-231-4/+9
| |\ | | | | | | | | | Change-Id: I9a10e1f3c9506ec8554d8f59b6300825ac730939
| | * Android: Fix inputItemRectangle when using EnableHighDpiScalingBogDan Vatra2016-03-211-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When EnableHighDpiScaling is enabled, qGuiApp->inputMethod()- >inputItemRectangle() returns the position divided by pixel density, therefore all the controls positions must by multiplied by pixel density to translate them into screen coordinates. Task-number: QTBUG-52001 Change-Id: Iea92a912cfbab03a9497fc8cddc24bebd0db2192 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-03-221-16/+16
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure mkspecs/common/wince/qplatformdefs.h src/plugins/platforms/directfb/qdirectfbbackingstore.cpp src/plugins/platforms/xcb/qxcbbackingstore.cpp Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
| * | QtBase (remainder): use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-121-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Had to fix broken qImDebug() definition. Instead of defining it as a nullary macro in the QT_NO_DEBUG case and as a variadic macro in the other, define it in both cases, as is customary, as a non-function macro so that overload selection works without requiring variadic macro support of the compiler. Saves e.g. ~250b in text size in QtPrintSupport on optimized GCC 5.3 AMD64 builds. Change-Id: Ie30fe2f7942115d5dbf99fff1750ae0d477c379f Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* | | QInputMethodEvent::Attribute: add ctor that doesn't take a QVariantMarc Mutz2016-02-201-8/+6
|/ / | | | | | | | | | | | | | | | | | | | | Many callers passed QVariant() as the last ctor argument. Micro-optimize by providing an overload that default- constructs the variant in-place. Change-Id: I9aab40c6e5a025c9a502c706e4cc7b10879ac418 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Takao Fujiwara <takao.fujiwara1@gmail.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2015-12-081-1/+1
|\| | | | | | | Change-Id: I2532c7f7db5e6cc3ef09753d886279816dd662b2
| * Android: Implement QInputMethod::keyboardRectangleOlivier Goffart2015-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can use getWindowVisibleDisplayFrame to know the height on the keyboard, and we can use getLocationOnScreen to find out how much the view is scrolled. Since onPreDraw is always called when the view is scrolled or when the keyboard appears or disapear, we can call the native functions from there. This is not working for floating keyboards. [ChangeLog][Android] Implemented QInputMethod::keyboardRectangle Task-number: QTBUG-40731 Change-Id: I7848eb34fece410b29a06bf0bbb2313112fffa68 Reviewed-by: Samuel Nevala <samuel.nevala@intopalo.com> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* | Use Q_UNLIKELY for every qFatal()/qCritical()Marc Mutz2015-11-291-10/+10
|/ | | | | | | | | | | | | | | | | | | | | If, after checking a condition, we issue a qFatal() or a qCritical(), by definition that check is unlikely to be true. Tell the compiler so it can move the error handling code out of the normal code path to increase the effective icache size. Moved conditional code around where possible so that we could always use Q_UNLIKELY, instead of having to revert to Q_LIKELY here and there. In some cases, simplified the expressions newly wrapped in Q_UNLIKELY as a drive-by. Change-Id: I67537d62b04bc6977d69254690c5ebbdf98bfd6d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Libraries: Fix single-character string literals.Friedemann Kleint2015-10-131-3/+3
| | | | | | | Use character literals where applicable. Change-Id: I8e198774c2247c1cc1d852a41b59b301199b7878 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Android: Add support for EnterKeyKai Uwe Broulik2015-08-111-1/+3
| | | | | | | | | QAndroidInputContext now sends along the EnterKey type provided by the EnterKey input method query enabling the QtActivityDelegate to set the imeOptions for the TextView accordingly. Change-Id: Ic96077ab4b11cf6dec52283ecf66b2cabe7af665 Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Compile fix for QT_DEBUG_ANDROID_IM_PROTOCOLPaul Olav Tvete2015-06-161-1/+1
| | | | | Change-Id: I45d1c1541f8c758995c988f52c5fa8bd4fa99177 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* Workaround for Google Keyboard strangenessPaul Olav Tvete2015-06-161-0/+5
| | | | | | | | | | | | | | | | When deleting selected text, Google Keyboard will call deleteSurroundingText() with a negative beforeLength. This does not make any sense, and not all our controls are able to handle the resulting input method events. This patch interprets a negative beforeLength as a positive afterLength. This works with the cases I have seen so far, but since the keyboard is not following the specification, there may be more weirdness later. Task-number: QTBUG-46637 Change-Id: I410832417f6fb21139c338355e8fcfa57b9e544c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* Workaround for Samsung keyboard bugPaul Olav Tvete2015-05-201-0/+2
| | | | | | | | | | Return null string instead of empty string when the selection is empty. It looks like Samsung just tests for selection == null when doing backspace. Task-number: QTBUG-45785 Change-Id: Id26ce707130777fcd0ab1a4cff08367bb2810f2f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>