mpv icon indicating copy to clipboard operation
mpv copied to clipboard

add defines at configure time for wayland protocol interface versions

Open Dudemanguy opened this issue 1 year ago • 9 comments

Maybe this is overengineering it but it's kind of dumb to not have this information at configure time in the first place.

Dudemanguy avatar Apr 25 '24 17:04 Dudemanguy

Download the artifacts for this pull request:

Windows
macOS

github-actions[bot] avatar Apr 25 '24 17:04 github-actions[bot]

Is it not sufficient to check #if HAVE_WAYLAND_PROTOCOLS_1_XX to determine the max version supported? It is already done to check the existence of some other protocols.

na-na-hi avatar Apr 25 '24 21:04 na-na-hi

It is possible. But it doesn't solve the fundamental issue which is that we have no way of knowing interface versions at compile time. I think xdg_wm_base is the only thing that currently has this issue, but perhaps something like this would need to be done again in the future for some other protocol.

But again, it's kind of overengineering like I said.

Dudemanguy avatar Apr 25 '24 22:04 Dudemanguy

But it doesn't solve the fundamental issue which is that we have no way of knowing interface versions at compile time.

It is possible by calculating the maximum value of all interested SINCE_VERSION macros, and limit wl_registry_bind to use that max value. If something isn't defined, don't include it in the calculation. In the mentioned issue, if XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION (5) isn't defined, the calculated max protocol version will be less than 5.

na-na-hi avatar Apr 26 '24 01:04 na-na-hi

It is possible by calculating the maximum value of all interested SINCE_VERSION macros, and limit wl_registry_bind to use that max value.

OK maybe I should have typed "sane way" to be more accurate. I would rather this or hack around in HAVE_WAYLAND_PROTOCOLS than do that.

Dudemanguy avatar Apr 26 '24 02:04 Dudemanguy

FWIW, I'd prefer using SINCE_VERSION instead of manually parsing the interface XML files again, giving they are already parsed by wayland-scanner to generate the header files.

ruihe774 avatar Apr 26 '24 06:04 ruihe774

Maybe you could report it to the wayland-protos issue tracker so at least there's a chance we could get rid of this in the future?

llyyr avatar Apr 26 '24 07:04 llyyr

I already have an open MR for wayland-scanner that adds this version information.

Dudemanguy avatar Apr 26 '24 13:04 Dudemanguy

I'm waiting for a response from upstream before I decide what to do with this one.

Dudemanguy avatar May 05 '24 20:05 Dudemanguy

We'll just hack around it for now. Hopefully upstream will be receptive to making scanner more useful later on.

Dudemanguy avatar May 16 '24 15:05 Dudemanguy