summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbscreen.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Avoid return QImage::Format_Invalid from QPlatformScreen::format()Allan Sandfeld Jensen2020-02-141-1/+3
| | | | | | | | | This can be used to set the pixmap format, and needs to be defined to something sane even if there is no primary screen. Task-number: QTBUG-81671 Change-Id: Ic0d41cec31ac71309123aa8bb8b840fa4a4122bb Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Revert "Do not read Xft.dpi on platforms that shouldn't be using Xft settings"David Edmundson2020-01-201-11/+0
| | | | | | | | | | | | | | | | | | | | | | This reverts commit c7fec68e1936576070d0fbac6cf40b818366d298. This commit introduces a behavioural change within 5.14. It's designed to special case plasma with a fix, but in practice it will cause us more problems. It will break: - font size on plasmashell and kwin on xcb which do not use Qt scaling - xwayland on projectors/headless tests The original bug of double scaling that this was trying to fix is fixed by b31852c4caa36cc564e25adbdacfa534e1dfe7c0 which is in 5.14.1 which works in combination with the environment variables we set in plasma so this is not needed. Fixes: QTBUG-81532 Change-Id: I2f1b8ae4aecf7b80be4dbee812e6b4a64244fb1f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Parse Xft.dpi with fractionAllan Sandfeld Jensen2019-12-171-2/+12
| | | | | | | | | Some versions of GNOME 3 would set Xft.dpi with fraction though that is technically not valid. Change-Id: Ib1027283cc78fd5d9869cd337864a92e28cd7e88 Fixes: QTBUG-64738 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Do not read Xft.dpi on platforms that shouldn't be using Xft settingsAllan Sandfeld Jensen2019-12-051-0/+11
| | | | | | | | | | We only read this for desktop environments that have traditionally used these to set settings for other toolkits. Fixes: QTBUG-80323 Change-Id: Ifa8c2682301e69c2770d3734115080a0e6b4e85c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-10-101-1/+1
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbscreen.h src/src.pro Change-Id: I4e1981e69a1ddcbe4078ec6ab2a64b0da6a445de
| * Xcb: fix rounding error in reporting screen refresh rateKirill Burtsev2019-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | Screen refresh rate might not be just integer but with decimal part like, for example, 59.97 Hz. Fix calculation from raw xcb data and its store type as it is qreal already for QScreen::refreshRate API. Task-number: QTBUG-73911 Change-Id: Ia0494e953176c2854f0ed42c4498a29cfef16106 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-06-251-5/+15
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qstorageinfo_unix.cpp src/network/ssl/qsslsocket_openssl.cpp Change-Id: Ibc9ce799bef62d60d616beaa9fbde8ebeadfbc20
* | | Move QT_FONT_DPI to cross-platform codeMorten Johan Sørvig2019-08-231-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <Friedemann.Kleint@qt.io> Task-number: QTBUG-53022 Change-Id: Idd6463219d3ae58fe0ab72c17686cce2eb9dbadd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Update Dpi and scale factor computationMorten Johan Sørvig2019-08-231-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove pixelScale() in favor of logicalBaseDpi(). Compute scale factor based on logical DPI and logical base DPI, or optionally based on the physical DPI. Add policies for running the scale factor and adjusting the logical DPI reported to the application. The policies are set via environment variables: QT_SCALE_FACTOR_ROUNDING_POLICY=Round|Ceil|Floor|RoundPreferFloor|PassThrough QT_DPI_ADJUSTMENT_POLICY=AdjustDpi|DontAdjustDpi|AdjustUpOnly QT_USE_PHYSICAL_DPI=0|1 Done-with: Friedemann Kleint <Friedemann.Kleint@qt.io> Task-number: QTBUG-53022 Change-Id: I4846f223186df665eb0a9c827eaef0a96d1f458f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-06-251-5/+15
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/gui/painting/qdrawhelper.cpp src/gui/text/qdistancefield.cpp src/gui/text/qdistancefield_p.h src/network/ssl/qsslsocket_openssl.cpp src/plugins/platforms/android/qandroidinputcontext.cpp src/widgets/styles/qstylesheetstyle.cpp Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: Ia7daad21f077ea889898f17734ec46303e71fe6b
| * | Use Xft DPI as basis for HiDPI scalingAllan Sandfeld Jensen2019-06-191-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GNOME indicates DPI modes by setting high DPI values in Xft.DPI, so we need to use the forced DPI setting instead of the real DPI, as basis for QPA pixel density. Change-Id: I6f25636383b16b89a3d5fe4c904afd079fe001aa Fixes: QTBUG-74836 Task-number: QTBUG-65424 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Prefix textstream operators with Qt::Lars Knoll2019-05-021-3/+3
| |/ |/| | | | | | | | | | | As the non prefixed variants are deprecated Change-Id: I2ba09d71b9cea5203b54297a3f2332e6d44fedcf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | XCB plugin: replace deprecated QList::swap()Christian Ehrlicher2018-12-171-1/+1
|/ | | | | | | QList::swap(int, int) was deprecated. Replace it with swapItemsAt() Change-Id: I077c5b7222e40b928ee9035b8cbf4ebcc91aa15e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12.0Liang Qi2018-11-051-7/+0
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoaglcontext.mm src/plugins/platforms/xcb/qxcbscreen.h Change-Id: If9b4c67288396ff7346088ce591c7a3588b51979
| * xcb: Don't get initial screen rotationBłażej Szczygieł2018-10-291-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | "xcb_randr_get_screen_info" can be slow and in some configurations can cause short mouse cursor freezes (which will happen on Qt application startup). Initial screen rotation was used only to not handle possible redundant screen change event. Fixes: QTBUG-70760 Change-Id: I9f01325a045d2c82c4dd2fce91a18a34e54a4bcd Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | xcb: use 128 as a reference DPI for small screensMathieu Velten2018-10-171-1/+5
| | | | | | | | | | | | | | | | | | | | | | This is a better version of 23b139038a1dc9a769a358ab112453abcdd39290 which was reverted. Task-number: QTBUG-68620 Task-number: QTBUG-53022 Task-number: QTBUG-57211 Change-Id: I0b37fc261945c542bbfb30cecfe4b0a97c655e3c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | xcb: avoid unnecessary InternAtom requestsGatis Paeglis2018-08-171-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | QXcbConnection::internAtom() creates the atom if it does not exist. The lifetime of an atom is not tied to the interning client. Atoms remain defined until server reset (lost connection, restart). So create the atom once via QXcbConnection::initializeAllAtoms(), and later fetch the atom value from local array, instead of repeating InternAtom requests. Change-Id: I3cae21895febad6e5daf8c32e72612202baaad64 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-171-90/+96
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbintegration.cpp Conflicts git missed: src/plugins/platforms/qnx/qqnxglcontext.cpp Change-Id: I0582cdc9e66e43efe79038b9c43d4f9572ac88fc
| * xcb: Move handling of RRScreenChangeNotify from QXcbScreen to QXcbVirtualDesktopAlexander Volkov2018-07-091-90/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This event relates to xcb_screen_t (virtual desktop), not to RandR crtcs, so move its processing to QXcbVirtualDesktop. Currently it triggers redundant calling of RRGetCrtcInfo (from QXcbScreen::updateGeometry()). It's called anyway after receiving RRCrtcChangeNotify, so just drop it. There is also a mess between the rotation of Screen and crtcs, obviously they should be processed separately. Task-number: QTBUG-65598 Change-Id: I124752ccbde03adb15e9ba592dd8b2d8d7fc35f4 Reviewed-by: Daniel Vrátil <dvratil@kde.org> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-07-021-6/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_dragging.mm src/plugins/platforms/ios/qiosinputcontext.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/tools/androiddeployqt/main.cpp Was moved from qttools into qtbase in 5.11. So re-apply 32398e4d here. tests/auto/corelib/global/qlogging/test/test.pro tests/auto/corelib/global/qlogging/tst_qlogging.cpp tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp tests/auto/corelib/thread/qthreadstorage/test/test.pro tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp tests/auto/widgets/kernel/qapplication/test/test.pro Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Done-with: Mårten Nordheim <marten.nordheim@qt.io> Done-with: Oliver Wolff <oliver.wolff@qt.io> Change-Id: Id970486c5315a1718c540f00deb2633533e8fc7b
| * Revert "xcb: round down the scale factor for values < 0.8"Mitch Curtis2018-06-091-6/+1
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 23b139038a1dc9a769a358ab112453abcdd39290. The commit causes a regression on Ubuntu where the DPI setting of the display is ignored. Task-number: QTBUG-68620 Change-Id: Id176f8cda0daef1755abb3aa9382476cc4ed7d71 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | xcb: move XSync extensions initialization to QXcbConnectionGatis Paeglis2018-06-281-6/+0
|/ | | | | | | | ... where we do initialization of all other extensions. Having this code in QXcbVirtualDesktop does not make sense. Change-Id: I3bf3034b4a24e06aa5792e7d49133f46c5728b07 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: round down the scale factor for values < 0.8Mathieu Velten2018-05-021-1/+6
| | | | | | | | | | This solves huge UI on some (most ?) HD 13 inches that have a calculated scale factor around 1.75. Task-number: QTBUG-53022 QTBUG-57211 Change-Id: I6cc22d3e47d38cb1d5a0daf5646a936256664e48 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Fix QXcbScreen::format() when rgb-swap is neededAllan Sandfeld Jensen2018-03-011-1/+3
| | | | | | | | | QXcbScreen::format() was producing console warning and returning invalid format if rgb-swap was necessary. Let it match possibly reversed formats since the backing-store will swizzle it anyway. Change-Id: I6a53cb8ceda029e9d708d25ad635832f1163ffe7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* XCB: Implement native window dump for diaglibFriedemann Kleint2018-01-241-10/+2
| | | | | | | | | Extract a helper function to determine the window title from QXcbConnection and add an invokable function to the native interface that dumps the window tree similar to existing functionality on Windows. Change-Id: I5544d69ea2b801eb16d3b5b8d64021b3e567b0d8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLars Knoll2018-01-021-12/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
| * xcb: verify if xrandr present before using xcb_randr* APIsGatis Paeglis2017-12-071-12/+23
| | | | | | | | | | | | | | | | | | Not doing so might break the connection. We have had similar issues before, e.g. QTBUG-45312. Change-Id: I95f15d24773fc92b052578bd72d1ba264d0a5f63 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Uli Schlachter <psychon@znc.in>
* | xcb: Unify visual to QImage::Format logicAllan Sandfeld Jensen2017-10-071-1/+3
| | | | | | | | | | | | | | | | Make a common function to replace the two existing ones that convert from XCB visuals to QImage format. Change-Id: I2ae08ef4df96df950910a45e71c9d9cd98375b2e Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-1/+1
|/ | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* xcb: cleanup leftovers in QXcbScreen::updateGeometryGatis Paeglis2017-08-081-6/+5
| | | | | | | | | | That code was added by ae5f2a66720a4bb22c120bd7d1564652cac00367 and later incompletely removed by c173a5071906867de9da26ee8f49224b23c2ef1d. This patch amends c173a5071906867de9da26ee8f49224b23c2ef1d. Change-Id: Ibfd39aaf9b49424fc54d878dc588454eb841ed97 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Change EDID parsing qCWarnings to qCDebugsLaszlo Agocs2017-08-031-1/+1
| | | | | | | | | | | Avoid polluting the output by default. Unfortunately there are various systems (modern Fedora with XWayland, VMWare) where parsing will fail for some not yet known reason. Showing warnings on each and every Qt application startup is not desirable, especially since not having the EDID data available is far from being critical. Change-Id: Ibaca7db4d897e705819f7c359f8de41b9be862a6 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: don't rely on _NET_WORKAREA for available geometry on multi-head systemsGatis Paeglis2017-08-021-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <psychon@znc.in> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean-up in QXcbScreen::getOutputProperty()Gatis Paeglis2017-06-281-6/+3
| | | | | | | | | Use the Q_XCB_REPLY() macro and let its unique_ptr<> take care of free()ing the reply. Change-Id: I32eb9c56ea0ba5632bf6ab39c77567d10f442995 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Fix sporadic crash in QXcbScreen::getOutputProperty()Edward Welbourne2017-06-281-1/+1
| | | | | | | | | | | | | Although [0] claims "This request does never generate any errors", it seems I sometimes get back a NULL pointer from xcb_randr_get_output_property_reply(), leading to a segfault (in the qdatetimeedit auto-test). So check reply isn't NULL before dereferencing it. [0] https://www.systutorials.com/docs/linux/man/3-xcb_randr_get_output_property_reply/ Change-Id: Iadae835bb3017bf9bb40f180b75b0c391384f99b Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: Decode EDID blobPier Luigi Fiorini2017-05-041-0/+62
| | | | | | | | | | | | Retrieve and parse EDID blob. Return screen product information from EDID. [ChangeLog][Platform Specific Changes][Linux/XCB] Add screen product information from EDID. Change-Id: Ic54429cdc90c41342c37511bcaebce95c175f517 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: remove code and macros related to Q_XCB_DEBUGGatis Paeglis2017-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ... early spring-cleaning, leaving one block of virtual root debug code that was inappropriately conditioned on Q_XCB_DEBUG; it now gets its own define. Removed Q_XCB_CALL: 1) I don't know anyone who actually uses it. 2) Enabling this feature (via Q_XCB_DEBUG) fails to build (and has been like that for about 1 year). 3) There are better ways to debug X11 client message exchange (see xtrace for example). 4) Using Q_XCB_CALL is a very fragile approach. Grep for example for xcb_change_property and you will see that half of the calls are not wrapped with the Q_XCB_CALL macro. This patch also removes the Q_XCB_NOOP macro. It's unclear what its purpose was. There was a TODO comment in qxcbeglcontext.h suggesting removal of this macro as well. Its evaluation of its parameter, even without Q_XCB_DEBUG, had no side-effects, so its removal should be harmless. Change-Id: I9fa48af454061d8b38f69f308131647cd18f85f4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: Optimize QXcb{Screen,VirtualDesktop} for multi-monitor setupAlexander Volkov2017-03-021-220/+231
| | | | | | | | | | Move non-monitor-specific members of QXcbScreen to QXcbVirtualDesktop: they relate to an X screen rather than to a monitor. It allows to save some memory and X server callings that were previously made for each monitor. Change-Id: I079cdec5f27ca93a2aade00c3040936a0e50b494 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: Wrap xcb callings in macrosAlexander Volkov2017-02-231-81/+38
| | | | | | | | | | | | | | | | | ... to improve readability and reliability. This change introduces macros Q_XCB_REPLY and Q_XCB_REPLY_UNCHECKED that allow to replace couples of xcb cookie/reply callings by a single "calling" of a macro. The macros wrap the reply in std::unique_ptr thus preventing the need to free it manually. The following C++11 features are used: - variadic macros - std::unique_ptr - auto type deduction Change-Id: Icf9b93353404a39bf5f4a4562b9234db18cac696 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2017-01-301-59/+60
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/network-chat/peermanager.cpp src/widgets/util/qsystemtrayicon.cpp src/widgets/util/qsystemtrayicon_qpa.cpp src/widgets/util/qsystemtrayicon_win.cpp src/widgets/util/qsystemtrayicon_x11.cpp Change-Id: I1c026df83818c0ccaf956980370e7522960627db
| * XCB QPA: Fix QScreen::grabWindow(0) to return the current screenFriedemann Kleint2017-01-261-58/+59
| | | | | | | | | | | | | | | | | | | | | | Previously, the code queried the window to be grabbed for the geometry and thus returned the entire virtual desktop for multi screen setups. Use the QPlatformScreen's geometry in case of WID = 0. Task-number: QTBUG-58110 Change-Id: I3a9c0b0b3ea057f5e58f272f5c3fd40fafc073ba Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * Ensure a pixel density of at least 1 for Qt::AA_EnableHighDpiScalingJocelyn Turcotte2017-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Very large 1080p TVs or any display which is running at an abnormally low resolution can have a DPI lower than 48, which means that qRound(dpi/96) will result in a 0 pixel density, causing critical issues for applications using Qt::AA_EnableHighDpiScaling. Make sure that we always have a pixel density of at least 1 to allow applications not having to worry about such displays. Task-number: QTBUG-56140 Change-Id: I1dafbf7794a99ae6f872984c0337d8ff0d1fc1c0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | XCB: Use member initializationFriedemann Kleint2017-01-271-11/+0
|/ | | | | | | Shorten or remove constructors accordingly. Change-Id: I9c8bcf512c922c3c72be8a965d9557589bc9874f Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Use QStringBuilder more to optimize memory allocationsAnton Kudryavtsev2016-09-151-2/+1
| | | | | Change-Id: I2939ffa10496fdc59e0402a9cb54458565ccd657 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* xcb: Remove unused NoFontHinting hintAlexander Volkov2016-09-121-1/+0
| | | | | | | | It is unused since 0f7bc885aa7ae8cc3c448cc751aba4eba8c1c8b8 (Turn off font hinting when active highdpi scaling). Change-Id: I901407bedf24ae301acbe6afa94bc0a4cadb0620 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* xcb: eradicate Q_FOREACH loops [needing qAsConst()]Marc Mutz2016-04-281-1/+1
| | | | | | | | | | | | ... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(). Saves more than 2KiB in text size on optimized GCC 6.0 Linux AMD64 builds. Change-Id: I9610e711edc01d2a1ba19fef65d6b000ffc77255 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Optimize QXcbScreen::visualForFormat()Marc Mutz2016-04-271-14/+11
| | | | | | | | | | | | | | ... by stopping the work when finding the first RGB candidate, and otherwise only remembering the first candidate as a fall-back. This way, we don't need to allocate memory as we did when collecting the candidates in a QVector. Saves more than 800b in text size on optimized GCC 6.0 Linux AMD64 builds. Change-Id: I7d0cae69fa421fed881dd5a0f1aa45035d8f7461 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* xcb: eradicate Q_FOREACH loops [rvalues]Marc Mutz2016-04-261-1/+2
| | | | | | | | | | | | | ... by replacing them with C++11 range-for loops. This is the simplest of the patch series: Q_FOREACH took a copy, so we do, too. Except we don't, since we're just catching the return value that comes out of the function (RVO). We can't feed the rvalues into range-for, because they are non-const and would thus detach. Change-Id: I982851f15868e62b7a191676ddf4ba6b92c0a42d Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* X11: Better support non-32bit visualsLouai Al-Khanji2016-04-091-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch improves support for non-32bit screen configurations on X. The patch mostly touches the xcb platform plugin but the changes to the glx convenience functions do affect e.g. the offscreen plugin as well. Since QWindow instances are now by default of type RasterGL instead of Raster the majority of all windows are in fact instances of QXcbGlxWindow. This means that the eventual QSurfaceFormat that we use is chosen based on the available OpenGL configurations. Here the GLX config resolution code did not do a very good job in trying to find the closest match relative to the requested QSurfaceFormat, instead preferring higher bit depths. This is an issue since many configurations support 32-bit windows even if the screen itself has a root window with depth 16. In particular, servers supporting both GLX and Render are very likely to have such visuals. Particularly affected are remote X connections - even if the application itself makes no use of OpenGL at all! The changes introduced by this patch are as follows: 1. Improve the GLX visual selection logic 2. Improve the xcb visual selection logic 3. Remove duplicated visual lookup for OpenGL-enabled windows 4. Configure the default QSurfaceFormat to match the primary screen depth Change-Id: Id1c176359e63a4581410e20350db5ac2c083e1cf Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-211-0/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/widgets/styles/qgtkstyle_p.cpp tests/auto/corelib/io/qtextstream/test/test.pro tests/auto/corelib/plugin/plugin.pro Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
| * xcb: Initialize all xcb_client_message_event_t members before useShawn Rutledge2016-03-151-0/+1
| | | | | | | | | | Change-Id: I01e4b69b138fd19fc7e67751d93adebc1326b2f9 Reviewed-by: Orgad Shaneh <orgads@gmail.com>