KWin/Qt5
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 |
---|---|---|---|
DONE | Screenshot Effect | window rendered into QPixmap, read into an image (http://commits.kde.org/kde-workspace/d593d6ef3675bc32e6d107fdb23e33dcc373f3a6 ) | |
DONE | MouseClick Effect | drawing with QPainter on QPixmap (http://commits.kde.org/kde-workspace/e48b527981ac25f6304a6430f2b4af37169fb98a ) ) | |
DONE | TrackMouse Effect | Image data loaded into QPixmap for rendering | |
DONE | PaintRedirector | QWidget drawing redirected into QPixmap | |
IN PROGRESS | Shadow | QPixmap for sharing data between windows | |
DONE | SceneXrender | QPixmap used as pixmap wrapper | |
DONE | EffectFrame | Usage of FrameSvg, provides QPixmap | |
DONE | kwinxrenderutils | Generating XRenderPicture from 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 |
---|---|---|---|
DONE | Client::updateCursor | Used in XDefineCursor | |
DONE | EffectsHandlerImpl::createInputWindow | QCursor passed in to set the cursor image for the window | |
DONE | Cube Effect | QCursor used to update cursor on input window | |
DONE | DesktopGrid Effect | QCursor used to update cursor on input window | |
DONE | PresentWindows Effect | QCursor used to update cursor on input window | |
DONE | Client::startMoveResize | QCursor used to set the cursor while moving/resizing a window | |
DONE | 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 |
---|---|---|---|
DONE | Client::updateInputWindow() | http://commits.kde.org/kde-workspace/8dc1d43937b6ce6fdad79099ea399d459bcfe542 | |
DONE | Client::setMask | http://commits.kde.org/kde-workspace/609d1b7953a46a8a12364b93be01b353f2fe0c1e | |
DONE | kcmdecoration KDecorationPreview::setPreviewMask | http://commits.kde.org/kde-workspace/1a6d15fe40688f3ccc06335fd5183f0ef941df1b | |
DONE | DecoBenchmark | http://commits.kde.org/kde-workspace/18059e67ee9d27cbf7a971e650803e926cb3f245 |
XEvent
Problem Description
The x11EventFilter from Qt 4 does no longer exist in Qt 5. The x11EventFilter provided an XEvent which could be passed through the application for processing. In Qt 5 there is the possibility to install a native event filter which receives xcb_generic_event_t.
How to solve
Main event processing needs to be split out into an own class which can in Qt 5 be derived from QAbstractNativeEventFilter. The logic for event filtering should be split into multiple methods which are as much as possible windowing system independent. E.g. if a mouse click is used it should operate on a QPoint and not on the native mouse press event. A complete port away from XEvent is not yet possible as with Qt 4 we won't get xcb_generic_event_t events through the event filter. Though it is a reasonable idea to add two parallel code pathes.
Problematic code areas
An InProgress here means that an xcb_generic_event_t method is added in addition to the XEvent method.
Status | Code Area | Problem | Claimed By |
---|---|---|---|
TODO | events.cpp | main event filter for KWin | |
TODO | Client::sendClientMessage | sends an XEvent to the Client | |
TODO | Client::sendSyncRequest() | sends an XEvent to the Client | |
TODO | EffectsHandlerImpl::checkInputWindowEvent | Input events for fullscreen effects | |
TODO | Client::sendSyntheticConfigureNotify | sends an XEvent to the Client | |
IN PROGRESS | KillWindow | own event handling | |
TODO | KWin::Application::Application() | sends an XEvent to update splash progress | |
TODO | Application::x11EventFilter | main filter passed to events.cpp | |
IN PROGRESS | ScreenEdge::isEntered | Checks notify enter events | |
TODO | TabBox::DeclarativeView::x11Event | Checks mouse events - only embedded mode | |
TODO | TabBox::handleMouseEvent | mouse events for TabBox | |
TODO | updateXTime() | ||
TODO | update_x_time_predicate(..) |