summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/androidjniinput.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Android: Add default template argument return type to AndroidBackendRegisterPetri Virkkunen2025-06-121-2/+2
| | | | | | | | | | For AndroidBackendRegister::callInterface, it would be more convenient to call simple functions without parameters, without being forced to specify the void return type. Added a default void type argument for the return type. Change-Id: Ib7f631c172955cdf0b2e853155fd57c06bef9843 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Do not modify Touch Event position in JAVA codeBartlomiej Moskal2025-03-271-21/+24
| | | | | | | | | | | | | | | | | | | | | In QtWindow class, the Touch Event coordinates were increased by Layout position. That allows to move to global coordinates. In the same time, in 15674f4ce9ea455b47f68d8871d5676d7a731630 commit, we started mapping coordinates of Touch Event to Global position. That cause the issue with incorrectly handled touches for example with QDialogs. To avoid this issue, we will stop modify Touch Event position in JAVA code. We will send only localPosition to not make transformation twice. With this change, all events received from JAVA have local position of their window. Pick-to: 6.9 6.8 Fixes: QTBUG-130576 Fixes: QTBUG-127925 Change-Id: I6b58e0369959840f869e31a3d96425c64507b39d Reviewed-by: Tinja Paavoseppä <[email protected]>
* Android: Fix touchDown event coordinatesBartlomiej Moskal2025-03-271-1/+6
| | | | | | | | | | | | | In the touchAdd method, the mapped touch point is divided by the platform integration screen size. In order not to mix different coordinate systems, we should use platformWindow to correctly calculate global position of touch event. Pick-to: 6.9 6.8 Task-number: QTBUG-130576 Task-number: QTBUG-127925 Change-Id: Ic7653a60fb3def181f29a3e28b963878dc54a99e Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Fix mouse button processingAndrew Forrest2025-02-051-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | Fixes clicking UI elements with a mouse on Android. 8d8cbe87e21f05b7d611ed4be47299977288b267 introduced changes to support mouse buttons other than Qt::LeftButton, but the release always looked like no buttons changed, nor were they tracked (m_buttons is always Qt::NoButton). Qt was not notified of mouse up, so nothing was clickable. Now all mouse events go through sendMouseButtonEvents, and the last seen button state is tracked for every event. If a mouse up with no buttons occurs, the last seen set of buttons is used instead, so Qt correctly handles the event. Also adds the mouse button state information to mouse move events from Android, so the workaround for delivering Qt::LeftButton when a window is tracking a move while a button is pressed has been removed. Tested on a Samsung A1 with a Bluetooth mouse. Fixes: QTBUG-132700 Fixes: QTBUG-130297 Pick-to: 6.8 6.9 Change-Id: I241282c2915d7e6cf99db7f0bc1ad2d541349077 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: don't manage available screen size values under androidjnimainAssam Boudjelthia2025-01-281-4/+9
| | | | | | | | Those values should be under the plaftoform screen as they are now, and handling them also here is just duplication that's not needed. Change-Id: Ib6be6655527aa86403173d477d137b92d8e51987 Reviewed-by: Petri Virkkunen <[email protected]>
* Android: Remove getQtLayout() methodTinja Paavoseppä2024-08-231-9/+1
| | | | | | | | | | | | After refactoring the various keyboard input related Java classes so that they are more contained inside their respective windows, this method becomes unnecessary. Task-number: QTBUG-126180 Pick-to: 6.8 Change-Id: I608399e98892752182039b8ece60005670da8224 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Move EditPopupMenu to QtWindowTinja Paavoseppä2024-08-231-2/+1
| | | | | | | | | | | | | | | | | | | The EditPopupMenu requires a View in its constructor, making it important that we do not hold a reference to it after that View is no longer valid. In cases where we do not have one, top level View that will stay valid for the lifetime of the whole Activity, e.g. when embedding a QtView to non-Qt Android Activities, making the popups QtWindow based makes sense, as the lifecycle of the popup and it's corresponding QtWindow should match. Task-number: QTBUG-126180 Pick-to: 6.8 Change-Id: Ibb45513de98f79a293a05eeb317d959ac0328dbe Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Move CursorHandles to QtEditTextTinja Paavoseppä2024-08-231-1/+1
| | | | | | | | | | | | | | The CursorHandles are the handles visible when trying to select text from a text edit, or select a position in the text. As it is not used anywhere outside a text edit, move it inside QtEditText, making it easier to handle cases where we have multiple windows, and multiple QtTextEdits. Task-number: QTBUG-126180 Pick-to: 6.8 Change-Id: I765f229050ca33887570c1434bdc0a2aa3659649 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Change the touch points numberingBartlomiej Moskal2024-07-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Start numbering Android touch points from 1 instead of 0. The QPointingDevice was added in Qt6. This means we don't need to worry about unique IDs for each touch point. Different IDs are needed for multi touch. The touch point ID of each physical finger must be unique and immutable as long as either finger is still pressed. Theoretically, it doesn't matter from what value we start the numbering of touches. The problem with numbering from 0 is that the touch point can be easy overwritten. It is enough to create QSinglePointEvent (like QMouseEvent) and by default touch point with 0 ID will be cleared and lose all current data. Because of that, Android's touch point numbering will start from 1 instead of 0. Pick-to: 6.8 6.7 6.5 Fixes: QTBUG-112287 Change-Id: I83a4678a0751bdb7a5ff5353ec49866d4cca5f05 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Map touch position to global coordinatesTinja Paavoseppä2024-06-131-4/+13
| | | | | | | | | | | | When QtWindow is not at 0,0 of its parent, not mapping the position leads to offsets in the touched position in Android vs where it is received in Qt, e.g. needing to touch below a button's actual position to trigger a click. Task-number: QTBUG-126178 Pick-to: 6.7 6.8 Change-Id: Icd62ed59f0f323ba3977145c3304e4e874aa4fa2 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: private export GenericMotionEventListener and KeyEventListenerAssam Boudjelthia2024-06-061-62/+0
| | | | | | | | | | | | | | | Partially reverts ac7f22ed0a4bb25146b87c0f6be54323909ea401. Bring back the following to qjnihelpers_p.h so they can be exported as private APIs used to handle event listeners. * GenericMotionEventListener and KeyEventListener * register and unregister listener calls Pick-to: 6.8 Task-number: QTBUG-118077 Change-Id: I5b9c7073801f0b1305237184bb2ab91678e1b1b1 Reviewed-by: Andy Nichols <[email protected]> Reviewed-by: Tinja Paavoseppä <[email protected]>
* Android: Implement input backend interfacePetri Virkkunen2024-05-211-24/+23
| | | | | | | | | | | | | | | | | | | Interface for input-related actions, based off of QtInputDelegate. Implements all the QtInputDelegate functions called from native code plus an extra function that allows the native side to get a QtInputConnectionListener object for QtWindow creation. Removed some unused functions and unmarked @UsedFromNativeCode in some that are no longer called from native, but still used from java. Added QtInputConnectionListener null checks in QtInputConnection, due to the possibility of a non-existent InputInterface returning a null QtInputConnectionListener for the QtInputConnection constructor. Task-number: QTBUG-118874 Change-Id: I8d4cde3e0c735471d0fa30d16db20eb13542cdaa Reviewed-by: Tinja Paavoseppä <[email protected]>
* Android: Implement QtLayout backend interfacePetri Virkkunen2024-05-211-1/+4
| | | | | | | | | | Small interface, just for QtLayout. This is used in QtAndroid::qtLayout(), which is called by functions handling the virtual keyboard and the keyboard handles. Task-number: QTBUG-118874 Change-Id: Ib9b2830136d05dfd70c9c6ca86ac29be36cc5c30 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Detect mouse buttonsAxel Spoerl2024-04-221-11/+75
| | | | | | | | | | | | | | | | | | | | | | | | The mouseDown() and mouseUp() methods in androidjniinput.cpp hardcoded Qt::LeftButton to all mouse-press / release events. If a mouse is connected to an android device, all three buttons are mapped to the left button. Extend both mehtods' signature by a mouse button state. Add a converter method to map from Android button states to Qt::MouseButtons. Add a sendMouseButtonEvents method, that iterates through all buttons pressed/released and sends the respective events to QWSI. Adapt the mouse handler in java, to obtain and pass the button state to C++. The patch can't be verified in an autotest. Testlib's mouse emulation injects into QWSI. Fixes: QTBUG-99106 Pick-to: 6.7 6.6 6.5 6.2 Change-Id: I933f490901928db9761d2ef254ae1e5b4f473f28 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Do not double finger size for touch eventsZoltan Gera2024-02-161-4/+4
| | | | | | | | | | | | | Fingers in touch events are modelled by rotated ellipses with their major and minor axes stored respectively. The axis is the diameter of the ellipse in one direction, not its radius. These values should be converted to a rectangle correctly, without doubling their extents. The pair of this fixed code is located in function QWindowSystemInterfacePrivate::fromNativeTouchPoints(). Pick-to: 6.7 Change-Id: I4fea7e8168a9c248a744964d4821b774b85a6cf4 Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Fix touch events for child windowsTinja Paavoseppä2023-12-141-37/+46
| | | | | | | | | | | | | | | In the touch dispatcher methods, all events were routed for the top level window at the position, which lead to all the events being delivered for the parent window. Since the JNI methods already have a parameter for window ID, take that into use and determine the window to deliver the events to by ID. Pick-to: 6.7 Change-Id: I07ad7851c32a3e633ee748036d6818b6d0fa5588 Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]>
* Android: remove a11y methods from QtNative, call a11y delegate directAssam Boudjelthia2023-11-061-14/+0
| | | | | | | | | | | Remove yet another two layers of delegation, QtNative calling QtActivityDelegate and that in turn calls QtAccessibilityDelegate. Now from c++ native code, acquire the a11y delegate and use it to call a11y operations that live in QtAccessibilityDelegate. Task-number: QTBUG-118077 Change-Id: I9e84520c2caa281a6f786a687b0106d702f92a67 Reviewed-by: Tinja Paavoseppä <[email protected]>
* Android: clean up error handling and native methods registrationVolker Hilsheimer2023-11-011-4/+3
| | | | | | | | | | | | Emit log output and return false immediately if we fail to get both the Activity and the Service objects. Standardize the registerNative methods to return bool and take a QJniEnvironment, and adjust the macros accordingly. Simplify the startup routine to use QJniEnvironment. Change-Id: I11be35426520dc803f5a07bbb495e908592f254e Reviewed-by: Tinja Paavoseppä <[email protected]>
* Android: move input handling from QtActivityDelegate to separate classAssam Boudjelthia2023-10-181-17/+102
| | | | | | | | | | | | | | | | | | | | | | | | To further simplify the code and logic of the delegate, move keyboard input code to separate class. Make an input delegate available under the QtActivityDelegate to allow classes like QtNative and the Activity to access that. For now, it's okay to leave access from QtNative to that, but for future even that should be simplified and the Activity should be accessing that directly. For the case where the QtInputDelegate needs access to QtActivityDelegate, for now namely updateFullScreen(), a new Listener is implemented to be implemented under QtActivityDelegate. Along the way use newer JNI APIs under C++ QtAndroidInput. Don't make them static methods, so that it can be possible later to do various keyboard operations to specific activity and not a global one. Task-number: QTBUG-114593 Task-number: QTBUG-118077 Change-Id: I110b897f6f16d0ae5f5a645551b4a82e8ad3f2fb Reviewed-by: Tinja Paavoseppä <[email protected]>
* androidjniinput.cpp: const and cleanupShawn Rutledge2023-10-101-18/+17
| | | | | | | Change-Id: I7af16e970d73a6d05671a78a094e583a9213c1fb Reviewed-by: Tinja Paavoseppä <[email protected]> Reviewed-by: Juha Vuolle <[email protected]> Reviewed-by: Rami Potinkara <[email protected]>
* Fix hi-dpi mouse and tablet events on AndroidShawn Rutledge2023-10-101-6/+8
| | | | | | | | | | | | | Windows are not always fullscreen: e.g. the widget gallery example main window isn't maximized, and a popup window may open anywhere on the screen. So we always needed to offset by the window position. But it's better to use QPlatformWindow::mapFromGlobal() since we are working with native coordinates here. Pick-to: 6.2 6.5 6.6 Fixes: QTBUG-109025 Change-Id: Id3d139fad610bbbc67a394599570a309196ae64c Reviewed-by: Morten Johan Sørvig <[email protected]>
* Handle ACTION_POINTER_UP with tablet eventsJuha Vuolle2023-10-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The ACTION_POINTER_UP is used when a non-primary pointer (touch, mouse stylus, eraser) goes up. Without handling this action in these cases, the table event remains in 'down' state (misses the QEvent::TabletRelease) and as a consequence when it is next put on the screen, eg. a line will be drawn to the new position (in case of a drawing application). In addition use getActionMasked() to get the action; non-masked events would contain the index of the pointer too, and wouldn't match with ACTION_POINTER_UP whose numeric value is 6. Rather the actions would be in the lines of: 261, // ACTION_POINTER_DOWN(1), 6 with getActionMasked() 517, // ACTION_POINTER_DOWN(2), 6 with getActionMasked() And so on. Pick-to: 6.6 6.5 Fixes: QTBUG-86297 Change-Id: I1b50ca4d19b611aec8a5c280ed0521e2f11797b0 Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: use logging category for im debugLiang Qi2023-06-191-24/+10
| | | | | | | Pick-to: 6.6 6.5 Change-Id: I78e84313841f83416dee6b6b2970b402acce5060 Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Jörg Bornemann <[email protected]>
* Android: Treat ACTION_CANCEL as TouchCancelEventMike Achtelik2021-10-291-6/+30
| | | | | | | | | | | | | | | | | | | | Change 64d62c53c1e92a1cc07449a0ea3c71501592c1e7 started treating an ACTION_CANCEL as a TouchPointReleased. This leads to unintentional presses, if e.g. an edge swipe for the android back gesture starts on a MouseArea. When Android takes possession of the motion, an ACTION_CANCEL is delivered, which needs to be handled as such. It should not be treated as a normal up event that triggers a press. Otherwise, we get the above-mentioned issue, where an unintentional action is performed. So let's use QWindowSystemInterface::handleTouchCancelEvent to treat it as a canceled touch in Qt. Task-number: QTBUG-72110 Pick-to: 6.2 5.15 Change-Id: I68650a180130501568e5a1e9a7f20ea469461e97 Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
* Revert "Android: Place cursor correctly on screen when editing"Rami Potinkara2021-10-261-14/+2
| | | | | | | | | | | | | | | This reverts commit 5c6b10c3cee5737dbc041d0463220898c8120807. It caused a regression such that the main window no longer resized or panned when the VKB is shown, in spite of android:windowSoftInputMode being set. Pick-to: 6.2 5.15 Task-number: QTBUG-95300 Task-number: QTBUG-96117 Task-number: QTBUG-97503 Change-Id: If56e1113eea69a940f6760bdb2ad06a93a0759c1 Reviewed-by: Andreas Buhr <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Android: Fix select handles misplacement on QDialogPekka Gehör2021-05-251-0/+5
| | | | | | | | | | Get select handles {Left, Right}Point from a mapToGlobal with a cursorRectangleof anchorRectangle of the selected word/text. Task-number: QTBUG-90799 Change-Id: I4fed19a1d3bb2247656b052306307e6980074405 Reviewed-by: Rami Potinkara <[email protected]> Reviewed-by: Ville Voutilainen <[email protected]>
* Android: Fix constant resize of a large TextEdit on clickPiotr Mikolajczyk2021-03-101-3/+1
| | | | | | | | | | | | | If there is a large (3/5 of the screen in portrait or 2/3 in landscape) TextEdit on the screen, and it gets focus on click, it will be shrank to fit the screen. Next click on this TextEdit will restore its normal height, the next will shrink. Pick-to: 5.15 Fixes: QTBUG-91056 Change-Id: I3dbf085cbfdc2739d537a304c16e28c58a6e01ce Reviewed-by: Rami Potinkara <[email protected]> Reviewed-by: Ville Voutilainen <[email protected]>
* Android: Place cursor correctly on screen when editingPiotr Mikolajczyk2021-03-051-2/+14
| | | | | | | | | | | | When editing text the cursor is not placed correctly. So this has been achieved by tricking Android into thinking that the input area is only the line where the cursor is, so it is forced to keep it on screen. Fixes: QTBUG-91073 Pick-to: 5.15 Change-Id: Icc2e8315deb76ca1a84819d3fdceaa7b027b1174 Reviewed-by: Ville Voutilainen <[email protected]>
* Android: fix compiler warnings for Android inputAssam Boudjelthia2021-02-031-31/+33
| | | | | | | | | | QPointingDevice requires using the constructor to set its settings in Qt 6. Replace + with | operator and return QKeyCombination instead of int. Change-Id: Id3da469cc13b34ec7b55afa751dbc04601880df6 Reviewed-by: Volker Hilsheimer <[email protected]>
* Make QJniObject and QJniEnvironment public APIAssam Boudjelthia2021-01-271-24/+22
| | | | | | | | | | | | | | | | | | | | As part of Qt 6 restructring for the extras modules, this change exposes the Jni APIs which are very important for Android platform. This patch adds the APIs QJniObject, QJniEnvironment, QJniExceptionCleaner based from private QtCore and QtAndroidExtras. The Jni interface is cross-platform which justifies the name, but currently, this API is used mainly for Android, and the naming comes generic without Android keyword to avoid any future limitation on supporting other platforms. [ChangeLog][QtCore] Add new QJniObject, QJniEnvironment and QJniExceptionCleaner APIs. Task-number: QTBUG-89482 Fixes: QTBUG-89633 Change-Id: I4382dd53a225375759b9d042f6035a4a9810572b Reviewed-by: Ville Voutilainen <[email protected]>
* Android: KEYCODE_MEDIA_PLAY_PAUSE translated rightPiotr Mikolajczyk2020-12-211-1/+1
| | | | | | | | | | KEYCODE_MEDIA_PLAY_PAUSE was incorrectly translated to Qt.Key_MediaPlay. This patch changes it to Qt.Key_MediaTogglePlayPause. Fixes: QTBUG-66448 Pick-to: 5.15 5.12 6.0 Change-Id: Icd2747857bc479228bfdffcd8ab8fdef7b79e918 Reviewed-by: Andy Shaw <[email protected]>
* Refactor pointer event hierarchyShawn Rutledge2020-07-101-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some goals that have hopefully been achieved are: - make QPointerEvent and QEventPoint resemble their Qt Quick counterparts to such an extent that we can remove those wrappers and go back to delivering the original events in Qt Quick - make QEventPoint much smaller than QTouchEvent::TouchPoint, with no pimpl - remove most public setters - reduce the usage of complex constructors that take many arguments - don't repeat ourselves: move accessors and storage upwards rather than having redundant ones in subclasses - standardize the set of accessors in QPointerEvent - maintain source compatibility as much as possible: do not require modifying event-handling code in any QWidget subclass To avoid public setters we now introduce a few QMutable* subclasses. This is a bit like the Builder pattern except that it doesn't involve constructing a separate disposable object: the main event type can be cast to the mutable type at any time to enable modifications, iff the code is linked with gui-private. Therefore event classes can have less-"complete" constructors, because internal Qt code can use setters the same way it could use the ones in QTouchEvent before; and the event classes don't need many friends. Even some read-accessors can be kept private unless we are sure we want to expose them. Task-number: QTBUG-46266 Fixes: QTBUG-72173 Change-Id: I740e4e40165b7bc41223d38b200bbc2b403e07b6 Reviewed-by: Volker Hilsheimer <[email protected]>
* Introduce QInputDevice hierarchy; replace QTouchDeviceShawn Rutledge2020-06-161-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have seen during the Qt 5 series that QMouseEvent::source() does not provide enough information: if it is synthesized, it could have come from any device for which mouse events are synthesized, not only from a touchscreen. By providing in every QInputEvent as complete information about the actual source device as possible, we will enable very fine-tuned behavior in the object that handles each event. Further, we would like to support multiple keyboards, pointing devices, and named groups of devices that are known as "seats" in Wayland. In Qt 5, QPA plugins registered each touchscreen as it was discovered. Now we extend this pattern to all input devices. This new requirement can be implemented gradually; for now, if a QTWSI input event is received wtihout a device pointer, a default "core" device will be created on-the-fly, and a warning emitted. In Qt 5, QTouchEvent::TouchPoint::id() was forced to be unique even when multiple devices were in use simultaneously. Now that each event identifies the device it came from, this hack is no longer needed. A stub of the new QPointerEvent is added; it will be developed further in subsequent patches. [ChangeLog][QtGui][QInputEvent] Every QInputEvent now carries a pointer to an instance of QInputDevice, or the subclass QPointingDevice in case of mouse, touch and tablet events. Each platform plugin is expected to create the device instances, register them, and provide valid pointers with all input events. If this is not done, warnings are emitted and default devices are created as necessary. When the device has accurate information, it provides the opportunity to fine-tune behavior depending on device type and capabilities: for example if a QMouseEvent is synthesized from a touchscreen, the recipient can see which touchscreen it came from. Each device also has a seatName to distinguish users on multi-user windowing systems. Touchpoint IDs are no longer unique on their own, but the combination of ID and device is. Fixes: QTBUG-46412 Fixes: QTBUG-72167 Task-number: QTBUG-69433 Task-number: QTBUG-52430 Change-Id: I933fb2b86182efa722037b7a33e404c5daf5292a Reviewed-by: Shawn Rutledge <[email protected]>
* Android: fix behovior of right click to not interfere with other clicksAssam Boudjelthia2020-06-111-10/+10
| | | | | | | | | | | | To allow treating long press as right click on Android, set the environment variable QT_ANDROID_ENABLE_RIGHT_MOUSE_FROM_LONG_PRESS to 1. Pick-to: 5.15 Fixes: QTBUG-73416 Task-number: QTBUG-84179 Change-Id: Ibe1d6af6ab9965112f1418638a088717798b554c Reviewed-by: Shawn Rutledge <[email protected]>
* Android JNI: update usage of QWindowSystemInterface::handleMouseEvent()Shawn Rutledge2020-05-121-18/+15
| | | | | | | | | | Follup to a37785ec7638e7485112b87dd7e767881fecc114: this API has been deprecated since 5.11. Pick-to: 5.15 Change-Id: Ib143f3997f89fc71d37d740338dae7df52ff45b4 Reviewed-by: Paul Olav Tvete <[email protected]> Reviewed-by: BogDan Vatra <[email protected]>
* Android: Implement MaximizeUsingFullscreenGeometryHintEskil Abrahamsen Blomfeldt2020-03-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (This reintroduces c17a5cec1901dd23f4c39ec2ae47a060fbb06895, which was reverted in Qt 5 because it requires API level 23.) This flag tells the app to use as much of the screen as possible while still keeping system UI visible, and can be supported on Android by using translucent system UI, similar to iOS. What this does: 1. It changes the current fullscreen/not-fullscreen logic to allow three states: fullscreen, fullscreen with translucent decorations and not-fullscreen. 2. In order for it to work, we have to send the actual screen geometry and available geometry, at least in the case where the user needs to know the available geometry to know the safe area of the window. So we get the real screen metrics and pass these to the QPA plugin (API level 17, so we can do that now that the minimum version is 21.) 3. Note that getting the insets and calculating the useable area does not work for non-fullscreen windows, since Android is quite inconsistent in this respect. So in this case we just use the window size and origin of 0,0 for the available geometry. 4. Since we are touching this code anyway, this patch also tries to use more consistent wording (calling it "available geometry" everywhere instead of desktop geometry in some places and just geometry in others, etc.) [ChangeLog][Android] Qt::MaximizeUsingFullscreenGeometryHint window flag is now supported, and will make the window fullscreen, but keep the system UI on-screen, with a translucent background color. Fixes: QTBUG-74202 Change-Id: I4cc5ef9cc2a3bd22d4d8d2bb767c6ff8a3aa75c0 Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Christian Strømme <[email protected]>
* Initial cleanup of qevent.h for Qt6Allan Sandfeld Jensen2020-03-051-0/+1
| | | | | | | | | | | | Takes care of the first round of todos and deprecations for Qt6 in qevent. Not touching anything that might interfere with changing the class hierarchy as the file also suggest. Change-Id: If72d63d8932f1af588785bf77b34532358639a63 Reviewed-by: Allan Sandfeld Jensen <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
* Revert "Android: Implement MaximizeUsingFullscreenGeometryHint"Eskil Abrahamsen Blomfeldt2020-01-071-2/+2
| | | | | | | | | | | | | | This reverts commit c17a5cec1901dd23f4c39ec2ae47a060fbb06895. The patch introduced a call to View.getRootViewInsets() which was introduced in API level 23. We don't want to change the minimum level for Qt 5.x series now, so we will revert the change in 5.15 and reintroduce it in Qt 6, simultaneously setting the minimum API level to 23. Task-number: QTBUG-74202 Change-Id: Ia25bb2cd62287aa80a43bbd294fb757f3f79ff5e Reviewed-by: BogDan Vatra <[email protected]>
* Android: Implement MaximizeUsingFullscreenGeometryHintEskil Abrahamsen Blomfeldt2019-11-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This flag tells the app to use as much of the screen as possible while still keeping system UI visible, and can be supported on Android by using translucent system UI, similar to iOS. What this does: 1. It changes the current fullscreen/not-fullscreen logic to allow three states: fullscreen, fullscreen with translucent decorations and not-fullscreen. 2. In order for it to work, we have to send the actual screen geometry and available geometry, at least in the case where the user needs to know the available geometry to know the safe area of the window. So we get the real screen metrics and pass these to the QPA plugin (API level 17, so we can do that now that the minimum version is 21.) 3. Note that getting the insets and calculating the useable area does not work for non-fullscreen windows, since Android is quite inconsistent in this respect. So in this case we just use the window size and origin of 0,0 for the available geometry. 4. Since we are touching this code anyway, this patch also tries to use more consistent wording (calling it "available geometry" everywhere instead of desktop geometry in some places and just geometry in others, etc.) [ChangeLog][Android] Qt::MaximizeUsingFullscreenGeometryHint window flag is now supported, and will make the window fullscreen, but keep the system UI on-screen, with a translucent background color. Fixes: QTBUG-74202 Change-Id: I7a59a6c6fb51ebbdb86e7149e794726e67001279 Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: BogDan Vatra <[email protected]>
* Revert "Release left button before showing the popup context menu"Eskil Abrahamsen Blomfeldt2019-10-211-14/+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 <[email protected]>
* Android: Support mouse hoverMichael Dippold2018-07-131-2/+1
| | | | | | | | | Android supports hover events through the generic motion event. Routed mouse events to specific mouse handler. Task-number: QTBUG-42799 Change-Id: Iee17c71c09d84f52235e66ec08c65ffa30ec9cd9 Reviewed-by: BogDan Vatra <[email protected]>
* Release left button before showing the popup context menuBogDan Vatra2018-04-151-0/+14
| | | | | | | | 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 <[email protected]>
* Android: rewrite edit context menuBogDan Vatra2018-04-151-4/+5
| | | | | | | | | | | | - 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 <[email protected]>
* Remove text selection handles when keyboard is hiddenBogDan Vatra2018-03-141-1/+3
| | | | | | | Task-number: QTBUG-58700 Change-Id: I094f31250ec879b0f08f27499794946cac2084e6 Reviewed-by: Corey Pendleton <[email protected]> Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-061-0/+1
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I43531e087bb810889d5c1fbfcdffb29b78804839
| * Android: Add lock to protect access to the platform interfaceChristian Stromme2017-07-031-0/+1
| | | | | | | | | | | | | | | | | | | | Fixes dubious lock protecting the platform interface handle, and makes sure that we lock and hold a valid reference to the platform interface before accessing it. Since the platform interface is exposed we also need to expose the mutex protecting it. Change-Id: I1ec1219a75c589bc793676369b11fb403de20102 Reviewed-by: BogDan Vatra <[email protected]>
* | Use qRadiansToDegrees() and qDegreesToRadians() more widelyEdward Welbourne2017-07-051-1/+2
|/ | | | | | | | | | | | | | | | Especially in examples, where we should show off our convenience functions, prefer calling these functions over doing arithmetic with M_PI (or approximations thereto) and 180 (give or take simple factors). This incidentally documents what's going on, just by the name of the function used (and reveals at least one place where variables were misnamed; the return from atan is in radians, *not* degrees). Task-number: QTBUG-58083 Change-Id: I6e5d66721cafab423378f970af525400423e971e Reviewed-by: Jüri Valdmann <[email protected]> Reviewed-by: Allan Sandfeld Jensen <[email protected]> Reviewed-by: Marc Mutz <[email protected]>
* Convert features.tabletevent to QT_CONFIGStephan Binner2017-06-281-6/+8
| | | | | Change-Id: Ibd7ed7f269a64afddadee70979b20f1c58398378 Reviewed-by: Oswald Buddenhagen <[email protected]>
* Android: fix missing wheel eventsJ-P Nurmi2017-06-181-0/+20
| | | | | | Change-Id: I65b4f6a8fcbdad537a984064e332a4a1f34a265a Task-number: QTBUG-43669 Reviewed-by: BogDan Vatra <[email protected]>