x11-rs
x11-rs copied to clipboard
How to use the Xfixes extension?
I'm trying to use XFixesSelectSelectionInput, but I always get undefined reference. I tried with most of the feature flags and also have Xfixes installed, but still no success. Other functions like XOpenDisplay work as expected.
Am I missing something or is there a bug in the bindings? I've noticed that compared to the functionality of other X-libraries, there is also no feature flag specific to Xfixes.
Hi, xfixes is included by default. So you don't need any feature flags. While I heavily doubt its anything within the bindings as its very little overhead, you can try replicating it in C. If the issue repeats, please report upstream. In any case, it would be great if you could provide the context around how you're using XFixesSelectSelectionInput
Thanks for the response. I had some time to give it a closer look and it seems the problem is indeed related to the bindings. I was able to fix it in a local clone of this repo.
The problem seems to be that in x11/build.rs there is no entry for xfixes, so pkgconfig isn't called for xfixes, and since the x11_link macro ignores its $lib_name argument, the libXfixes.so-file also isn't being linked in somewhere else.
The solution I've found was to add a feature flag for xfixes in x11/Cargo.toml and x11/build.rs. I think this would be a reasonable fix, since xfixes is a separate library that is distributed with its own pkgconfig file (at least in Ubuntu and NixOS).
Thanks for investigating, it seems you are correct. I merged in #118 but I overlooked the fact they forgot to add it to x11-dl. Do you want to create a pr for this? Or should I
Sure, no problem!
For the x11 crate, I can create a pull request.
For the x11-dl crate, I'm not sure enough what to change. If I just add ("xfixes", "xfixes") in x11-dl/build.rs, then I get a dead code warning for
pub const xfixes: Option<&'static str> = Some("/nix/store/wrpycz38df4vpc0qkzkfbbynvzk535km-libXfixes-6.0.0/lib");
which I guess means, that there needs some further change to be done.
What exactly is the difference between x11 and x11-dl if I may ask? From a quick look, it seems the linking is done differently, since the x11_link macro is defined in a different way here, that doesn't throw away the $lib_name.
x11 is statically linked, x11-dl was created later on to serve for dynamic linking. Allows for more portable executables. You shouldn't have to do much aside from add mod xfixes in x11-dl. The rest is handled inside xfixes.rs itself. We don't need features because its already dynamically linked
I just stumbled over this issue, too. Are there plans to release a version containing this fix?
Fixed in https://github.com/AltF02/x11-rs/commit/032d968411cc7686949765c10f9fc3afa27bab41 / v2.20.1