Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some conversion to XCB #3

Merged
merged 5 commits into from
Sep 28, 2018
Merged

Some conversion to XCB #3

merged 5 commits into from
Sep 28, 2018

Conversation

psychon
Copy link

@psychon psychon commented Sep 27, 2018

This contains some (barely tested) conversion to XCB. This was almost merely build-tested and I guess that some of the code is not built by default (but I am not totally sure). So, feel free to tell me about any breakage that I caused.

I tried to be careful with this. For example, I am in the middle of the xcb-xfixes conversion (but won't be able to finish it today) and here I noticed that the order of parameters in xcb_xfixes_copy_region and xcb_xfixes_union_region is different than with Xlib. Still, I can NOT guarantee that I did not miss anything.

This got broken in commit fcef5e7.

Signed-off-by: Uli Schlachter <psychon@znc.in>
No functional changes intended. The new xcb_damage_query_version() was
previously done by XDamageQueryExtension() internally.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Uli Schlachter <psychon@znc.in>
@yshui
Copy link
Owner

yshui commented Sep 27, 2018

Wow, that's a lot of work in a short amount of time.

We certainly would need to do as much testing as possible before this can be merged.

@psychon
Copy link
Author

psychon commented Sep 27, 2018

Well, most of this was quite simple & mechanical. The biggest surprise was that XDamageQueryExtension sends a DAMAGE-QueryVersion request internally and that the DAMAGE extension does not work without that. The rest was relatively straight-forward.

I'll try to finish the XFixes port tomorrow and add the resulting commit to this PR (if it's not merged by then). Testing-wise... well, it seems to work here. ;-)

@yshui
Copy link
Owner

yshui commented Sep 27, 2018

@psychon --blur-background with xrender backend seems to be broken.

@psychon
Copy link
Author

psychon commented Sep 28, 2018

Edit: First of all, sorry for breaking something. Also, boy is --blur-background slow here...

Oh, right. The strings in the answer are not null-terminated, so strcmp is a no-go.

diff --git a/src/compton.c b/src/compton.c
index 5c7e845..04eab3e 100644
--- a/src/compton.c
+++ b/src/compton.c
@@ -4740,7 +4740,8 @@ init_filters(session_t *ps) {
             xcb_str_iterator_t iter = xcb_render_query_filters_filters_iterator(pf);
             for (; iter.rem; xcb_str_next(&iter)) {
               // Convolution filter
-              if (!strcmp(xcb_str_name(iter.data), XRFILTER_CONVOLUTION))
+              if (strlen(XRFILTER_CONVOLUTION) == xcb_str_name_length(iter.data)
+                  && !memcmp(XRFILTER_CONVOLUTION, xcb_str_name(iter.data), strlen(XRFILTER_CONVOLUTION)))
                 ps->xrfilter_convolution_exists = true;
             }
             free(pf);

Will push this as a new commit.

The X11 server's answer is not \0-terminated, so xcb_str_name() also
does not provide a \0-terminated pointer.

Signed-off-by: Uli Schlachter <psychon@znc.in>
@yshui
Copy link
Owner

yshui commented Sep 28, 2018

boy is --blur-background slow here...

As expected.

Anyway, this looks fine. I will go through it again and probably merge it later today.

@yshui
Copy link
Owner

yshui commented Sep 28, 2018

The biggest surprise was that XDamageQueryExtension sends a DAMAGE-QueryVersion request internally and that the DAMAGE extension does not work without that.

Presumably they think it is a good idea to require the client send what version it supports to avoid incompatibilities. And somehow they decided to do that in this ONE EXTENSION ONLY.

Typical Xorg.

@yshui yshui merged commit 5efa21e into yshui:next Sep 28, 2018
@psychon psychon deleted the xcb_conv branch September 28, 2018 10:29
@psychon
Copy link
Author

psychon commented Sep 28, 2018

Thanks for merging. Feel free to @psychon me in case some issues show up. I did read some libXdamage source code to figure out this stuff. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants