Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: skip_taskbar for windows #49

Merged
merged 1 commit into from
Feb 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions src/application/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,21 @@ use winit::{
window::{Fullscreen, Icon as WinitIcon, Window, WindowAttributes, WindowBuilder},
};

use std::{collections::HashMap, sync::mpsc::channel};
use std::{collections::HashMap, ptr, sync::mpsc::channel};

#[cfg(target_os = "windows")]
use {
libc::c_void,
winapi::{
shared::windef::HWND,
um::{
combaseapi::{CoCreateInstance, CLSCTX_SERVER},
shobjidl_core::{CLSID_TaskbarList, ITaskbarList},
},
DEFINE_GUID,
},
winit::platform::windows::WindowExtWindows,
};

type EventLoopProxy = winit::event_loop::EventLoopProxy<Message>;

Expand Down Expand Up @@ -255,7 +269,20 @@ fn load_icon(icon: Icon) -> crate::Result<WinitIcon> {

#[cfg(target_os = "windows")]
fn skip_taskbar(_window: &Window) {
// TODO
unsafe {
let mut taskbar_list: *mut ITaskbarList = std::mem::zeroed();
DEFINE_GUID! {IID_ITASKBAR_LIST,
0x56FDF342, 0xfd6d, 0x11d0, 0x95, 0x8a, 0x00, 0x60, 0x97, 0xc9, 0xa0, 0x90}
CoCreateInstance(
&CLSID_TaskbarList,
ptr::null_mut(),
CLSCTX_SERVER,
&IID_ITASKBAR_LIST,
&mut taskbar_list as *mut *mut ITaskbarList as *mut *mut c_void,
);
(&mut *taskbar_list).DeleteTab(_window.hwnd() as HWND);
(&mut *taskbar_list).Release();
}
}

fn _create_window(
Expand Down