summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylanddisplay.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Client: Fix cursor size becoming bigger and bigger when switching screensJohan Klokkhammer Helsing2018-10-081-3/+4
| | | | | | | | | | | cursorSize was a static which was multiplied with the dpr each time loadCursorSize was called resulting in a bigger and bigger cursor size. Fix it by making the static constant. Change-Id: Ie23cf0cc0d6c13721feecebe214d7c794be35077 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Client: Fix regression; drawing decorations of active windows as inactiveJohan Klokkhammer Helsing2018-08-281-0/+5
| | | | | | | | | | | | We can't trust QWindow::isActive, because it relies on focusWindow, which may be updated too late, and there might also be multiple active toplevel windows at once on Wayland. Even though Qt doesn't support multiple seats, we should still draw the decorations of active windows correctly. This implements QPlatformWindow::isActive and uses it in the decorations. Change-Id: I34d79b354e2d26694533e2319a26f24085212243 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Client: Implement xdg-decoration-unstable-v1 for SSD supportJohan Klokkhammer Helsing2018-08-141-0/+7
| | | | | | | | | | | | | | [ChangeLog][QPA plugin] Added client-side support for the xdg-decoration-unstable-v1 Wayland extension. Qt clients will now let the compositor draw the window decorations if configured through this extension. Note: The env var QT_WAYLAND_DISABLE_WINDOWDECORATION is still supported, but works on a higher level, and for all shell integrations, while xdg-decoration only works with xdg-shell stable. Task-number: QTBUG-69746 Change-Id: I9dd0331bbd8d624c6be54ed23ee3b96446d5820d Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Add XdgOutput client supportDavid Edmundson2018-08-031-0/+5
| | | | | | | | | | | | | | | | | XdgOutput is an extension of wl_output with the benefit of having the logical size of a screen as an explicit parameter, instead of clients inferring it from modeSize / scale. This is useful as it allows compositors to implement fractional scaling whilst clients can still fill the screen. In the future XdgOutputV2 will support a more useful name and ID that we can use. [ChangeLog][QPA plugin] Added support for xdg-output-unstable-v1 Change-Id: I2e1e64ad6cb497a1cbb7b7b170f28ac92231c2c4 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Draw disabled text color for inactive window decorationsJohan Klokkhammer Helsing2018-06-291-0/+7
| | | | | | | Task-number: QTBUG-68834 Change-Id: Iced478d12b56fc360c0d824cf5876855d887f9a2 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Client: Move cursor theme logic into its own class, QWaylandCursorThemeJohan Klokkhammer Helsing2018-05-281-15/+8
| | | | | | | | | | | | | ...and out of QWaylandCursor. Encapsulates the ugly details of wayland cursor themes, and presents a simple interface. A theme is created with a given size and theme name. wl_cursor_images for a theme can be acquired through: wl_cursor_image *QWaylandCursorTheme::cursorImage(Qt::CursorShape shape); Change-Id: Ia6fc6f2997133ca25c1610ecdf075ecb5c4edbfa Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Client: Only load cursor theme onceJohan Klokkhammer Helsing2018-05-281-0/+35
| | | | | | | | Now cursor themes load once per device pixel ratio, and not once per screen. Task-number: QTBUG-67796 Change-Id: I4c253e65a791d69e7d510c4228989390a4343110 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Replace qtkey-extension with qt-key-unstable-v1Johan Klokkhammer Helsing2018-05-241-1/+1
| | | | | | | | | | | | | | | | - Remove the "dummy" request, which seems to be just leftover test code. - Rename the event from "qtkey" to "key". We've already prefixed the global interface, no need to also prefix the event. - Prefix the global with `zqt_` and suffix it with "_v1". If we make backwards incompatible changes, we should bump the suffix, rename the xml-file and reset the version number. - Add some documentation to the xml file. - Add notice about (lack of) compatibility guarantees. - Four spaces for indentation Task-number: QTBUG-68423 Change-Id: I78f0eaff4cac22f27318ba32c83c83feb2de857a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Move wl-shell to a pluginJohan Klokkhammer Helsing2018-05-181-1/+0
| | | | | | | | | | | [ChangeLog][QPA plugin] The wl-shell shell integration has been moved to a plugin. This also adds API so shell integrations can return native resources for windows, as it was needed in order to continue to supporting wl_shell_surface. Change-Id: Ibc68ffcc5b0c6993d8f4e078f663e4d67340e1a5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Client: Lazy load QWaylandCursorJohan Klokkhammer Helsing2018-05-161-1/+0
| | | | | | | | | | | If nothing is trying to access QWaylandScreen::cursor() leave the platform cursor uninitialized. This in turn avoids initializing cursor themes, which may use a significant amount of shared memory depending on the cursor size, number of screens and screen DPI. Task-number: QTBUG-67796 Change-Id: Ifd062cb52c4889adcaadeb00bea928b8e84a2182 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Adapt the cursor size per screenAleix Pol2018-05-151-4/+4
| | | | | | | | | | Adapt the cursor size to the screen's devicePixelRatio, so we are not forced to have a tiny cursor on a high dpi screen or a huge cursor on external low-dpi displays. Change-Id: I3712dc64e5c5e2e05d0dc5943bd49ba5c1335cd3 Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Move xdg-shell-v5 to a pluginJohan Klokkhammer Helsing2018-05-091-3/+0
| | | | | | | | | | | | | This is the first step in deprecating xdg-shell unstable v5 and making the good names available for the good names for xdg-shell stable. Shell initialization has been refactored slightly, so the QWaylandShellIntegrationFactory actually tries to initialize the shell integration before returning it. Similarly for the factory method of non-plugin shells. Change-Id: I85e60594c4fc03c6f302c04316110aed428d28dc Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Add logging category for Wayland platform pluginJohan Klokkhammer Helsing2018-03-051-0/+2
| | | | | | Change-Id: Ic42119e47afc7bda72eb985fe86d1343a762c274 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Init variables where they are declared when possible (clang-tidy)Johan Klokkhammer Helsing2018-02-271-14/+0
| | | | | | | | | | | | | | | | | | | | clang-tidy -p compile_commands.json $file \ -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' \ -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' \ -header-filter='qtwayland' \ -fix Afterwards I ran search and replace on the diff to clean up some whitespace errors: - Replaced '(\n\+[^:\n]*)(:\s+\+\s+)' with '$1: ' - Replaced '(\n\+[^,\n]*)(,\s+\+\s+)' with '$1, ' - Replaced '\n\+\s*\n' with '\n' I also had to do some manual edits, because for some reason, this particular clang-tidy check doesn't trigger for some files. Change-Id: I3b3909bac4bf20108bbe8ad1e01bcc54236dae1b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Client: Fail gracefully when wl_display_connect failsJohan Klokkhammer Helsing2018-02-261-4/+5
| | | | | | | | | | | | | [ChangeLog][QPA plugin] If we're unable to create a connection to the Wayland display, fail gracefully so other platform integrations can be tried instead. This also adds QWaylandIntegration::hasFailed() which can later be extended to report that the platform plugin is unusable for other reasons. I.e. no compatible shell extensions or similar. Task-number: QTBUG-59762 Change-Id: I0f1ae73982e2860814235c1a189741d130e1db3e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Use nullptr instead of 0 or NULLJohan Klokkhammer Helsing2018-02-201-15/+15
| | | | | | | | Applied automatic fixes using clang-tidy's modernize-use-nullptr, and some manual cleanup to prevent QFlag macros to be affected. Change-Id: I88f94390185bc6e6f23693b68723cd5710815ae6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Client: Don't leak the last Wayland sync callbackJohan Klokkhammer Helsing2017-12-181-0/+3
| | | | | | | | If QWaylandDisplay is deleted while waiting for a sync callback, don't leak the callback. Change-Id: I4fd46cdc8c431e44998d70d1afc01018c4908f27 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Port away from QRegion::rects()Marc Mutz2017-12-041-1/+1
| | | | | | | Use begin()/end() instead. Change-Id: I1a73b4518ee7408271ec913a219c034e330b0d5a Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Fix tst_client::windowScreen and tst_client::screens sometimes freezingJohan Klokkhammer Helsing2017-11-231-0/+9
| | | | | | | | | | Sometimes the callback in forceRoundTrip would be handled in response to the QEventDispatcher::aboutToBlockSignal signal emitted at the start of processEvents, and would wait there for more events that may never come. Task-number: QTBUG-64696 Change-Id: I4e38a4dd4158afc606e779ff615b5eef98b955b0 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* Replace Q_NULLPTR with nullptrKevin Funk2017-09-261-4/+4
| | | | | | | Change-Id: I9699a957430b8d3574ce29acb91b7ada9ea6209b Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up draganddrop and clipboard featuresPaul Olav Tvete2017-03-231-3/+5
| | | | | | | | | | | | Don't assume that no-draganddrop implies no-clipboard. Introduce a new private feature wayland-datadevice which contains the common functionality. This feature cannot be controlled independently, but is automatically disabled when both clipboard and draganddrop are disabled. Change-Id: I6aac09c7ee524e3b11f0a1caa4a6c62fc3f1d10f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Code cleanup (fixing -no-feature-cursor)Paul Olav Tvete2017-03-081-0/+27
| | | | | | | | Move QWaylandDisplay member functions into the correct .cpp file. Change-Id: Ie3915d2bd0d191900ad2fd306564bb732e40221a Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Fix crash when running without shell integrationGiulio Camuffo2017-02-161-1/+8
| | | | | | Change-Id: Ia480913fd9986cbd306858d1fb497e1fb70551f0 Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Fix build without feature.clipboardTasuku Suzuki2017-01-131-0/+2
| | | | | Change-Id: I195efecca9350cb519865f251cdee9c6e23d3592 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use new feature system, part 2Lars Knoll2016-11-231-3/+3
| | | | | | | | | Convert all uses of QT_NO_FOO to proper QT_CONFIG(foo) checks. Change-Id: Id0f0b3325c246567a43d6b2d71b0d69e5535e648 Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Remove QWaylandWindow::shellManagesActiveStateJohan Klokkhammer Helsing2016-11-101-5/+1
| | | | | | | | | | | | If m_shellSurface was deleted, there was no way for QWaylandDisplay to know whether the shell handled window deactivation or not. The shell integration now always handles the window active state. The default implementation of QWaylandShellIntegration will make a window active on keyboard focus. Change-Id: I80cfce9976b1d3c57094fdd8980c9110b873f239 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Merge remote-tracking branch 'qt/5.7' into 5.8Paul Olav Tvete2016-11-101-0/+6
|\ | | | | | | Change-Id: Ibfe6fe6ed983b537d55544883b7dc75e5cc3fc37
| * Merge remote-tracking branch 'qt/5.6' into 5.7Paul Olav Tvete2016-11-101-0/+12
| |\ | | | | | | | | | Change-Id: I1efd16d6c5f939d61001376c3b010eae1927595b
| | * Fix build when some features are disabledPaul Olav Tvete2016-11-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make QtWaylandClient compile when Qt is configured with: -no-opengl -no-accessibility -D QT_NO_CLIPBOARD -D QT_NO_DRAGANDDROP -D QT_NO_SESSIONMANAGER Task-number: QTBUG-56192 Change-Id: Idc6aae6b36a35515109a27bed31a22e3e909ef27 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
| | * Client: Remove windows from keyboard focus list when destroyedJohan Klokkhammer Helsing2016-10-241-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the undefined behavior in tst_WaylandClient::touchDrag and mouseDrag Note: The test still fails if run twice in a row, but it appears to be deterministic. Task-number: QTBUG-56187 Change-Id: Ib45d82224f004d1324f2ce4d6b7df05ee36c04f5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 0049240a2b7d8691f09224e1542919ddbbb0d864) Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | | Client: Remove windows from keyboard focus list when destroyedJohan Klokkhammer Helsing2016-10-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the undefined behavior in tst_WaylandClient::touchDrag and mouseDrag Note: The test still fails if run twice in a row, but it appears to be deterministic. Task-number: QTBUG-56187 Change-Id: Ib45d82224f004d1324f2ce4d6b7df05ee36c04f5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | Don't assume we always have a shellPaul Olav Tvete2016-09-051-1/+2
|/ / | | | | | | | | | | | | The mininimal-cpp compositor example does not have any shell extensions. Change-Id: Ifec2822ef4f5944eed02c19ddfc47419051364a4 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | Merge remote-tracking branch 'qt/5.6' into 5.7Paul Olav Tvete2016-08-261-7/+10
|\| | | | | | | Change-Id: I6784a53fcc2f0f68b8e916181cb8cdef263782b8
| * Client: Fix keyboard focus logic and crashJohan Klokkhammer Helsing2016-08-261-7/+10
| | | | | | | | | | | | | | | | | | | | The previous solution did not check for nullptr before dereferencing, which caused a crash. Furthermore, it checked the new ShellSurface's shellManagesActiveState before deciding whether to unfocus the old one. Task-number: QTBUG-55526 Change-Id: I410b6200a5b7b86806f70970730045a4a25f21db Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-111-27/+12
|\| | | | | | | | | | | | | | | | | Conflicts: src/client/qwaylanddisplay.cpp src/client/qwaylanddisplay_p.h src/client/qwaylandxdgpopup_p.h Change-Id: If86ea09971773dc6c541f07819459a90e8ab73a0
| * Make wl_shell and xdg_shell use the QWaylandShellIntegration interfaceJohan Klokkhammer Helsing2016-08-091-20/+11
| | | | | | | | | | | | | | | | This simplifies the code in QWaylandDisplay and hopefully makes it easier to implement a prioritized shell selection mechanism later. Change-Id: I2bb3a13f8acedb60a6606cb3a8b5b228095eadf9 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
| * Client: Refactor window active stateJohan Klokkhammer Helsing2016-08-081-7/+1
| | | | | | | | | | | | | | | | Let shell surface implementations decide if they manage activated state. Moves the logic out of QWaylandDisplay. Change-Id: I75c86df68a1a93f9b1d2bf378b6603215d0b0128 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-011-0/+69
|\| | | | | | | Change-Id: I75a8ddc0652f3c6f438ef98e940c9357450d29c6
| * Use xdg_shell configure events to determine active windowJohan Klokkhammer Helsing2016-07-041-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the xdg_shell protocol, the compositor is allowed to set multiple active windows. Qt's model, however, allows only a single active window. In order to map between the models, a list of the compositor's active windows is kept in QWaylandDisplay in the order they were activated. Hence, the front of this list will always be the most recently activated window, and it will be mapped as Qt's active window. Previously keyboard focus was used to determine the active window, this method has been disabled for xdg_shell. Functionality for delaying the call to QWindowSystemInterface::handleWindowActivated has been moved from QWaylandInputDevice::Keyboard to QWaylandDisplay so the implementations can share the workaround. Task-number: QTBUG-53702 Change-Id: I878151f9c52ed09a8d6571c6208920436c3ca8fc Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-301-11/+0
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/client/qwaylandinputcontext_p.h src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h Change-Id: Iac517e1985e4e67d7ca00ca4c10dcda9dd9079f9
| * Remove unused method QWaylandDisplay::lastKeyboardFocusInputDeviceJohan Klokkhammer Helsing2016-06-291-11/+0
| | | | | | | | | | Change-Id: Iee19b36ae2032112e0097dc6eb2e4592697c2a1c Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@hawaiios.org>
* | Fix text-input support for new APIJan Arne Petersen2016-04-181-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update text input support to upstream text-input protocol v2 from wayland-protocols. Remove support for input-method protocol for now. Map text-input protocol on compositor side to the Qt input method API, this allows to use any qt platform input method on compositor side (especially qtvirtualkeyboard). Add support for qtvirtualkeyboard to pure-qml example. Implement all missing functions of the text-input protocol. Change-Id: I597451ff65454a63dff86026b6a8d1ffbe07ce02 Done-with: Zeno Endemann <zeno.endemann@kdab.com> Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* | Updated license headersAntti Kokko2016-01-201-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: I76ae5d3e64f096eb3163d6163a38d68c7c1ca756 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-12-011-19/+23
|\| | | | | | | | | | | | | Conflicts: src/client/qwaylanddisplay_p.h Change-Id: I602b90a055d1322af369fb7b77a68583154b660f
| * client: Remove the event threadGiulio Camuffo2015-11-031-19/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the compositor sends events to us while the main thread is blocked the socket notifier in the events thread would keep sending out the activated() signal, but no events would actually be read until the main thread starts to run again. That causes the event thread to keep queueing new events, and so allocating memory, potentially forever. This patch fixes the issue in maybe a bit radical way, that is by removing the event thread. The socket notifier now runs in the main thread so it will block if the events are not being read. Nowadays there is no real reason to keep the event thread around, as every thread that needs to receive wayland events can dispatch them on its own, we don't need a central dispatcher thread anymore. Change-Id: Ib7885e4b038b82719d78d193f465618a72cbe6af Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-151-10/+6
|\| | | | | | | | | | | | | Conflicts: src/client/qwaylandintegration.cpp Change-Id: I29120f06d33c2d383a41cf35ca4a59f5d8548ad7
| * Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-0/+2
| |\ | | | | | | | | | Change-Id: Ib3c5bec85a09d92e37a3af8e1c749a80cb40c056
| | * Fix a segfault when the wayland connection is brokenGiulio Camuffo2015-09-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When calling ::exit() the socket notifier in the events thread may still fire before the process actually exits, using objects that are being destroyed and resulting in a segfault. Stop the events thread before calling ::exit(). Change-Id: I187762da2a7efa83db1e62b0e28dfab89f478c7d Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
| * | Merge remote-tracking branch 'origin/5.5' into 5.6v5.6.0-alpha1Liang Qi2015-08-281-10/+4
| |\| | | | | | | | | | | | | | | | | | | Conflicts: src/client/qwaylandwindow.cpp Change-Id: I80ead87f3e1f36299b1bf9cc9c7db6cd48c0e86f
| | * Fix possible race condition leading to a dead lockGiulio Camuffo2015-07-061-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is a bit dangerous to call wl_display_dispatch() in the event thread, since it may race with the dispatch called e.g. in QWaylandDisplay's blockingReadEvents() and lead to a dead lock. Instead, use wl_display_prepare_read() and wl_display_read_events() in the event thread, which doesn't block, and only dispatch in QWaylandDisplay. As a result we don't need the additional wayland queue anymore, so remove it. Change-Id: I9fbbe5d2f38d06773beb7847df1a0212cca92c37 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>