Review Request 128567: Add a convenient API to query the windowing system/platform used by Qt
Ivan Čukić
ivan.cukic at kde.org
Tue Aug 2 08:18:48 UTC 2016
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128567/#review97992
-----------------------------------------------------------
Ship it!
Ship It!
- Ivan Čukić
On Aug. 2, 2016, 5:47 a.m., Martin Gräßlin wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128567/
> -----------------------------------------------------------
>
> (Updated Aug. 2, 2016, 5:47 a.m.)
>
>
> Review request for KDE Frameworks.
>
>
> Repository: kwindowsystem
>
>
> Description
> -------
>
> A common pattern for our applications which have to do platform specific
> tasks is to query the used platform with code like:
> if (QX11Info::isPlatformX11()) {
> // do X11 specific stuff
> } else if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"))) {
> // do Wayland specific stuff
> }
>
> The problem with that is that it involves string comparisons and is easy
> to get wrong. E.g. for X11 one should use the QX11Info helper, for
> Wayland one has to compare with startsWith. There is lot of domain
> specific knowledge going into it to make it work correctly and in an
> efficient way.
>
> This change introduces an enum based API which encapsulates the
> knowledge: it does the proper comparisons and caches the result, so
> that one does not need to do string comparisons again and again.
>
> So far the implementation supports the platforms X11/XCB and Wayland.
> In addition there are convenient methods to check for a specific
> platform modelled after QX11Info::isPlatformX11.
>
> Further platforms can be added by the maintainers of the respective
> platforms.
>
>
> Diffs
> -----
>
> autotests/CMakeLists.txt 65ed8d4da50fd41dd3060576284456c83c3629ab
> autotests/helper/CMakeLists.txt PRE-CREATION
> autotests/helper/wayland_platform.cpp PRE-CREATION
> autotests/kwindowsystem_platform_wayland_test.cpp PRE-CREATION
> autotests/kwindowsystemx11test.cpp cdf94e3f6573faea6dfd6038dded3ee1269e2552
> src/kwindowsystem.h 551b01f5831e2fbdf0d0ad30f3debf0955da189e
> src/kwindowsystem.cpp 4dfcce8bbfeed09f3f6ddec10a1eb5fd2d418313
>
> Diff: https://git.reviewboard.kde.org/r/128567/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Martin Gräßlin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160802/fba42456/attachment.html>
More information about the Kde-frameworks-devel
mailing list