Jump to content

KWin/Qt5

From KDE Community Wiki
Revision as of 18:32, 29 January 2013 by Mgraesslin (talk | contribs) (QPixmap problems)

Qt5 has several changes that break the API-compatibility to Qt4. Especially the transition to the Lighthouse/QPA architecture makes it necessary to adjust KWin accordingly.

QPixmap/XPixmap

Problem Description

In Qt 5 QPixmap can no longer reference an xcb_pixmap_t, which means that it cannot be used as a backend for XRender compositing. Dangerous API calls are:

  • QPixmap::fromX11Pixmap
  • QPixmap::x11PictureHandle
  • QPixmap::handle

How to solve

The solution depends on the usage. If QPixmap has been used to simplify drawing (e.g. QPainter) the drawing commands need to be ported to low level xcb render API. If QPixmap has been used to limit memory copies and to simplify sharing with QImage it becomes more difficult. Sharing to a QImage needs to be implemented and ported to it. Areas where QPixmap is used to get e.g. the drawing of a widget to be used later on in compositing, can only be partially adjusted. The code can be written, but should not be used as for Qt 4 we should use the native graphics system for QPixmap in XRender backend as long as possible.

Problematic code areas

Status Code Area Problem Claimed By
TODO Screenshot Effect window rendered into QPixmap, read into an image
TODO MouseClick Effect drawing with QPainter on QPixmap
TODO TrackMouse Effect Image data loaded into QPixmap for rendering
TODO PaintRedirector QWidget drawing redirected into QPixmap
IN PROGRESS Shadow QPixmap for sharing data between windows
TODO SceneXrender QPixmap used as pixmap wrapper
TODO EffectFrame Usage of FrameSvg, provides QPixmap
TODO Client::icon Icon is a QPixmap, needs to have QIcon and low level xcb_pixmap_t