Jump to content

KWin/Qt5: Difference between revisions

From KDE Community Wiki
Created page with "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. ----..."
 
Mgraesslin (talk | contribs)
QPixmap problems
Line 1: Line 1:
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.
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 [http://qt-project.org/doc/qt-5.0/qtgui/qpixmap.html 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 ==
{| cellspacing="0" cellpadding="5" border="1" style="border: 1px solid gray; border-collapse: collapse; text-align: left; width: 100%;" class="sortable"
{| cellspacing="0" cellpadding="5" border="1" style="border: 1px solid gray; border-collapse: collapse; text-align: left; width: 100%;" class="sortable"
|- style="background: rgb(236, 236, 236) none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; white-space: nowrap;"
|- style="background: rgb(236, 236, 236) none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; white-space: nowrap;"


! Status  
! Status
! Description
! Code Area
! affected parts of KWin
! Problem
 
! Claimed By
{{FeatureTodo|QRegion::handle() does not return a X11 Region any longer|client.cpp}}
{{FeatureProjectTodo |Screenshot Effect|window rendered into QPixmap, read into an image|}}
{{FeatureTodo|QPixmap::handle() does not return a X11 Pixmap any longer|decoration painting, tfp}}
{{FeatureProjectTodo |MouseClick Effect|drawing with QPainter on QPixmap| }}
{{FeatureProjectTodo |TrackMouse Effect|Image data loaded into QPixmap for rendering|}}
{{FeatureProjectTodo |PaintRedirector|QWidget drawing redirected into QPixmap|}}
{{FeatureProjectInProgress | Shadow | QPixmap for sharing data between windows|}}
{{FeatureProjectTodo |SceneXrender| QPixmap used as pixmap wrapper|}}
{{FeatureProjectTodo |EffectFrame|Usage of FrameSvg, provides QPixmap|}}
{{FeatureProjectTodo |Client::icon|Icon is a QPixmap, needs to have QIcon and low level xcb_pixmap_t|}}
|}
|}

Revision as of 18:32, 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