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

Split out a x11rb-protocol crate #664

Merged
merged 3 commits into from
Mar 18, 2022
Merged

Split out a x11rb-protocol crate #664

merged 3 commits into from
Mar 18, 2022

Commits on Mar 16, 2022

  1. Split out a x11rb-protocol crate

    This commit splits the code into two crates:
    
    "x11rb-protocol" contains the protocol definitions and allows parsing
    and serialising things. It does not do any actual I/O.
    
    "x11rb" uses x11rb-protocol and implements an X11 client based on this.
    
    I tried to do as few changes as possible here. Code moves around, but
    the structure of the code is not supposed to change.
    
    There is one place where this did not work out:
    
    Previously, e.g. CreateWindowRequest had an associated function send().
    This function send the request that it is called on via a given X11
    connection. Since this does I/O, this functionality does not belong into
    the x11rb-protocol crate. Since it is an associated function, it cannot
    easily be provided by x11rb.
    
    For now, I worked around this problem by turning send() into a "free"
    function. The resulting name collision was dealt by renaming it to e.g.
    send_create_window().
    
    The result of all this is a huge commit. This is still a mess and things
    should be cleaned up further in the future, but I didn't want to make
    this commit even larger. This is the first version that I managed to get
    to compile.
    
    Signed-off-by: Uli Schlachter <psychon@znc.in>
    psychon committed Mar 16, 2022
    Configuration menu
    Copy the full SHA
    8aac79f View commit details
    Browse the repository at this point in the history
  2. Fix build with Rust 1.46

    error[E0277]: `[&mut generator::output::Output; 2]` is not an iterator
      --> generator/src/generator/mod.rs:26:16
       |
    26 |     for out in [&mut main_proto_out, &mut main_x11rb_out] {
       |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
       |
       = help: the trait `std::iter::Iterator` is not implemented for `[&mut generator::output::Output; 2]`
       = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
       = note: required by `std::iter::IntoIterator::into_iter`
    
    Signed-off-by: Uli Schlachter <psychon@znc.in>
    psychon committed Mar 16, 2022
    Configuration menu
    Copy the full SHA
    4cb8494 View commit details
    Browse the repository at this point in the history
  3. Fix "cargo test" doctests

    A wrong/old crate name was used in a doc test.
    
    ---- src/protocol/xproto.rs - protocol::xproto::GetPropertyReply::value16 (line 8909) stdout ----
    error[E0433]: failed to resolve: use of undeclared crate or module `x11rb`
     --> src/protocol/xproto.rs:8911:13
      |
    4 | let reply = x11rb::protocol::xproto::GetPropertyReply {
      |             ^^^^^ use of undeclared crate or module `x11rb`
    
    Signed-off-by: Uli Schlachter <psychon@znc.in>
    psychon committed Mar 16, 2022
    Configuration menu
    Copy the full SHA
    17ff89d View commit details
    Browse the repository at this point in the history