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

X11 Resource Manager support #561

Merged
merged 45 commits into from
Nov 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
26dd2a9
Start working on a resource_manager library
psychon Nov 19, 2020
de0efa2
Start some actual parsing
psychon Nov 21, 2020
816f8a0
Implement the parsing of resource entries
psychon Nov 21, 2020
c02b752
Get the new tests to succeed
psychon Nov 21, 2020
470b147
Add some more parsing tests
psychon Nov 21, 2020
edae756
Always skip to the end of the line in the parser
psychon Nov 24, 2020
4ec5b90
Import matching tests
psychon Nov 24, 2020
4bf2f9d
Add parsing of a whole database file
psychon Nov 24, 2020
0c996d5
Skip escaped line breaks before the value
psychon Nov 24, 2020
c899ff8
Handle escaped line breaks in the value
psychon Nov 24, 2020
89149f7
Improve matcher test failure mode
psychon Nov 24, 2020
ddc7739
Merge useless extra test into the main function
psychon Nov 24, 2020
1fa4f8b
Change parse_resource() return type
psychon Nov 24, 2020
1bf29c5
Get rid of ugly array size in type
psychon Nov 25, 2020
39c1efb
Print number of failures in failing test
psychon Nov 25, 2020
bc22f79
Remove an unused variable
psychon Nov 25, 2020
3126c25
Fix valid characters check for quark names
psychon Nov 25, 2020
74ffec3
Add a first, broken matcher
psychon Nov 25, 2020
90215a9
Also implement matching against the class query
psychon Nov 25, 2020
67c6938
Match instance/class together instead of separately
psychon Nov 25, 2020
1ad3b94
Fix a matching bug
psychon Nov 26, 2020
cf343e5
Keep track of the matching history
psychon Nov 26, 2020
d3e952b
Implement ranking of matches
psychon Nov 26, 2020
212c44c
Clarify the assert added in the previous commit
psychon Nov 26, 2020
77728c8
Add a test for #include actually adding stuff
psychon Nov 26, 2020
077968b
Start working on the public resource manager API
psychon Nov 27, 2020
85ea419
Implement Database::new_from_default()
psychon Nov 27, 2020
8c9cb09
Small API fix
psychon Nov 27, 2020
060f8ad
Try to make the parser a bit more readable
psychon Nov 27, 2020
845d55b
Try to make the matching code more readable
psychon Nov 27, 2020
38925af
Properly add resource_manager to Cargo.toml
psychon Nov 28, 2020
b7d3381
Add some resource_manager docs
psychon Nov 28, 2020
bdcda1a
Some more small documentation improvements
psychon Nov 28, 2020
e3e73ef
Even more documentation
psychon Nov 28, 2020
46d0dd7
rustfmt only ever complains...
psychon Nov 28, 2020
9ce0df2
Improve readability of matching comparison code
psychon Nov 28, 2020
adfaa35
More fun with rustfmt
psychon Nov 28, 2020
74c7433
Add some more resource manager tests
psychon Nov 28, 2020
4611138
One small change to make clippy happy
psychon Nov 28, 2020
df3ad7c
Two small changes since rustfmt insists
psychon Nov 28, 2020
dfb6c5b
Merge branch 'master' into resource_manager
psychon Nov 28, 2020
45b3bc5
Move a #![allow(clippy::)] to a global context
psychon Nov 28, 2020
bfff6f1
Merge branch 'master' into resource_manager
psychon Nov 29, 2020
c295911
Fix a "redundant clone" clippy warning
psychon Nov 29, 2020
075a312
Replace todo!() with unimplemented!()
psychon Nov 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ cursor = ["render"]
# Enable utility functions in `x11rb::image` for working with image data.
image = []

# Enable utility functions in `x11rb::resource_manager` for querying the
# resource databases.
resource_manager = []

dl-libxcb = ["allow-unsafe-code", "libloading", "once_cell"]

# Enable this feature to enable all the X11 extensions
Expand Down Expand Up @@ -108,7 +112,7 @@ xv = ["shm"]
xvmc = ["xv"]

[package.metadata.docs.rs]
features = [ "all-extensions", "allow-unsafe-code", "cursor", "image" ]
features = [ "all-extensions", "allow-unsafe-code", "cursor", "image", "resource_manager" ]

[[example]]
name = "generic_events"
Expand Down
2 changes: 0 additions & 2 deletions src/cursor/find_cursor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::match_like_matches_macro)]

//! Find the right cursor file from a cursor name

// Based on libxcb-cursor's load_cursor.c which has:
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
//! Additionally, the following flags exist:
//! * `allow-unsafe-code`: Enable features that require `unsafe`. Without this flag,
//! `x11rb::xcb_ffi::XCBConnection` and some support code for it are unavailable.
//! * `cursor`: Enable the code in [x11rb::cursor] for loading cursor files.
//! * `resource_manager`: Enable the code in [x11rb::resource_manager] for loading and querying the
//! X11 resource database.
//! * `dl-libxcb`: Enabling this feature will prevent from libxcb being linked to the
//! resulting executable. Instead libxcb will be dynamically loaded at runtime.
//! This feature adds the `x11rb::xcb_ffi::load_libxcb` function, that allows load
Expand Down Expand Up @@ -126,6 +129,8 @@
#![allow(
// This suggests a method that was stabilised in Rust 1.45, while our MSRV is 1.40.
clippy::manual_strip,
// This suggests a macro that was stabilised in Rust 1.42, while our MSRV is 1.40.
clippy::match_like_matches_macro,
)]
#![cfg_attr(not(feature = "allow-unsafe-code"), forbid(unsafe_code))]

Expand All @@ -151,6 +156,8 @@ pub mod wrapper;
#[rustfmt::skip]
#[allow(missing_docs)]
pub mod protocol;
#[cfg(feature = "resource_manager")]
pub mod resource_manager;
#[cfg(test)]
mod test;

Expand Down
Loading