summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Windows QPA: Set SWP_NOCOPYBITS during resize to avoid jitterYuhang Zhao2021-11-121-1/+6
| | | | | | | | | | | | | Allowing Windows to re-use parts of the client area when resizing might result in jitter. See discussion in: https://stackoverflow.com/questions/53000291/how-to-smooth-ugly-jitter-flicker-jumping-when-resizing-windows-especially-drag Fixes: QTBUG-97774 Pick-to: 6.2 Change-Id: Idc8f0d1953dd0a8b329312d8a9fd0509cc24d81f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIOSTextInputOverlay: listen for selection changes, also for Qt::ImReadOnlyRichard Moe Gustavsen2021-11-111-4/+28
| | | | | | | | | | | | | The focus object can emit selection updates (e.g from mouse drag), and accept modifying it through IM when dragging on the handles, even if it doesn't accept text input and IM in general (and hence return false from inputMethodAccepted()). This is typically the case for read-only text fields. So we should listen for selection changes and enable handles also for this case (unless the IM hints tells us explicitly not to use handles/edit menu). Fixes: QTBUG-91545 Change-Id: I2855505fc229e954b2c43f5e11374e64bba7eb4e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIOSInputContext: use QIOSResponder when the focus object is Qt::ImReadOnlyRichard Moe Gustavsen2021-11-111-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | In Qt, Qt::ImEnabled means that the focus object accepts text input from input method (IM) events. But the IM API also contains API for dealing with text selections. Text input and text selections are logically two different operations, but since IM makes use of selections to implement text input (like selecting a word to suggest a spelling correction), it's understandable that they are combined into to same API. So when a focus object reports Qt::ImEnabled to be false, it only means that it doesn't accept input. E.g a TextArea in QML with "readOnly:true" will set Qt::ImEnabled to false. At the same time, it can have "selectByMouse:true", which lets you select text with the mouse. This behavior is consistent in Qt, for both Quick, Controls 2 and Widgets. Since we want to support any selections done in controls/widgets on iOS with selection handles and edit menus, regardless if the focus object accepts input or not, this patch will set the QIOSResponder (with read-only actions) as first responder when we detect a focus object with Qt::ImReadOnly. This means that if a query for Qt::ImReadOnly returns "true", we take that to mean that it implements the IM API, but without accepting input. Task-number: QTBUG-91545 Change-Id: I07349909a3bca81f484a2e9af9672428dca62c49 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIOSTextInputResponder: factor out the "read-only" part to a ↵Richard Moe Gustavsen2021-11-115-136/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | QIOSTextResponder base class QIOSTextInputResponder has two responsibilities; It takes care of handling text input from UIKit, and to implement first responder actions related to the edit menu, like copy and paste. Currently the responder offers both writable (paste) and readable (select, copy) actions. Because of the former, it means that it can only be used for focus objects that accepts text input. Since we also want to be able to show an edit menu for selections done on a read-only input field, this patch will factor out the read-only actions we want for that case into a QIOSTextResponder base class. An instance of this class can be used as first responder for a focus object that has read-only text, but otherwise doesn't support text input. This part is implemented in a subsequent patch. The remaining set of writeable actions, together with input method handling, will continue to be in the QIOSTextInputResponder subclass. Task-number: QTBUG-91545 Change-Id: I1c215bb509eb7820c6c60f7ad806f61a5de02ded Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Q{XcbGl,EglFSDevice}IntegrationFactory: remove unused extra plugin pathThiago Macieira2021-11-104-51/+6
| | | | | | | | | | Cargo-cult copied this from somewhere, unnecessarily. This just made the code bigger for no reason. Task-number: QTBUG-97950 Pick-to: 6.2 Change-Id: Ice04365c72984d07a64dfffd16b48520d42c7043 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Bump WINVER, _WIN32_WINNT and _WIN32_IE to _WIN32_WINNT_WIN10 (0x0A00)Yuhang Zhao2021-11-106-25/+12
| | | | | | | | | | | And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time, to unblock the developers from accessing the latest Windows APIs. Pick-to: 6.2 Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unreachable breaksDavid Skoland2021-11-101-5/+0
| | | | | Change-Id: I0e005964624125d3ab12f77c94fd393802547a13 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Add QCALayerBackingStore::preserveFromFrontBuffer helper functionTor Arne Vestbø2021-11-082-10/+22
| | | | | | Pick-to: 6.2 Change-Id: Iadd4791907564b8b82437643c54696ffa778d882 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Rename QCALayerBackingStore::prepareForFlush()Tor Arne Vestbø2021-11-082-39/+50
| | | | | | | | The need to finalize the back buffer isn't limited to flushing. Pick-to: 6.2 Change-Id: I98b04ab49ec27ea536e99462deab8d48a8e40e82 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Track painted area of backingstore buffer via its dirty regionTor Arne Vestbø2021-11-082-17/+28
| | | | | | | | | When introducing support for scrolling the backingstore it doesn't make sense to track the painted region explicitly. Pick-to: 6.2 Change-Id: I370932f02490ac526fb049908f99af678884e807 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Don't defer back/front-buffer swap in CALayer backingstoreTor Arne Vestbø2021-11-081-25/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | CoreAnimation doesn't immediately mark a surface as in use the moment we assign it to a layer, but defers it until the surface has bee picked up by the window server. In theory this would allow us to defer the swap until the next beginPaint(), which would allow painting to the back buffer again before Core Animation has time to flush the transaction and persist the layer changes to the window server, and would also automatically deal with requests to flush without painting anything. But, since a client may do several rounds of beginPaint/endPaint before flushing, we might end up in a situation where we detect that a surface is in use in the middle of several paint rounds, and end up swapping in a new back buffer without copying over the previously painted content, like we do in prepareForFlush. To be on the safe side we swap the back and front buffer straight away. We also need to mark the surface in use, to prevent the same problem from appearing when the window server doesn't pick up the surface in between two rounds of flushes. Pick-to: 6.2 Change-Id: Ib418852424773c399df710da33a388e8d2c2e92c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* wasm: fix size of QDialogsLorn Potter2021-11-061-1/+6
| | | | | | | | | We can simply propagate the minimum window size. Pick-to: 6.2 5.15 Fixes: QTBUG-83503 Change-Id: Ia9f67c92ca37fd0f4e89f08e5153e12c1385f6f8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* iOS: Hide UIWindow before restoring mirror modeTor Arne Vestbø2021-11-041-1/+1
| | | | | | | | | | Doing it the opposite way, by associating the new screen first, will result in the external screen not going back to mirroring the main display. Pick-to: 6.2 5.15 Change-Id: I63970380fc4f0902af5032043809a9c1b1f9f95b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* iOS: Defer restoring screen mirroring until next runloop passTor Arne Vestbø2021-11-041-3/+7
| | | | | | | | | | | | | | | Associating the UIWindow with a different screen will trigger layout of the child views of the window, including the view that we're in the process of removing, which doesn't have a platform window anymore. Instead of protecting every possible code path in the view code with checks for a platform window we defer the restoring of mirror mode until after the view has been removed. Pick-to: 6.2 5.15 Task-number: QTBUG-94530 Change-Id: I8c66106cafa67e06721e621c019b2d10acf02326 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* iOS: Don't try to initialize a11y for views that have no platform windowTor Arne Vestbø2021-11-041-0/+5
| | | | | | | | | | The window may have been destroyed, but the UIView may still be be referenced and kept alive by the a11y subsystem. Pick-to: 6.2 5.15 Task-number: QTBUG-94530 Change-Id: I24f1c9d45e80c1bb4c92536e7f91533a94fd077f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qnsview_mouse, scrollWheel: do not assume zero deltas on Ending phaseTimur Pocheptsov2021-11-031-4/+4
| | | | | | | | | | | | | | | | | | It's somewhat difficult to reproduce, but having a mac with a trackpad and a huge scrollview (meaning I have to scroll fast and a lot), I am able from time to time to trigger an assert on the line: Q_ASSERT(pixelDelta.isNull() && angleDelta.isNull()) In all such cases, I can see that deltas are not zero, but equal to the ones that the next event (momentumPhase == Begin) has. The code is based on Tor Arne's patch. Pick-to: 6.2 5.15 Fixes: QTBUG-97945 Change-Id: I874c776b265d3950cc2b6c1d8054363b3d0d1fde Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add ShowDirectoriesFirst platform theme hintMitch Curtis2021-11-031-0/+2
| | | | | | | | This allows Qt Quick Dialogs to accurately check how it should show files and directories. Change-Id: I0f5102553ff9a0484b3714ba176f7e5e668fd05c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QAbstractFileEngine: Remove useless method overridesIevgenii Meshcheriakov2021-11-033-16/+0
| | | | | | | | | | | | Remove useless overrides of QAbstractFileEngine methods from the derived classes. Also remove "This virtual function must be reimplemented by all subclasses" passages from the QAbstractFileEngine's documentation. There are pure virtual methods for such use cases. QAbstractFileEngine already contains useful defaults for classes not supporting all the functionality. Change-Id: Ia25965854f3809b15d7502da3749cc2f3414bbc3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Revert "Add support for EGL_EXT_platform_xcb"Paul Olav Tvete2021-11-021-6/+1
| | | | | | | | | | | This reverts commit 816c5de460439faac0745cb364c374162b7fc651. Reason for revert: Causes crash on Nvidia when Qt is configured with -opengl es2 Fixes: QTBUG-97738 Change-Id: I9fe43146b922fc770890a144fdb1bd1c564635bb Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix show()/hide() for child windows on xcbLars Knoll2021-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change e946e6895a8517a887ac246905e0769edd766fcc implements proper support for ICCM 4.1.4 window state handling. One issue it addressed is that a show() after a hide() needs to be delayed until the window manager/X-server has processed the previous event. This was handled with a deferred task list to send the map/unmap events. According to ICCM, we should wait for the _NET_WM_STATE notification before processing the deferred events. But this is only true for top level windows, as child windows are not handled by the window manager and will never receive any _NET_WM_STATE notifications. For those, we should use the unmap notify event, which means that the X-server has processed the unmap and handle deferred events once that notification has been received. This fixes an issue in Qt Multimedia, where QVideoWidget would not show the video anymore after a minimize of the player or when making the QVideoWidget fullscreen. This is because QVideoWidget uses an embedded QWindow to render video using HW acceleration. Fixes: QTBUG-97257 Pick-to: 6.2 5.15 Change-Id: I5c47eba3276a1f243bdafd5346f353c7843403bb Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* windows qpa: re-apply 8d6e825dMorten Johan Sørvig2021-10-291-0/+2
| | | | | | | | | | | | “Handle invisible child windows gracefully on dpi changes” This fix was accidentally removed by commit cd96d870 “Move VM_DPICHANGE handling to QWindowsWindow”. Fixes: QTBUG-96466 Pick-to: 6.2 Change-Id: I3774f6305631ba47282d43e8480e2acaba517a96 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* 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 <assam.boudjelthia@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* wasm: fix changing cursor shapeLorn Potter2021-10-292-9/+10
| | | | | | | | | | | | | The previous implementation would occasionally result in a crash when a window was closed. Apparently 'auto' cursor does not work so well, so we now use 'default' name. Fixes: QTBUG-96178 Pick-to: 6.2 5.15 Change-Id: I0179d20dbdc01f0e3021d746324e1e39c678a298 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Revert "wasm: Hide popups when a window is left-clicked"David Skoland2021-10-291-3/+0
| | | | | | | | | This reverts commit 0921caf9769c84192c539db22085d343f1a4b5b1. Reason for revert: This change breaks mouse press handling in popups themselves. I'll make another solution. Change-Id: Ib9fd41f3f078e6abf22e5b0f75724d4acc737ead Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add missing macOS header file that was indirectly included beforeØystein Heskestad2021-10-271-0/+1
| | | | | Change-Id: I4d4c7d4f957fc36dea5e06eb6d661aeecf6385f1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Adjust behavior of windowIsPopupType and hasTitleBarDavid Skoland2021-10-272-9/+8
| | | | | | | | | | | The previous implementation did not check for the popup flag, so it was added, and the tool window exception was preserved. hasTitleBar was also changed so it checks for popups and not tooltips specifically (tooltips are always popups). Change-Id: I3e2ba3be56e992b30ca2a07375092073572e7fcb Pick-to: 6.2 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: fix window activationLorn Potter2021-10-273-1/+9
| | | | | | | | | | | | | | This fixes window activation of dialogs and tooltips In the case of tooltips, We were activating the window being removed. In the case of dialogs, we need to raise the window before requesting the activation. Change-Id: Ie989e6d92afedf1895b5e188f0695f6254d70272 Fixes: QTBUG-94918 Pick-to: 5.15 6.2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Revert "Android: Place cursor correctly on screen when editing"Rami Potinkara2021-10-264-63/+9
| | | | | | | | | | | | | | | 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 <andreas.buhr@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* wasm: Hide popups when a window is left-clickedDavid Skoland2021-10-251-0/+3
| | | | | | | | | This logic is taken from the macOS platform implementation and seems reasonable to reuse in WASM. Fixes: QTBUG-90990 Change-Id: Id4a4dd8d9fdd9de3085bfcd9079793aad3dda363 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Android: set EXTRA_TITLE to the initially selected file in save dialogAssam Boudjelthia2021-10-252-4/+9
| | | | | | | | | | | | | | | The extra data EXTRA_TITLE is only documented to be used to provide the initially selected file name in the context of file dialog [1]. So, let's stick to setting it only in save mode. This also now allows the save dialog to set an initial file name which wasn't possible before. [1] https://developer.android.com/reference/kotlin/android/content/ Intent#action_create_document Pick-to: 6.2 5.15 Change-Id: Ib55191a7269bfad28af4928f4e74d87981bdd574 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Initialize member variables before we check their valuesVolker Hilsheimer2021-10-251-5/+3
| | | | | | | | | | | | | Amends 51679efcf97dfea86431912eeb9489088c0804ed, which broke Ctrl+key handling so that the key was not translated based on the alphanumerical character anymore. Fixes: QTBUG-97713 Pick-to: 6.2 Change-Id: I9835fd7af99693aae636ba3c4c114ef8e11621e9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* xcb: use QXcbConnection::selectionOwner() convenience APIGatis Paeglis2021-10-224-18/+7
| | | | | Change-Id: I4fbae152829206b15bf0430d3fb2c9e2b6026566 Reviewed-by: Liang Qi <liang.qi@qt.io>
* xcb: remove confusing indirections for qt selection ownerGatis Paeglis2021-10-226-76/+40
| | | | | | | | | | | | | | | | | | | | This makes it more obvious that clipboard and DnD use the same selection owner (QXcbConnection::qtSelectionOwner()). This way we can also drop some QT_NO_CLIPBOARD defines. These defines actually are broken, but that is out-of-scope for this patch. And renamed the functions according to Qt guidelines: getSelectionOwner() -> selectionOwner() getQtSelectionOwner() -> qtSelectionOwner() The previous naming probably was influenced by underlying C API - xcb_get_selection_owner(). Change-Id: I467f1a3dbe75b4e8fd41c7e66ca9b0e25ef1039c Reviewed-by: Liang Qi <liang.qi@qt.io>
* xcb: avoid to use invalid pointersLiang Qi2021-10-222-2/+14
| | | | | | | Pick-to: 6.2 5.15 5.12 Task-number: QTBUG-96399 Change-Id: I33909940b501cb13f78981c43f3aef9fc9d1d52d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* macOS: add default Edit menu items, if not added by AppKitVolker Hilsheimer2021-10-212-0/+49
| | | | | | | | | | | | | | | | | | | | | | AppKit automatically appends "Start Dictation..." and "Emoji & Symbols" menu items, after a separator, to a menu in the menu bar that has the title "Edit" in the operating system language. Qt applications might however be translated to some other language, in which case the "Edit" menu is not recognized by AppKit, and the menu items won't be added. This is bad for accessibility and for users wanting to type emojis. If we have a menu that has the title "Edit" as translated in Qt's i18n system, then create those items manually. To prevent a duplication of the system- provided menu items, don't add the items if there already is one with the action being set to the relevant selector. Otherwise, perform the selector or call the NSApplication method ourselves. This then results in the relevant keyboard input through regular code paths. Fixes: QTBUG-79565 Change-Id: Ifd06036211756277550d398034689aca8e770133 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make QOffscreenX11PlatformNativeInterface a QX11ApplicationMichal Klocek2021-10-212-1/+15
| | | | | | | | | | | | | | Make it possible to use new native interface QX11Application with offscreen plugin in case of x11, which technically is x11 application without xcb connection. This change is motivated by use of new native interface in webengine, where offscreen plugin is used for some tests. Pick-to: 6.2 Change-Id: Ic2ed5b39573062feaa1e8985962d5d9327b371d7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QFactoryLoader: continue the port from JSON to CBORThiago Macieira2021-10-202-2/+4
| | | | | | | | | | | | | | This continues the effort from the previous commit, by not passing through the JSON conversion at all, and simply using CBOR directly. The port in qtbase is complete, but in order to support the conversion in other modules without introducing breakages, there's a temporary class used for converting to QPluginParsedMetaData from QJsonObject. It'll be removed once all other modules have finished converting. Change-Id: I2de1b4dfacd443148279fffd16a3ed4ddaf34afc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* macOS: Wake up event dispatcher after running modal dialog helpersTor Arne Vestbø2021-10-203-0/+14
| | | | | | | | | | | | | The root event loop may have been exited, so we need to ensure the event dispatcher is woken up so it can evaluate whether it should continue or not. For most applications this happens automatically when e.g. the user moves their mouse or press a key, but for tests this may not be the case, and the test will stall and never exit its event loop. Pick-to: 6.2 Change-Id: Ic241e3f1045481c34150289ff711b921addb18e4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Make sure Qt::Popup is treated like a dialogDavid Skoland2021-10-182-3/+2
| | | | | | | | | | | According to the documentation, Qt::Popup should have a proper frame with a title bar. To honor this, two functions had to be slightly altered. Change-Id: I4bbc18e6b7fbec5702fad6e22ef2226c09dea15a Fixes: QTBUG-94768 Pick-to: 5.15 6.2 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Add comment about the meaning of magic number in QWasmEventTranslatorDavid Skoland2021-10-181-0/+5
| | | | | | | | Without this comment, the button == 0 code is very cryptic. This comment helps in deciphering what exactly is being checked. Change-Id: Ied96118362d097d7036bafcc491b8574e1225de1 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* macOS: Don't require marked text before passing mouse down to input contextTor Arne Vestbø2021-10-161-6/+9
| | | | | | | | | | | | | | | | | There are situations where the input context might want the event, even if there's no marked text, for example when long-pressing A with a US keyboard layout and getting the accent popup. In that case we want a press somewhere else in the input item to move the cursor, and commit the current preedit. This is the same approach as NSTextView has, always calling handleEvent, and in line with the recommendation from Apple: https://lists.apple.com/archives/cocoa-dev/2012/May/msg00539.html Pick-to: 6.2 Change-Id: Iff0861a4e604ab594d1ad4ccbb9367d8e0ffe4ef Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Pass on mouse press if input context didn't handle itTor Arne Vestbø2021-10-161-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We follow the approach of [NSTextView mouseDown:] by bailing out if the input context handled the event, and otherwise passing it along to the input item. This allows moving the cursor with a single click in the input item, which will also commit the current preedit string as is, depending on the input context. For some reason 2-Set Korean input results in plain insertText calls for each step of the composition with an NSTextView, while we get marked text. The result is that when composing with 2-Set Korean, a native NSTextView will only require a single click to move the cursor, while for us it requires two, since the input context says it handled the event. We opt to follow the behavior of NSTextView to bail out if the input context handled the event, instead of trying to emulate the observed behavior for 2-Set Korean by always passing the mouse event on, as the former seems like a safer approach. This is also in line with the recommendations from Apple: https://lists.apple.com/archives/cocoa-dev/2012/May/msg00539.html Pick-to: 6.2 Change-Id: I372ac62ee3b8b20531cd7cfa2d412a5efea3eb68 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add implementation of QCocoaInputContext::commit()Tor Arne Vestbø2021-10-162-0/+28
| | | | | | | | | | Without this we end up treating input method commits from the input items as cancellations, as the base class implementation doesn't do anything. Pick-to: 6.2 Change-Id: Ieeed71404ee32ab51287b2f4f2d70ffcf9d8e7ef Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Only send mouse press to input context if clicking input itemTor Arne Vestbø2021-10-161-2/+13
| | | | | | | | | | | | | | | Our QNSView can represent many controls, not just the current input item, so we need to ensure the click happens inside the input item before we ask the input context to handle the event. This allows clicking controls such as buttons and check boxes while composing complex text, without cancelling or otherwise affecting the composition. Fixes: QTBUG-57347 Pick-to: 6.2 Change-Id: I8449c8d74fd21b1ee1d5bd75f960751b64d7e078 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* xcb: Use byte buffer for event masksPovilas Kanapickas2021-10-161-23/+30
| | | | | | | | | | This prepares for use of masks larger than 32 bits which happens on XI 2.4. Additionally, since the XI protocol always sends the masks using little-endian, the XI protocol support on big-endian machines was currently broken. Change-Id: Id22131e075059cea783b5be0691a673a457c7364 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: Fix typos in source code commentsJonas Kvinge2021-10-146-6/+6
| | | | | Change-Id: I3a91f57d3c47d9e96215d5dc064664626a8f65e7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qwindowsdialoghelpers: Fix typo in documentationJonas Kvinge2021-10-141-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I23e096655f68d64c0c40c02a246582916c2d1743 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* qxcbscreen: Fix typo in documentationJonas Kvinge2021-10-141-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I92f7d707a1395594ad6d1fe841fa77d21ae7c8b1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Correctly record normalGeometry in Cocoa pluginVolker Hilsheimer2021-10-143-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cocoa sends QWidget the state-change notification after the window has been resized already, at which point we cannot store the normal geometry anymore. Handle zoom and full screen callbacks prior to the state changing to store the geometry in QCocoaWindow. We do not need to handle minimized state, as the window will still reflect the original geometry. Return the stored value from an override of QPlatformWindow::normalGeometry so that QWidget gets the correct values even though the new state is already active. Fix the tst_QWidget::normalGeometry test to make it pass on all platforms by waiting for the window to actually have transitioned to the new state before comparing geometries. Both macOS and Windows fully pass; on Xcb, deminimizing a window using setWindowState does not work, which is why the test was partially skipped (confirmed by visual testing). Move those problematic, complex test cases to the end so that most cases are covered on Xcb as well. Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Pick-to: 6.2 Change-Id: I518a5db9169b80e8fa25fe4fa2b50bd1ea0e6db3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: Fix handling of cursor position when stop composingAndreas Buhr2021-10-141-7/+15
| | | | | | | | | | | | | | | | | | | | | | This is a workaround for a problem in TextEdit. The symptom is that when the user places the cursor inside of a word and hits backspace, the last letter of the word is removed instead of the letter just before the cursor. The reason is as follows. When stopping composing, the current cursor position has to be maintained. To that end, QAndroidInputContext sends an event containing the text to be committed and the cursor position to the editor. But the resulting cursor position is wrong. This patch adapts QAndroidInputContext to send two events: One to commit the text, the second to place the cursor. A real fix would fix the editor to correctly handle the event containing both the committed text and the cursor position. Fixes: QTBUG-97491 Pick-to: 6.2 5.15 Change-Id: Idd00e5afcbfe29c9cb77356f9add2e881c51b9bb Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>