mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2025-01-26 02:36:32 +11:00
posix displayhandle
This commit is contained in:
parent
a8d6d94726
commit
467ad2666f
2 changed files with 18 additions and 2 deletions
|
@ -1267,6 +1267,14 @@ unsafe impl raw_window_handle::HasRawWindowHandle for Window {
|
||||||
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
|
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
|
||||||
let mut handle = raw_window_handle::WaylandWindowHandle::empty();
|
let mut handle = raw_window_handle::WaylandWindowHandle::empty();
|
||||||
handle.surface = self.display.surface.as_ref().c_ptr() as *mut _ as *mut c_void;
|
handle.surface = self.display.surface.as_ref().c_ptr() as *mut _ as *mut c_void;
|
||||||
|
|
||||||
|
raw_window_handle::RawWindowHandle::Wayland(handle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl raw_window_handle::HasRawDisplayHandle for Window {
|
||||||
|
fn raw_display_handle(&self) -> raw_window_handle::RawDisplayHandle {
|
||||||
|
let mut handle = WaylandDisplayHandle::empty();
|
||||||
handle.display = self
|
handle.display = self
|
||||||
.display
|
.display
|
||||||
.attached_display
|
.attached_display
|
||||||
|
@ -1275,7 +1283,7 @@ unsafe impl raw_window_handle::HasRawWindowHandle for Window {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.c_ptr() as *mut _ as *mut c_void;
|
.c_ptr() as *mut _ as *mut c_void;
|
||||||
|
|
||||||
raw_window_handle::RawWindowHandle::Wayland(handle)
|
RawDisplayHandle::Wayland(handle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -334,11 +334,19 @@ unsafe impl raw_window_handle::HasRawWindowHandle for Window {
|
||||||
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
|
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
|
||||||
let mut handle = raw_window_handle::XlibWindowHandle::empty();
|
let mut handle = raw_window_handle::XlibWindowHandle::empty();
|
||||||
handle.window = self.handle;
|
handle.window = self.handle;
|
||||||
handle.display = self.d.display as *mut core::ffi::c_void;
|
|
||||||
raw_window_handle::RawWindowHandle::Xlib(handle)
|
raw_window_handle::RawWindowHandle::Xlib(handle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe impl HasRawDisplayHandle for Window {
|
||||||
|
fn raw_display_handle(&self) -> raw_window_handle::RawDisplayHandle {
|
||||||
|
let mut handle = raw_window_handle::XlibDisplayHandle::empty();
|
||||||
|
handle.display = self.d.display as *mut core::ffi::c_void;
|
||||||
|
|
||||||
|
RawDisplayHandle::Xlib(handle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
pub fn new(name: &str, width: usize, height: usize, opts: WindowOptions) -> Result<Window> {
|
pub fn new(name: &str, width: usize, height: usize, opts: WindowOptions) -> Result<Window> {
|
||||||
let name = match CString::new(name) {
|
let name = match CString::new(name) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue