|
4 | 4 | //! drawn. A more effective implementation would use shared memory instead of the wire. In
|
5 | 5 | //! addition, we may also want to blit to a pixmap instead of a window.
|
6 | 6 |
|
7 |
| -use crate::SwBufError; |
| 7 | +use crate::SoftBufferError; |
8 | 8 | use raw_window_handle::{XcbDisplayHandle, XcbWindowHandle, XlibDisplayHandle, XlibWindowHandle};
|
9 | 9 | use std::fmt;
|
10 | 10 |
|
@@ -39,15 +39,15 @@ impl X11Impl {
|
39 | 39 | pub unsafe fn from_xlib(
|
40 | 40 | window_handle: XlibWindowHandle,
|
41 | 41 | display_handle: XlibDisplayHandle,
|
42 |
| - ) -> Result<Self, SwBufError> { |
| 42 | + ) -> Result<Self, SoftBufferError> { |
43 | 43 | // TODO: We should cache the shared libraries.
|
44 | 44 |
|
45 | 45 | // Try to open the XlibXCB shared library.
|
46 | 46 | let lib_xcb = Xlib_xcb::open().swbuf_err("Failed to open XlibXCB shared library")?;
|
47 | 47 |
|
48 | 48 | // Validate the display handle to ensure we can use it.
|
49 | 49 | if display_handle.display.is_null() {
|
50 |
| - return Err(SwBufError::IncompleteDisplayHandle); |
| 50 | + return Err(SoftBufferError::IncompleteDisplayHandle); |
51 | 51 | }
|
52 | 52 |
|
53 | 53 | // Get the underlying XCB connection.
|
@@ -76,14 +76,14 @@ impl X11Impl {
|
76 | 76 | pub(crate) unsafe fn from_xcb(
|
77 | 77 | window_handle: XcbWindowHandle,
|
78 | 78 | display_handle: XcbDisplayHandle,
|
79 |
| - ) -> Result<Self, SwBufError> { |
| 79 | + ) -> Result<Self, SoftBufferError> { |
80 | 80 | // Check that the handles are valid.
|
81 | 81 | if display_handle.connection.is_null() {
|
82 |
| - return Err(SwBufError::IncompleteDisplayHandle); |
| 82 | + return Err(SoftBufferError::IncompleteDisplayHandle); |
83 | 83 | }
|
84 | 84 |
|
85 | 85 | if window_handle.window == 0 {
|
86 |
| - return Err(SwBufError::IncompleteWindowHandle); |
| 86 | + return Err(SoftBufferError::IncompleteWindowHandle); |
87 | 87 | }
|
88 | 88 |
|
89 | 89 | // Wrap the display handle in an x11rb connection.
|
@@ -160,15 +160,15 @@ impl Drop for X11Impl {
|
160 | 160 | }
|
161 | 161 | }
|
162 | 162 |
|
163 |
| -/// Convenient wrapper to cast errors into SwBufError. |
| 163 | +/// Convenient wrapper to cast errors into SoftBufferError. |
164 | 164 | trait ResultExt<T, E> {
|
165 |
| - fn swbuf_err(self, msg: impl Into<String>) -> Result<T, SwBufError>; |
| 165 | + fn swbuf_err(self, msg: impl Into<String>) -> Result<T, SoftBufferError>; |
166 | 166 | }
|
167 | 167 |
|
168 | 168 | impl<T, E: fmt::Debug + fmt::Display + 'static> ResultExt<T, E> for Result<T, E> {
|
169 |
| - fn swbuf_err(self, msg: impl Into<String>) -> Result<T, SwBufError> { |
| 169 | + fn swbuf_err(self, msg: impl Into<String>) -> Result<T, SoftBufferError> { |
170 | 170 | self.map_err(|e| {
|
171 |
| - SwBufError::PlatformError(Some(msg.into()), Some(Box::new(LibraryError(e)))) |
| 171 | + SoftBufferError::PlatformError(Some(msg.into()), Some(Box::new(LibraryError(e)))) |
172 | 172 | })
|
173 | 173 | }
|
174 | 174 | }
|
|
0 commit comments