[server] Allow multiple touch interfaces per client
ClosedPublic

Authored by romangg on Sep 12 2018, 1:28 AM.

Details

Summary

The touch related code in the seat interface class has been for no apparent
reason very different to pointer and keyboard code.

This patch makes touch related code more similar and by that allows a client
to receive touch events through multiple interfaces.

Test Plan

Manually and auto tests still pass.

Diff Detail

Repository
R127 KWayland
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
romangg created this revision.Sep 12 2018, 1:28 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptSep 12 2018, 1:28 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
romangg requested review of this revision.Sep 12 2018, 1:28 AM

has been for no apparent reason

From the spec (emphasis mine)

The wl_touch interface represents a touchscreen associated with a seat.

The wl_pointer interface represents one or more input devices,

The wl_keyboard interface represents one or more keyboards associated with a seat.

I assume the rationale being that wl_touch already has multiplicity inside it; mutliple touch screens, just add more touches. Whereas wl_pointer is always just one.

I believe it works like this: A seat has one global pointer, one global keyboard and one global touch "object" each. But clients can bind to them multiple times. That's why there are focus.pointers and focus.keyboards vectors although there is only one global pointer/keyboard.

A different question is what happens on a multi-seat system: when there are several mice or keyboards, the compositor must support splitting them up to multiple seats (but every seat again has only one global keyboard and pointer object). This does not work of course for touch screens, so that's why the specs is reads differently here. But as said this is not directly related to focus.pointers, focus.keyboards or focus.touchs being vectors per seat or not.

Oh, I see what you're saying, I misread, sorry. That does indeed make sense.

Some undocumented fallback code has been removed as well. Platforms not supporting touch are just considered not capable instead.

I don't understand removing this. If I have an app that doesn't understand touch doesn't it make sense to synthesise a pointer?

src/server/seat_interface_p.h
147

touchs -> touches

I don't understand removing this. If I have an app that doesn't understand touch doesn't it make sense to synthesise a pointer?

I didn't read the code correctly. Thought it is meant for compositors not supporting touch, but indeed it's meant for clients not supporting it. Hmm, I imagine since most Wayland clients use some sort of GUI library there are not many Wayland native clients not supporting touch. And Xwayland translates touch events. So maybe it would still make sense to remove the code. But I'll add it back for now. This way the change also becomes more narrow.

romangg updated this revision to Diff 41513.Sep 13 2018, 8:08 AM

Readd fall back code

romangg retitled this revision from [server] Allow multiple touch interfaces per client and remove fallback code to [server] Allow multiple touch interfaces per client.Sep 13 2018, 8:09 AM
romangg edited the summary of this revision. (Show Details)
romangg edited the summary of this revision. (Show Details)
src/server/seat_interface.cpp
1332

what happened to the
if (id == 0 )

which is making sure if you multi touch we only send the first as a mouse event.

1358

If you have a release build Q_ASSERT get completely compiled out and no code will run.

romangg added inline comments.Sep 18 2018, 8:15 PM
src/server/seat_interface.cpp
1332

Good catch. Thanks.

1358

True, just our dev PCs will suffer. Ok, I will add the assert.

romangg updated this revision to Diff 41916.Sep 18 2018, 8:16 PM

Do not forget id equals 0 check and add assert.

davidedmundson accepted this revision.Oct 23 2018, 6:06 PM
This revision is now accepted and ready to land.Oct 23 2018, 6:06 PM
This revision was automatically updated to reflect the committed changes.