virtual display: win10 debug windows.
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
1eb696356e
commit
957eabcef0
@ -97,6 +97,9 @@ pub fn is_device_created() -> bool {
|
|||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub fn create_device() -> ResultType<()> {
|
pub fn create_device() -> ResultType<()> {
|
||||||
|
if is_device_created() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut h_sw_device = *H_SW_DEVICE.lock().unwrap() as win10::idd::HSWDEVICE;
|
let mut h_sw_device = *H_SW_DEVICE.lock().unwrap() as win10::idd::HSWDEVICE;
|
||||||
if win10::idd::DeviceCreate(&mut h_sw_device) == win10::idd::FALSE {
|
if win10::idd::DeviceCreate(&mut h_sw_device) == win10::idd::FALSE {
|
||||||
|
@ -122,9 +122,42 @@ impl VideoFrameController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new() -> GenericService {
|
#[derive(Clone)]
|
||||||
let sp = GenericService::new(NAME, true);
|
pub struct VideoService(GenericService);
|
||||||
sp.run(run);
|
|
||||||
|
impl Service for VideoService {
|
||||||
|
fn name(&self) -> &'static str {
|
||||||
|
self.0.name()
|
||||||
|
}
|
||||||
|
fn on_subscribe(&self, sub: ConnInner) {
|
||||||
|
self.0.on_subscribe(sub)
|
||||||
|
}
|
||||||
|
fn on_unsubscribe(&self, id: i32) {
|
||||||
|
self.0.on_unsubscribe(id)
|
||||||
|
}
|
||||||
|
fn is_subed(&self, id: i32) -> bool {
|
||||||
|
self.0.is_subed(id)
|
||||||
|
}
|
||||||
|
fn join(&self) {
|
||||||
|
self.0.join()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for VideoService {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
#[cfg(windows)]
|
||||||
|
virtual_display::close_device()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new() -> VideoService {
|
||||||
|
let sp = VideoService(GenericService::new(NAME, true));
|
||||||
|
#[cfg(windows)]
|
||||||
|
if let Err(e) = virtual_display::create_device() {
|
||||||
|
log::error!("create device failed {}", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
sp.0.run(run);
|
||||||
sp
|
sp
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,13 +481,15 @@ fn get_current_display() -> ResultType<(usize, usize, Display)> {
|
|||||||
let mut displays = Display::all()?;
|
let mut displays = Display::all()?;
|
||||||
if displays.len() == 0 {
|
if displays.len() == 0 {
|
||||||
// try plugin monitor
|
// try plugin monitor
|
||||||
|
#[cfg(windows)]
|
||||||
if virtual_display::is_device_created() {
|
if virtual_display::is_device_created() {
|
||||||
if let Err(e) = virtual_display::plug_in_monitor() {
|
if let Err(e) = virtual_display::plug_in_monitor() {
|
||||||
log::error!("plug in monitor failed {}", e)
|
log::error!("plug in monitor failed {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bail!("No displays");
|
bail!("No displays");
|
||||||
}
|
}
|
||||||
|
|
||||||
let n = displays.len();
|
let n = displays.len();
|
||||||
if current >= n {
|
if current >= n {
|
||||||
current = 0;
|
current = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user