Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. --- a/usr/share/maliit/plugins/com/jolla/KeyboardBase.qml 2017-09-18 08:03:41.644485835 +0200
  2. +++ b/usr/share/maliit/plugins/com/jolla/KeyboardBase.qml 2017-09-18 08:19:29.014742099 +0200
  3. @@ -65,7 +65,10 @@
  4. // counts how many character keys have been pressed since the ActivePoints array was empty
  5. property int characterKeyCounter
  6. property bool closeSwipeActive
  7. + property bool cursorSwipeActive
  8. property int closeSwipeThreshold: Math.max(height*.3, Theme.itemSizeSmall)
  9. + property int cursorSwipeThreshold: Theme.itemSizeSmall/8
  10. + property int cursorSwipeStart: Theme.itemSizeSmall
  11.  
  12. property QtObject emptyAttributes: Item {
  13. property bool isShifted
  14. @@ -185,6 +188,8 @@
  15. }
  16.  
  17. closeSwipeActive = true
  18. + cursorSwipeActive = false
  19. +
  20. pressTimer.start()
  21.  
  22. for (var i = 0; i < touchPoints.length; i++) {
  23. @@ -225,6 +230,55 @@
  24. return
  25. }
  26.  
  27. + if (!popper.expanded){
  28. + if (ActivePoints.array.length === 1
  29. + && (point.x - point.startX > cursorSwipeThreshold)) {
  30. + // swiped right
  31. + if(!cursorSwipeActive && (point.x - point.startX > cursorSwipeStart)) {
  32. + cursorSwipeActive = true
  33. + }
  34. + if(cursorSwipeActive){
  35. + MInputMethodQuick.sendKey(Qt.Key_Right)
  36. + if (point.pressedKey) {
  37. + inputHandler._handleKeyRelease()
  38. + point.pressedKey.pressed = false
  39. + }
  40. + lastPressedKey = null
  41. + pressTimer.stop()
  42. + languageSwitchTimer.stop()
  43. +
  44. + point.startX = point.x
  45. + return
  46. + }
  47. + }
  48. +
  49. +
  50. +
  51. +
  52. + if (ActivePoints.array.length === 1
  53. + && (point.startX - point.x > cursorSwipeThreshold)) {
  54. + // swiped left
  55. + if(!cursorSwipeActive && (point.startX - point.x > cursorSwipeStart)){
  56. + cursorSwipeActive = true
  57. + }
  58. + if(cursorSwipeActive){
  59. +
  60. + MInputMethodQuick.sendKey(Qt.Key_Left)
  61. +
  62. + if (point.pressedKey) {
  63. + inputHandler._handleKeyRelease()
  64. + point.pressedKey.pressed = false
  65. + }
  66. + lastPressedKey = null
  67. + pressTimer.stop()
  68. + languageSwitchTimer.stop()
  69. +
  70. + point.startX = point.x
  71. + return
  72. + }
  73. + }
  74. + }
  75. +
  76. if (popper.expanded && point.pressedKey === lastPressedKey) {
  77. popper.setActiveCell(point.x, point.y)
  78. } else {
  79. @@ -299,7 +353,12 @@
  80. popper.release()
  81. point.pressedKey.pressed = false
  82. } else {
  83. - triggerKey(point.pressedKey)
  84. + if(!cursorSwipeActive)
  85. + triggerKey(point.pressedKey)
  86. + else if(point.pressedKey !== null) {
  87. + inputHandler._handleKeyRelease()
  88. + point.pressedKey.pressed = false
  89. + }
  90. }
  91.  
  92. if (point.pressedKey.keyType !== KeyType.ShiftKey && !isPressed(KeyType.DeadKey)) {
  93. @@ -494,3 +553,4 @@
  94. }
  95. }
  96. }
  97. +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement