summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qscreen.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Add usage hint for obtaining QScreen instances from QGuiApplicationDheerendra Purohit4 days1-0/+6
| | | | | | | Pick-to: 6.10 6.9 Fixes: QTBUG-117414 Change-Id: Ic4135af4ef21161b2f12f397c1c5c5a0a471bf7b Reviewed-by: Tor Arne Vestbø <[email protected]>
* Discourage use of QScreen::devicePixelRatio()Morten Sørvig2025-04-241-2/+3
| | | | | | | | | | | | | Remove line about "common values" which is now not 100% accurate and uses the outdated "retina" term. Add note which encourages using QWindow::devicePixelRatio() to get the correct DPR value in all cases. Task-number: QTBUG-135612 Change-Id: I78e049cb2f0661b62bc3e2520a4b3cbf1fde241d Reviewed-by: David Edmundson <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]>
* QScreen: Add a note to use QWindow::devicePixelRatio if possibleDavid Redondo2025-02-051-0/+4
| | | | | | | | | Like QGuiApplication does as well. Also add a note that screen and window DPR can be different. Pick-to: 6.9 6.8 Change-Id: I1a24cf7f11e945187da9dce4421039350e811997 Reviewed-by: Tor Arne Vestbø <[email protected]>
* QScreen: Apply high-DPI scale to availableGeometry size, not positionThomas Sondergaard2024-09-261-1/+2
| | | | | | | | | | Treat geometry and availableGeometry in the same way so the position is in native coordinates and only the size is scaled. Task-number: QTBUG-128660 Change-Id: If1355014fd6dd1a204cab7177d7941c980dda0ad Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Morten Johan Sørvig <[email protected]>
* Mention QChronoTimer in API docsAhmad Samir2024-03-031-2/+2
| | | | | Change-Id: Iaf9fb31994f1580b2051dbd0b1b8eef2a218aa39 Reviewed-by: Thiago Macieira <[email protected]>
* Make some QScreen native interfaces publicDavid Redondo2023-12-081-0/+15
| | | | | | | | | | [ChangeLog][QtGui][QScreen] The QAndroidScreen, QWaylandScreen and QWaylandWindow native interfaces are now available on QScreen to provide a handle to the underlying platform screen. Task-number: QTBUG-113795 Change-Id: I83d70046678dfb79ee08544ddfc1820f3ff2d118 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Introduce a configure feature for WaylandDavid Redondo2023-12-071-1/+1
| | | | | | | | Using the presence of the wayland-client lib as a condition. Fixes: QTBUG-117386 Change-Id: If4336965ea06e3f4b06e9af661efdec38ba46136 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Only consider QScreen virtual siblings that have been addedTor Arne Vestbø2023-05-311-2/+5
| | | | | | | | | | | | | | | | | If a platform builds up a list of QPlatformScreens, and then adds them incrementally, while at the same time implementing virtualSiblings in QPlatformScreen to return the full list of screens, the virtual sibling QScreens will contain nullptrs for each non-added screen. It could be argued that this is the fault of the platform plugin, since it's reporting a virtual sibling that it hasn't added yet, but we can easily work around it in QScreen as well. Fixes: QTBUG-113977 Pick-to: 6.5 Change-Id: I4b9472646a5cc10b6fd35c606e3ae15941da1587 Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Morten Johan Sørvig <[email protected]>
* Align QWindowSystemInterface::handleScreenAdded() and handleScreenRemoved()Tor Arne Vestbø2023-03-281-36/+4
| | | | | | | | | | | Having the logic of handleScreenRemoved() inside the QScreen destructor was making it harder to follow the flow of adding and removing screens. As screen management should always go though the QWSI functions, we keep the logic there. Change-Id: I456e77eb8fc10feae7b1f9994b25c9534ea4e430 Reviewed-by: Volker Hilsheimer <[email protected]>
* Remove indirection via QScreenPrivate::setPlatformScreen()Tor Arne Vestbø2023-03-281-16/+10
| | | | | | | | | | The QHighDpiScaling code should call the explicit updateGeometry function instead to re-evaluate the platform screen geometry in light of the change to the scale factor. Change-Id: Idac975c117c431356f4fb812c245348c4722a8b5 Reviewed-by: Morten Johan Sørvig <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* Update the documentation of QScreen::name()Yuhang Zhao2023-01-041-0/+4
| | | | | | | Task-number: QTBUG-109569 Pick-to: 6.5 6.4 Change-Id: I24ed586e9094e7cd2277c6289ffbd4210dd6e430 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Add possibility to retrieve displayId for AndroidPiotr Mikolajczyk2022-12-091-0/+4
| | | | | | | | | | When handling multiple screens in Android system it is needed to have the information about the display's Id. This patch provides this possibility. Task-number: QTBUG-105325 Change-Id: Id91aeaa59b17d5a098b672e220a5182b97320703 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Add QNativeInterface::Private::QWaylandScreenDavid Redondo2022-10-271-0/+4
| | | | | Change-Id: Ib18c95fa64ab9176195f591e8ffd45177be510b9 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* Share logic for QScreen property update emitting in helper classTor Arne Vestbø2022-09-161-27/+54
| | | | | | | | | | | | | | With high-DPI scaling in place QScreen properties like the geometry can be affected both by screen resolution changes, as well as logical DPI changes. We want to ensure similar behavior in both cases when it comes to which change-signals we emit, so centralizing this code makes sense. As the update of the cached primary orientation is trivial we do it unconditionally. Change-Id: I712005075a4b758180906fb88b2ac187b3dbe1ff Reviewed-by: Volker Hilsheimer <[email protected]>
* Rename QScreenPrivate::updateHighDpi()Morten Johan Sørvig2022-09-081-3/+3
| | | | | | | | The function updates the cached QScreen geometry; rename it to updateGeometry(). Change-Id: I56077807baa6c515769017dbb842eed10b1d1357 Reviewed-by: Morten Johan Sørvig <[email protected]>
* Move QPlatformScreen::deviceIndependentGeometry() logic to QScreenTor Arne Vestbø2022-09-081-2/+4
| | | | | | | | | | Having the logic in QPlatformScreen was inconsistent with how the high-DPI scaling logic sits on top of the platform layer, and also made the implementation of QScreenPrivate::updateHighDpi() a bit inconsistent in how the geometry vs available geometry was resolved. Change-Id: I683ab34dfc8579e2c887cb8fe3059c9c9fdb71a7 Reviewed-by: Volker Hilsheimer <[email protected]>
* De-inline QScreenPrivate::updateHighDpi()Tor Arne Vestbø2022-09-071-0/+5
| | | | | | | | Make it easier to reason about the flow of high-DPI scaling when the implementation is not "hidden" away in a private header. Change-Id: I6350798c43ead213323f8e01d9761f2d185c6b00 Reviewed-by: Morten Johan Sørvig <[email protected]>
* Revert "Drop call to setPlatformScreen in QHighDpiScaling::setScreenFactor"Thiago Macieira2022-07-221-20/+20
| | | | | | | | | | | | This reverts commit 7b2ae3faab15913e006ece25d785e6a8453dd27a. Reason for revert: this breaks multi-monitor XCB with HighDPI. Fixes: QTBUG-105079 Pick-to: 6.4 Change-Id: I386c9480c33d1f67b3478332c8e03fe3eeeeee39 Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Fushan Wen <[email protected]>
* Enable access to QWindowsScreen from QScreenPiotr Srebrny2022-07-061-0/+4
| | | | | | | | | This patch adds access to the QWindowsScreen interface from QScreen with the aim to provide the native handle of QScreen. This handle will be used in QtMultmedia to find DXGI interfaces related to that screen. Change-Id: I93f066b3f0d4d70331aeedab36bb0db111a34556 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Drop call to setPlatformScreen in QHighDpiScaling::setScreenFactorFushan Wen2022-06-291-20/+20
| | | | | | | | | | | | | | | | | Drop call to setPlatformScreen since the only affected variables are logicalDpi and geometry. Replace setPlatformScreen with updateLogicalDpi which handles global scale factor changes in QScreen. Call updateGeometriesWithSignals() to check if there are any changes in geometry or availableGeometry, since the geometry or availableGeometry can also change when setting a scale factor. Move setPlatformScreen to QScreen ctor as the function is not used elsewhere. Pick-to: 6.4 6.3 6.2 Change-Id: I7acf40bf0643e89a1d9177674d66dc503829f98f Reviewed-by: Tor Arne Vestbø <[email protected]>
* Print QScreen geometry debug state using the underlying typesTor Arne Vestbø2022-06-131-11/+2
| | | | | | | | A QRect is unambiguous, and easier to parse than a custom rect format. Change-Id: If8c197a5e522744b9629d5d89536df5c0da7308c Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Alexandru Croitor <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | 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]>
* QtGui: includemocsMarc Mutz2022-04-291-0/+2
| | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102886 Change-Id: I1945741794c25679a9d94c0d68c8642e2c823502 Reviewed-by: Mårten Nordheim <[email protected]>
* doc: Warn against using the screen's refresh rate for driving animationsTor Arne Vestbø2022-04-071-0/+5
| | | | | | Pick-to: 6.2 6.3 Change-Id: Id26aae76792a4109b2ea6cca3db69ab505495d65 Reviewed-by: Laszlo Agocs <[email protected]>
* Use member function instead of template function to resolve native interfaceTor Arne Vestbø2021-07-171-4/+2
| | | | | | | | | | | | | | The use of a freestanding function is not needed now that the name doesn't alias the nativeInterface accessor function, and was just adding complexity to the machinery. People not familiar with the code will have an easier time following the flow through the helper member function, and we no longer need to declare our own export macros. Pick-to: 6.2 Change-Id: I17530b7e89939cfc19ab8ffaa076b7129ae02dcf Reviewed-by: Fabian Kosmale <[email protected]>
* Expose the native interfaces of QScreen/QWindowFriedemann Kleint2021-06-071-0/+25
| | | | | | | | Add the macros. Task-number: QTBUG-84220 Change-Id: Ica23b9e4d5c1ca072acb5356e6f2be28d5199fa6 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Document physicalDotsPerInch high-DPI behaviorMorten Johan Sørvig2020-11-121-0/+3
| | | | | | | | | The values are in device-independent dots, which may be unexpected. Task-number: QTBUG-62649 Change-Id: I85d0e3dd6bd428dd351ebf22281b1f4d9a1b2dc4 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Document physicalDotsPerInch high-DPI behaviorMorten Johan Sørvig2020-11-121-0/+9
| | | | | | | | | Add note to the member function documentation, in addition to the class documentation. Task-number: QTBUG-62649 Change-Id: I5cce6c06b58e70ef6c051d63c2901b219fa6d6b9 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Fix QScreen orientation not being updated when setting a platform screenFriedemann Kleint2020-10-301-1/+1
| | | | | | | | | | | | ScreenPrivate::updatePrimaryOrientation() depends on the geometry being set which is calculated by updateHighDpi(). Move the call up. Amends 370289bef68d8505b66cb27150a3f596e23c5ed3. Task-number: QTBUG-76902 Change-Id: I8188e04ad4a2ef7d414a2b78ecb3dd6c64528fa6 Reviewed-by: Tor Arne Vestbø <[email protected]> (cherry picked from commit d10c34b0cc896c711fce8ae5629e3cc3d74b6452)
* Emit QScreen::geometryChanged when the logical DPI changesFriedemann Kleint2020-09-301-0/+6
| | | | | | | | | | | | | | | | | | | | Add the missing call to QScreenPrivate::emitGeometryChangeSignals() along with an emission of physicalDotsPerInchChanged() since that is calculated from geometry and physical size. Rearrange the code in QGuiApplicationPrivate::processScreenGeometryChange() to prevent duplicate emissions of geometryChanged(), physicalDotsPerInchChanged() which this change would introduce. Amends 5290027e3bab75f14fc0a2b7c206594d9cb91e76. Pick-to: 5.15 Task-number: QTBUG-76902 Task-number: QTBUG-79248 Fixes: QTBUG-86604 Change-Id: I3dc2ec5ccd9c6413e92f9246242f323e8afc5e57 Reviewed-by: David Edmundson <[email protected]>
* Doc: Fix documentation warnings for Qt GUITopi Reinio2020-08-281-1/+1
| | | | | | | | | | | | * Drop deprecation warnings for now-dropped items * Use the 'qt6' define and a new \nothing doc macro to conditionally document items on Qt 6 * Add a custom module header for docs that pulls in also Vulkan headers * Add \internal command for internal classes/functions * Move QtGUI-related code snippets from widgets to gui docs Change-Id: Ieb386b96631a49568d09059906d307c45c01d93a Reviewed-by: Paul Wicking <[email protected]>
* Let QScreen::grabWindow's winId parameter default to 0 and add testVolker Hilsheimer2020-07-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The platform plugins are implemented to grab the entire screen if no window ID is provided. They do not grab the entire virtual screen, just the screen the method is called on. On macOS, the implementation ignored the window parameter, and always grabbed the entire virtual screen. This change fixes the cocoa implementation. The test passes in local tests (with two displays with different dpr). Since grabbing a screen returns an image with managed colors, we need to convert it to sRGB color spec first, otherwise displaying a grabbed image will produce different results. This will need to be changed once Qt supports a fully color managed flow. The test does not cover the case where a window spans multiple displays, since this is generally not supported at least on macOS. The code that exists in QCocoaScreen to handle that case is untested, but with the exception of the optimization it is also unchanged. Done-with: Morten Sørvig <[email protected]> Change-Id: I8ac1233e56d559230ff9e10111abfb6227431e8c Fixes: QTBUG-84876 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Remove QScreen::orientationUpdateMaskShawn Rutledge2020-05-071-47/+9
| | | | | | | | | | | | | | | | | | It simplifies the API and reduces surprise to have rotation working by default. On Android, the manifest specifies which orientations the application has been designed to support; on iOS, it is controlled via the UISupportedInterfaceOrientations property list key. In addition, QWindow::contentOrientation() is another way to give a hint to the window manager, or on iOS to directly control whether the window's rotation is locked or not. Task-number: QTBUG-35427 Task-number: QTBUG-38576 Task-number: QTBUG-44569 Task-number: QTBUG-51012 Task-number: QTBUG-83055 Change-Id: Ieed818497f686399db23813269af322bfdd237af Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Emit QScreen::(availableG|g)eometryChanged() on logical DPI changeFriedemann Kleint2020-05-051-3/+21
| | | | | | | | | | | | | | | | When a change in logical DPI occurs due to the user changing the scaling factor, the screen size in device independent pixels may change due to High DPI choosing a different scale factor. Factor out the commonly used code into QScreenPrivate methods and use them from QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(). Pick-to: 5.15 Task-number: QTBUG-76902 Task-number: QTBUG-79248 Change-Id: I241a0f52d8236a65084d501fb4d8f9faeea89c0f Reviewed-by: Morten Johan Sørvig <[email protected]>
* QScreen::virtualSiblingAt(): pass QPoint by valueShawn Rutledge2020-02-261-1/+1
| | | | | | | It's too small to bother with passing by reference. Change-Id: I793678f5ae352b7f24d2c7e758dc75827c2190df Reviewed-by: Volker Hilsheimer <[email protected]>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-041-0/+2
|\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/widgets/widgets/imageviewer/imageviewer.cpp src/corelib/text/qchar.cpp src/corelib/time/qdatetime.cpp Change-Id: I9762f5c4ff650799219729d6aee79ac07ce9024a
| * Doc: Add see also link to QScreen::handle()Paul Wicking2020-01-301-0/+2
| | | | | | | | | | | | | | | | | | As the method returns a pointer to a private type (QPA), add see also with link to QPA docs. Fixes: QTBUG-76978 Change-Id: If59670ca0a9a47b42b6441baa23525eb20f92979 Reviewed-by: Tor Arne Vestbø <[email protected]>
* | Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* | Add QScreen::virtualSiblingAt() and use it in QMenubarPrivate::popupActionShawn Rutledge2019-09-191-0/+19
|/ | | | | | | | | | | | | | | | QGuiApplication::screenAt() is documented "If the point maps to more than one set of virtual siblings, the first match is returned." But in many cases it's possible to start from a known screen and consider only its siblings, as when deciding where to open a QMenu from a QMenuBar: the QMenuBar is already shown on some screen(s), so the QMenu must be shown on a sibling from that set. This function should be useful in other such cases too, hence it might as well be public API. Task-number: QTBUG-76162 Change-Id: I83c74b40eb53f56fb285a6074a3dc2c0ea9c570b Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]>
* Move QT_FONT_DPI to cross-platform codeMorten Johan Sørvig2019-08-231-2/+5
| | | | | | | | | | | | | | | | | | This makes it possible to test the effects of setting Qt::AA_HighDpiScaling/QT_AUTO_SCREEN_SCALE_FACTOR, with different DPI values on all platforms. This also makes it possible to access the actual DPI values reported by the OS/WS via the QPlatformScreen API. A drawback is that there is no single place to check the environment variable; currently done in three places. This may be further simplified later on. Done-with: Friedemann Kleint <[email protected]> Task-number: QTBUG-53022 Change-Id: Idd6463219d3ae58fe0ab72c17686cce2eb9dbadd Reviewed-by: Friedemann Kleint <[email protected]>
* Compute logical DPI on a per-screen basisMorten Johan Sørvig2019-08-231-3/+3
| | | | | | | | | | | | | | | The logical DPI reported to applications is the platform screen logical DPI divided by the platform screen scale factor. Use the screen in question when calculating the DPI instead of the values from the main screen. QHighDpiScaling::logicalDpi now takes a QScreen pointer. Done-with: Friedemann Kleint <[email protected]> Task-number: QTBUG-53022 Change-Id: I0f62b5878c37e3488e9a8cc48aef183ff822d0c4 Reviewed-by: Friedemann Kleint <[email protected]>
* Prefix textstream operators with Qt::Lars Knoll2019-05-021-1/+1
| | | | | | | As the non prefixed variants are deprecated Change-Id: I2ba09d71b9cea5203b54297a3f2332e6d44fedcf Reviewed-by: Allan Sandfeld Jensen <[email protected]>
* Revert "Revert "Remove deprecated screen maintenance functions in ↵Liang Qi2019-04-011-7/+13
| | | | | | | | | | | | QPlatformIntegration"" This reverts commit 300940a6c9eb0f74cefda7d76a5d19f56ec50253. The fixes for leaf modules landed already. Task-number: QTBUG-74816 Change-Id: I1c7f0705c20d030419ceedca485106af73946b3c Reviewed-by: Jesus Fernandez <[email protected]>
* Revert "Remove deprecated screen maintenance functions in QPlatformIntegration"Liang Qi2019-03-291-13/+7
| | | | | | | | | | | This reverts commit 7a64ffb7738dc975b5008800901c8cd8ab238a0f. This change landed in 5.13 too early, so there is no baseline with both APIs in dev. This will be reverted later when the fixes for leaf modules landed. Task-number: QTBUG-74816 Change-Id: Ie5ee41fbf6be53b8fcb4289ac1ec3974e5bf6e42 Reviewed-by: Jesus Fernandez <[email protected]>
* Remove deprecated screen maintenance functions in QPlatformIntegrationTor Arne Vestbø2019-03-221-7/+13
| | | | | | | | | The logic for removing QScreens from QGuiApplicationPrivate has been moved into the QScreen destructor, similar to QWindow. Change-Id: I18ad57d8dcf9f765c47be7c082bf075af3ebe69c Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* Document QScreen::grabWindow high-DPI behaviorMorten Johan Sørvig2018-11-121-0/+5
| | | | | Change-Id: Ib32510ff30e907365e64921fda14e686a495c77c Reviewed-by: Tor Arne Vestbø <[email protected]>
* Make grabWindow return pixmap with correct dprMorten Johan Sørvig2018-11-111-1/+1
| | | | | | | | | | | The devicePixelRatio on the returned pixmap should be the product of the Qt and platform scale factors. This handles the corner case of setting QT_SCALE_FACTOR on macOS with a high-dpi display. Change-Id: I3600165d47c03c4e043bcc5e375932cc3fc0c544 Reviewed-by: Tor Arne Vestbø <[email protected]>
* xcb: don't rely on _NET_WORKAREA for available geometry on multi-head systemsGatis Paeglis2017-08-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On X11, QScreen::availableGeometry() is broken with multi-head systems, and there doesn't seem to be a real fix for this due to limitation in the protocol and therefore support in WMs (more details in the patch). In Gnome this issue is more visible because on this DE the _NET_WORKAREA rectangle represents the intersection of the available geometries on all monitors. This results in a big area of "dead space" on the secondary screen, when primary screen is positioned lower in the virtual space. If menu is opened by clicking in this dead space, the menu is awfully misplaced (qmenu uses availableGeometry() to calculate the position of menu). On Ubuntu with Unity (same is true for KDE Neon+Kwin and LUbuntu+Openbox), _NET_WORKAREA returns a bounding rectangle containing all monitors. Which does not cause the menu misplacement as "dead space" is outside clickable area. But this does not mean that the QScreen::availableGeometry() reported values are correct. With the same setup as described above, QScreen::availableGeometry() thinks that we have a tool panel on the right screen, when in reality it is on the left screen. AwesomeWM for example does not set _NET_WORKAREA at all, which means QScreen::availableGeometry() == QScreen::geometry(). I am not aware that it would cause any issues for popup/menu window positioning in Qt (Qt positions these windows manually by bypassing WM (via Qt::BypassWindowManagerHint) and using availableGeometry for calculations. With this patch, we would take the same code path as if _NET_WORKAREA was not set (where we know that_NET_WORKAREA is cleary wrong). The solution here is to recognize _NET_WORKAREA as true available geometry only in specific cases (cases where the meaning is cleary defined by the specification) and adjust the documentation accordingly. Not knowing the true available geometry on X11 is mitigated by WMs. Window manager can position windows as it wants. WMs are smart enough not to place windows on top of reserved areas at edges (even if user has explicitly requested this via setGeometry based on inaccurate information from availableGeometry()). [ChangeLog][Platform Specific Changes][Linux] The _NET_WORKAREA atom is used for calculating QScreen::availableGeometry() only on systems with one monitor. In all other cases QScreen::availableGeometry() is equal to QScreen::geometry(). To restore the legacy behavior with untrustworthy values in QScreen::availableGeometry() set QT_RELY_ON_NET_WORKAREA_ATOM=1 environment variable. Task-number: QTBUG-60513 Task-number: QTBUG-29278 Task-number: QTBUG-43768 Task-number: QTBUG-18380 Change-Id: I7e0f62f81d1444991b8a6c007c2527d8f96088c2 Reviewed-by: Uli Schlachter <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* Add screen product informationPier Luigi Fiorini2017-01-161-0/+36
| | | | | | | | | | | | | | | | | | | | | Add new methods to QPlatformScreen that platform plugins can reimplement in order to provide more information such as vendor, model and serial number. Expose that information as QScreen properties. A use-case for this feature is a Wayland compositor that maps screens to Wayland outputs hence it needs to replicate the information. This information can also be added to the diagnostic output of qtdiag. [ChangeLog][QtGui][QScreen] Add manufacturer, model and serialNumber properties. Change-Id: Ia6945f41023340602ef9d618e0d833a0c1825ab3 Reviewed-by: Johan Helsing <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Laszlo Agocs <[email protected]>