rust-x-bindings / rust-xcb

Rust bindings and wrapper for XCB.
MIT License
164 stars 64 forks source link

Damage error #221

Open sganis opened 1 year ago

sganis commented 1 year ago

Is there any example on how to use the xdamage extension?

This request fails:

let damage: xcb::damage::Damage = conn.generate_id();   
conn.send_request(&xcb::damage::Create {
        damage,
        drawable: x::Drawable::Window(window),
        level: xcb::damage::ReportLevel::DeltaRectangles
});

Error in first call of conn.wait_for_event():

Protocol(
    X(
        Request(
            RequestError {
                response_type: 0,
                error_code: 1,
                sequence: 15,
                bad_value: 67108864,
                minor_opcode: 1,
                major_opcode: 144,
                pad: 1,
            },
        ),
        Some(
            "damage::Create",
        ),
    ),
)
rtbo commented 1 year ago

There is no example and I've never used this extension. If you point me to simple example in C I can adapt to Rust and try to see what's wrong

sganis commented 1 year ago

I found this: https://github.com/minlexx/test_xcb_xdamage/blob/master/main.c

Maxdamantus commented 1 year ago

@sganis The failure is probably because the damage extension seems to require the client to send a QueryVersion request before use (I don't think this is the case with other extensions).

My related issue #228 contains some example code. Note that due to this issue, you need to be careful if handling the NotifyEvent::level() (or printing it using Debug), but the extension should otherwise be usable.