Skip to content

add support for touch corner gestures

Luis Büchi requested to merge lbuechi/kwin:work/touch_corner_gestures into master

So far KWin touch screen effects only supported edge gestures, leaving out corner gestures. This MR aims to fix that by allowing touch screen edge gestures to also use corners.

The main necessary change was making new logic for the "hitbox" of swipe gestures in the corner. The old logic set a hardcoded value for the thickness of screen edges which worked fine on edges but was way too small to be usable in corners. The new logic keeps the old thickness for edges while having a similar thickness for the corner without "filling in" the rest of the square. Additionally it supports a variable corner radius both to make it easier to use the gesture as well as to better support screens with corner radii. See following image for a sketch:

image

The radius can be as small as 0 (no radius) up to "infinity". In the first iteration I think hardcoding it to the size of the corner makes sense, but long term it'd be better if it could adapt to the actual radius of the screen (I've been told that in the future this may be something we can know in code?)

Current status

I've not done any thorough testing and the code quality isn't amazing; I'm not sure if there isn't a better approach for data flow around the new "hitbox" logic (looks messy and not super readable), I'm making this MR already so people can give feedback if the general approach is okay enough (I don't have much prior experience in this area so I'm really not sure if my base approach is ideal and if there may be a better/easier way to do things within KWin's code base) for me to go in and polish it or if something more fundamental should be changed.

With that out of the way it should still work as a proof of concept and to discuss about.

For debugging purposes making m_cornerOffset huge (eg: multiplying it by 4 or 8) allows to actually be able to hit different parts of the hitbox and see if that behaves right. I'm doing testing in a Plasma Mobile session with a dummy KWin effect that registers a corner gesture (right now bottom left, but all corners should work), I think for it to work in Plasma Desktop the touch screen gesture KCM would still need updating to contain the corners (or another dummy effect would need to be added).

Edited by Luis Büchi

Merge request reports