Skip to content

RFC: Introduce KWin::Vector as a vector decoration template with coordinate system

Arjen Hiemstra requested to merge work/ahiemstra/kwinvector into master

This adds a template that can be used to decorate geometric/vector types with a coordinate system. The main goal is to prevent accidentally using values in one coordinate system in another. Instead, an explicit conversion is required that may need extra parameters to ensure the conversion happens correctly.

This was originally written in relation to !2739 (merged) , since the code becomes a lot easier to read when it is explicitly communicating about the desired coordinate systems. However, it may also make sense for other contexts where different coordinate systems are used. Additionally, initially it was intended to mainly wrap QVectorXD types, but I think it may actually also work for QPointF/QRectF.

This is an RFC as I am unsure as to whether this is desired and to what extent. I personally think having this would greatly clear up a bunch of code. If this is accepted, I would slowly introduce it in KWin's main API, updating things as we go. One of the first things I would want to change is making "GLVertex2D" use these types for its position and UV coordinate members.

Merge request reports

Loading