smithay icon indicating copy to clipboard operation
smithay copied to clipboard

`BufferAssignment::NewBuffer::delta` is unused

Open cmeissl opened this issue 3 years ago • 10 comments

The delta of wl_surface::attach is tracked in BufferAssignment::NewBuffer but ignored in the desktop abstractions.

cmeissl avatar Mar 28 '22 12:03 cmeissl

It is unclear how they should be handled, given their are essentially hints for resizing windows. But they should probably be exposed somehow instead of just ignored by the on_commit_buffer_handler and dropped.

Drakulix avatar Mar 28 '22 12:03 Drakulix

wlroots uses the delta for updating some external_damage on commit. For me it looks like the external_damage is similar to the damage in smithays space, so it could have something to do with movement.

cmeissl avatar Mar 28 '22 13:03 cmeissl

I believe the attach-delta-loop example of wleird could be a good testbed for what behavior is expected with this delta.

elinorbgr avatar Mar 28 '22 13:03 elinorbgr

Without attach, DND icons are also not placed correctly, they pass their offset by wl_surface.attach

PolyMeilex avatar Apr 09 '22 20:04 PolyMeilex

Was this fixed by https://github.com/Smithay/smithay/pull/602 ?

Drakulix avatar Jun 20 '22 13:06 Drakulix

For me this is no longer an issue, I just needed to have a way to access the delta, and that is done. The only question left would be, should desktop abstraction take delta into account on its own?

PolyMeilex avatar Jun 20 '22 13:06 PolyMeilex

Good question, I guess if we are handling the buffer management, we also need to update the internal location of windows, if clients set a delta (which might give clients a way to move themselves... urgh).

Drakulix avatar Jun 20 '22 13:06 Drakulix

Moving clients in the context of window tiling would be weird to say the least. Protocol wise, delta is just a hit, we don't have to move the surface in response to it. Personally, I use delta only for DND icon offset because: Initially, the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.attach request can move the relative position.

So, I'd say it's compositor specific behavior.

PolyMeilex avatar Jun 20 '22 13:06 PolyMeilex

How is the compatibility handled when binding version smaller than 5? As it is officially discouraged to use the attach offset I think it is fine if we just ignore it, but from the code I am unsure what happens when a client binds version 4 and sets an offset in attach. Does to PR implement the protocol check for:

When the bound wl_surface version is 5 or higher, passing any non-zero x or y is a protocol violation, and will result in an 'invalid_offset' error being raised. To achieve equivalent semantics, use wl_surface.offset.

cmeissl avatar Jun 20 '22 13:06 cmeissl

Lower then 5 works like it used to, 5 or higher rises a protocol error and expects you to use new offset message. https://github.com/Smithay/smithay/blob/c30fc14a4c638ee56f8dce2d43ab5f82df9ef414/src/wayland/compositor/handlers.rs#L174-L187

PolyMeilex avatar Jun 20 '22 14:06 PolyMeilex