Skip to content

Commit 3d4eb87

Browse files
authored
Merge pull request #218 from psychon/as-raw-xcb-connection
Implement AsRawXcbConnection for Connection
2 parents 126b854 + 4d8ab51 commit 3d4eb87

File tree

3 files changed

+9
-35
lines changed

3 files changed

+9
-35
lines changed

.github/workflows/lint.yml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,3 @@ jobs:
2424
with:
2525
command: fmt
2626
args: --all -- --check
27-
28-
- name: Install dependencies
29-
run: |
30-
sudo apt-get update
31-
sudo apt-get install \
32-
libgl1-mesa-dev \
33-
libxcb-composite0-dev \
34-
libxcb-damage0-dev \
35-
libxcb-dpms0-dev \
36-
libxcb-dri2-0-dev \
37-
libxcb-dri3-dev \
38-
libxcb-glx0-dev \
39-
libxcb-present-dev \
40-
libxcb-randr0-dev \
41-
libxcb-record0-dev \
42-
libxcb-render0-dev \
43-
libxcb-res0-dev \
44-
libxcb-screensaver0-dev \
45-
libxcb-shape0-dev \
46-
libxcb-shm0-dev \
47-
libxcb-sync-dev \
48-
libxcb-xf86dri0-dev \
49-
libxcb-xfixes0-dev \
50-
libxcb-xinerama0-dev \
51-
libxcb-xkb-dev \
52-
libxcb-xtest0-dev \
53-
libxcb-xv0-dev \
54-
libxcb-xvmc0-dev \
55-
libx11-xcb-dev
56-
57-
- name: Run cargo clippy
58-
uses: actions-rs/cargo@v1
59-
with:
60-
command: clippy
61-
args: --all-features -- -D warnings

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ quick-xml = "0.22.0"
2222
[dependencies]
2323
libc = "0.2.102"
2424
bitflags = "1.3.2"
25+
as-raw-xcb-connection = { version = "1.0", optional = true }
2526

2627
[dependencies.x11]
2728
version = "2.19.0"

src/base.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,6 +1636,14 @@ impl AsRawFd for Connection {
16361636
}
16371637
}
16381638

1639+
// SAFETY: We provide a valid xcb_connection_t that is valid for as long as required by the trait.
1640+
#[cfg(feature = "as-raw-xcb-connection")]
1641+
unsafe impl as_raw_xcb_connection::AsRawXcbConnection for Connection {
1642+
fn as_raw_xcb_connection(&self) -> *mut as_raw_xcb_connection::xcb_connection_t {
1643+
self.get_raw_conn().cast()
1644+
}
1645+
}
1646+
16391647
impl Drop for Connection {
16401648
fn drop(&mut self) {
16411649
#[cfg(feature = "debug_atom_names")]

0 commit comments

Comments
 (0)