windows_composition/
stack.rs1use super::*;
2
3pub struct DispatcherQueueController(
8 #[expect(
9 dead_code,
10 reason = "held only to keep the dispatcher queue alive on this thread"
11 )]
12 bindings::DispatcherQueueController,
13);
14
15impl DispatcherQueueController {
16 pub fn create_on_current_thread() -> Result<Self> {
19 let options = bindings::DispatcherQueueOptions {
20 dwSize: size_of::<bindings::DispatcherQueueOptions>() as u32,
21 threadType: bindings::DQTYPE_THREAD_CURRENT,
22 apartmentType: bindings::DQTAT_COM_ASTA,
23 };
24
25 unsafe {
26 let mut controller = core::ptr::null_mut();
27 bindings::CreateDispatcherQueueController(options, &mut controller).ok()?;
28 Ok(Self(bindings::DispatcherQueueController::from_raw(
29 controller,
30 )))
31 }
32 }
33}