diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2019-11-18 19:34:07 +0300 |
---|---|---|
committer | Alexander Volkov <avolkov@astralinux.ru> | 2020-09-16 21:22:15 +0300 |
commit | 7aacc8144e7da6b1ec48ab7c1e5c431d78c99c5f (patch) | |
tree | 3c9f9168d1f1d8e9faf537b178e8d62d96db29b3 /src/plugins/platforms/xcb/qxcbscreen.cpp | |
parent | bf075da8004718e6a7e8d3870b912e89cea8d08c (diff) |
xcb: Reduce number of created colormaps
Create a colormap per visual, not per window.
Pick-to: 5.15
Change-Id: I97d94618f159b4beaffd4a1afe0611233ced6676
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbscreen.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbscreen.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 82e256657c..e65418b077 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -131,6 +131,9 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t QXcbVirtualDesktop::~QXcbVirtualDesktop() { delete m_xSettings; + + for (auto cmap : qAsConst(m_visualColormaps)) + xcb_free_colormap(xcb_connection(), cmap); } QDpi QXcbVirtualDesktop::dpi() const @@ -493,6 +496,22 @@ quint8 QXcbVirtualDesktop::depthOfVisual(xcb_visualid_t visualid) const return *it; } +xcb_colormap_t QXcbVirtualDesktop::colormapForVisual(xcb_visualid_t visualid) const +{ + auto it = m_visualColormaps.constFind(visualid); + if (it != m_visualColormaps.constEnd()) + return *it; + + auto cmap = xcb_generate_id(xcb_connection()); + xcb_create_colormap(xcb_connection(), + XCB_COLORMAP_ALLOC_NONE, + cmap, + screen()->root, + visualid); + m_visualColormaps.insert(visualid, cmap); + return cmap; +} + QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop, xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output) : QXcbObject(connection) |