forked from remacs/remacs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
55 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod display_info; | ||
pub mod frame; | ||
pub mod output; | ||
pub mod term; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use libc; | ||
use std::ptr; | ||
|
||
use crate::{lisp::ExternalPtr, remacs_sys::wr_output}; | ||
|
||
use super::display_info::DisplayInfoRef; | ||
|
||
#[derive(Default)] | ||
pub struct OutputInner { | ||
pub display_info: DisplayInfoRef, | ||
} | ||
|
||
pub type OutputInnerRef = ExternalPtr<OutputInner>; | ||
|
||
pub type Output = wr_output; | ||
impl Output { | ||
pub fn new() -> Self { | ||
let mut output = Output::default(); | ||
|
||
let inner = Box::new(OutputInner::default()); | ||
output.inner = Box::into_raw(inner) as *mut libc::c_void; | ||
|
||
output | ||
} | ||
|
||
pub fn get_inner(&self) -> OutputInnerRef { | ||
OutputInnerRef::new(self.inner as *mut OutputInner) | ||
} | ||
} | ||
|
||
impl Drop for Output { | ||
fn drop(&mut self) { | ||
if self.inner != ptr::null_mut() { | ||
unsafe { | ||
Box::from_raw(self.inner as *mut OutputInner); | ||
} | ||
} | ||
} | ||
} | ||
|
||
pub type OutputRef = ExternalPtr<Output>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters