KWin/Qt5: Difference between revisions

From KDE Community Wiki
Line 70: Line 70:
! Claimed By
! Claimed By
{{FeatureProjectInProgress | Client::updateInputWindow() | XShapeCombineRegion |}}
{{FeatureProjectInProgress | Client::updateInputWindow() | XShapeCombineRegion |}}
{{FeatureProjectTodo | Client::setMask| XShapeCombineRegion |}}
{{FeatureProjectInProgress | Client::setMask| XShapeCombineRegion |}}
{{FeatureProjectTodo | kcmdecoration KDecorationPreview::setPreviewMask | maybe no longer needed? |}}
{{FeatureProjectTodo | kcmdecoration KDecorationPreview::setPreviewMask | maybe no longer needed? |}}
{{FeatureProjectTodo | DecoBenchmark | seems like copy of kcm, maybe no longer needed? |}}
{{FeatureProjectTodo | DecoBenchmark | seems like copy of kcm, maybe no longer needed? |}}

Revision as of 12:51, 4 February 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
IN PROGRESS Client::updateInputWindow() XShapeCombineRegion
IN PROGRESS Client::setMask XShapeCombineRegion
TODO kcmdecoration KDecorationPreview::setPreviewMask maybe no longer needed?
TODO DecoBenchmark seems like copy of kcm, maybe no longer needed?

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(..)