KWin/Qt5: Difference between revisions
Mgraesslin (talk | contribs) QRegion |
Mgraesslin (talk | contribs) |
(No difference)
|
Revision as of 19:34, 29 January 2013
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 |
QCursor
Problem Description
In Qt 5 QCursor does no longer expose the native handle, which means we cannot use it to manually setting the cursor with low level xcb calls.
How to solve
KWin needs it's own Cursor implementation (needed anyway for Wayland) which does both the low level interaction and providing an easy to use high level abstraction for internal usage.
Problematic code areas
Status | Code Area | Problem | Claimed By |
---|---|---|---|
TODO | Client::updateCursor | Used in XDefineCursor | |
TODO | EffectsHandlerImpl::createInputWindow | QCursor passed in to set the cursor image for the window | |
TODO | Cube Effect | QCursor used to update cursor on input window | |
TODO | DesktopGrid Effect | QCursor used to update cursor on input window | |
TODO | PresentWindows Effect | QCursor used to update cursor on input window | |
TODO | Client::startMoveResize | QCursor used to set the cursor while moving/resizing a window | |
TODO | Client::embedClient | Defined on window |
QRegion
Problem Description
In Qt 5 QRegion no longer references a _XRegion which is used in conjunction with XShape.
How to solve
Code needs to be ported to XCB anyway which will replace the region by the rects.
Problematic code areas
Status | Code Area | Problem | Claimed By |
---|---|---|---|
TODO | Client::updateInputWindow() | XShapeCombineRegion | |
TODO | Client::setMask | XShapeCombineRegion | |
TODO | kcmdecoration KDecorationPreview::setPreviewMask | maybe no longer needed? | |
TODO | DecoBenchmark | seems like copy of kcm, maybe no longer needed? |