Make with_x11_visual take ID instead of a pointer
At the moment, the with_x11_visual function takes a pointer and immediately dereferences it to get the visual info inside. As it is safe to pass a null pointer to this function, it is unsound. This commit replaces the pointer parameter with a visual ID, and then uses that ID to look up the actual visual under the X11 setup. As this is what was already practically happening before, this change shouldn't cause any performance downgrades. This is a breaking change, but it's done in the name of soundness so it should be okay. It should be trivial for end users to accommodate it, as it's just a matter of getting the visual ID from the pointer to the visual before passing it in. Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
parent
8100a6a584
commit
584aab4cd0
5 changed files with 56 additions and 31 deletions
|
|
@ -24,7 +24,7 @@ use std::time::Duration;
|
|||
#[cfg(x11_platform)]
|
||||
pub use self::x11::XNotSupported;
|
||||
#[cfg(x11_platform)]
|
||||
use self::x11::{ffi::XVisualInfo, util::WindowType as XWindowType, X11Error, XConnection, XError};
|
||||
use self::x11::{util::WindowType as XWindowType, X11Error, XConnection, XError};
|
||||
#[cfg(x11_platform)]
|
||||
use crate::platform::x11::XlibErrorHook;
|
||||
use crate::{
|
||||
|
|
@ -96,7 +96,7 @@ pub struct PlatformSpecificWindowBuilderAttributes {
|
|||
pub name: Option<ApplicationName>,
|
||||
pub activation_token: Option<ActivationToken>,
|
||||
#[cfg(x11_platform)]
|
||||
pub visual_infos: Option<XVisualInfo>,
|
||||
pub visual_id: Option<x11rb::protocol::xproto::Visualid>,
|
||||
#[cfg(x11_platform)]
|
||||
pub screen_id: Option<i32>,
|
||||
#[cfg(x11_platform)]
|
||||
|
|
@ -113,7 +113,7 @@ impl Default for PlatformSpecificWindowBuilderAttributes {
|
|||
name: None,
|
||||
activation_token: None,
|
||||
#[cfg(x11_platform)]
|
||||
visual_infos: None,
|
||||
visual_id: None,
|
||||
#[cfg(x11_platform)]
|
||||
screen_id: None,
|
||||
#[cfg(x11_platform)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue