Updated winapi dependency

This commit is contained in:
Antoine Gersant 2018-01-06 14:31:48 -08:00
parent 718151e3cb
commit da01a3f8c2
4 changed files with 95 additions and 120 deletions

65
Cargo.lock generated
View file

@ -697,15 +697,6 @@ dependencies = [
"rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "git+https://github.com/retep998/winapi-rs?branch=0.2#77588710a683e1a4ec085b0f3d6c8939ecc7f030"
dependencies = [
"winapi 0.2.8 (git+https://github.com/retep998/winapi-rs?branch=0.2)",
"winapi-build 0.1.1 (git+https://github.com/retep998/winapi-rs?branch=0.2)",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
@ -1186,7 +1177,6 @@ dependencies = [
"id3 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (git+https://github.com/retep998/winapi-rs?branch=0.2)",
"lewton 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"metaflac 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1203,16 +1193,14 @@ dependencies = [
"serde 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"shell32-sys 0.1.1 (git+https://github.com/retep998/winapi-rs?branch=0.2)",
"simplelog 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"staticfile 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"unix-daemonize 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"user32-sys 0.2.0 (git+https://github.com/retep998/winapi-rs?branch=0.2)",
"uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (git+https://github.com/retep998/winapi-rs?branch=0.2)",
"winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1515,15 +1503,6 @@ dependencies = [
"url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "shell32-sys"
version = "0.1.1"
source = "git+https://github.com/retep998/winapi-rs?branch=0.2#77588710a683e1a4ec085b0f3d6c8939ecc7f030"
dependencies = [
"winapi 0.2.8 (git+https://github.com/retep998/winapi-rs?branch=0.2)",
"winapi-build 0.1.1 (git+https://github.com/retep998/winapi-rs?branch=0.2)",
]
[[package]]
name = "shell32-sys"
version = "0.1.1"
@ -1811,15 +1790,6 @@ dependencies = [
"url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "user32-sys"
version = "0.2.0"
source = "git+https://github.com/retep998/winapi-rs?branch=0.2#77588710a683e1a4ec085b0f3d6c8939ecc7f030"
dependencies = [
"winapi 0.2.8 (git+https://github.com/retep998/winapi-rs?branch=0.2)",
"winapi-build 0.1.1 (git+https://github.com/retep998/winapi-rs?branch=0.2)",
]
[[package]]
name = "utf8-ranges"
version = "1.0.0"
@ -1845,26 +1815,35 @@ name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi"
version = "0.2.8"
source = "git+https://github.com/retep998/winapi-rs?branch=0.2#77588710a683e1a4ec085b0f3d6c8939ecc7f030"
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "git+https://github.com/retep998/winapi-rs?branch=0.2#77588710a683e1a4ec085b0f3d6c8939ecc7f030"
name = "winapi"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi-i686-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-x86_64-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ws2_32-sys"
version = "0.2.1"
@ -1962,7 +1941,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1"
"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
"checksum jpeg-decoder 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2805ccb10ffe4d10e06ef68a158ff94c255211ecbae848fbde2146b098f93ce7"
"checksum kernel32-sys 0.2.2 (git+https://github.com/retep998/winapi-rs?branch=0.2)" = "<none>"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
@ -2051,7 +2029,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum serde_json 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "67f7d2e9edc3523a9c8ec8cd6ec481b3a27810aafee3e625d311febd3e656b4c"
"checksum serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7cf5b0b5b4bd22eeecb7e01ac2e1225c7ef5e4272b79ee28a8392a8c8489c839"
"checksum serde_urlencoded 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce0fd303af908732989354c6f02e05e2e6d597152870f2c6990efb0577137480"
"checksum shell32-sys 0.1.1 (git+https://github.com/retep998/winapi-rs?branch=0.2)" = "<none>"
"checksum shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72f20b8f3c060374edb8046591ba28f62448c369ccbdc7b02075103fb3a9e38d"
"checksum simplelog 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "24b615b1a3cc51ffa565d9a1d0cfcc49fe7d64737ada84eca284cddb0292d125"
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
@ -2087,15 +2064,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f392d7819dbe58833e26872f5f6f0d68b7bbbe90fc3667e98731c4a15ad9a7ae"
"checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2"
"checksum urlencoded 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8c28708636d6f7298a53b1cdb6af40f1ab523209a7cb83cf4d41b3ebc671d319"
"checksum user32-sys 0.2.0 (git+https://github.com/retep998/winapi-rs?branch=0.2)" = "<none>"
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
"checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22"
"checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b"
"checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum winapi 0.2.8 (git+https://github.com/retep998/winapi-rs?branch=0.2)" = "<none>"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (git+https://github.com/retep998/winapi-rs?branch=0.2)" = "<none>"
"checksum winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b09fb3b6f248ea4cd42c9a65113a847d612e17505d6ebd1f7357ad68a8bf8693"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum winapi-i686-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ec6667f60c23eca65c561e63a13d81b44234c2e38a6b6c959025ee907ec614cc"
"checksum winapi-x86_64-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98f12c52b2630cd05d2c3ffd8e008f7f48252c042b4871c72aed9dc733b96668"
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
"checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61"

View file

@ -44,11 +44,11 @@ version = "0.12.0"
features = ["bundled"]
[target.'cfg(windows)'.dependencies]
winapi = { git = "https://github.com/retep998/winapi-rs", branch="0.2" }
kernel32-sys = { git = "https://github.com/retep998/winapi-rs", branch="0.2" }
shell32-sys = { git = "https://github.com/retep998/winapi-rs", branch="0.2" }
user32-sys = { git = "https://github.com/retep998/winapi-rs", branch="0.2" }
uuid = "0.5.0"
[target.'cfg(windows)'.dependencies.winapi]
version = "0.3.3"
features = ["winuser", "libloaderapi", "shellapi", "errhandlingapi"]
[target.'cfg(unix)'.dependencies]
unix-daemonize = "0.1.2"

View file

@ -43,12 +43,6 @@ extern crate simplelog;
extern crate uuid;
#[cfg(windows)]
extern crate winapi;
#[cfg(windows)]
extern crate kernel32;
#[cfg(windows)]
extern crate shell32;
#[cfg(windows)]
extern crate user32;
#[cfg(unix)]
extern crate unix_daemonize;

View file

@ -1,16 +1,13 @@
use kernel32;
use shell32;
use std;
use std::ffi::OsStr;
use std::os::windows::ffi::OsStrExt;
use user32;
use uuid;
use winapi;
const IDI_POLARIS_TRAY: isize = 0x102;
const UID_NOTIFICATION_ICON: u32 = 0;
const MESSAGE_NOTIFICATION_ICON: u32 = winapi::WM_USER + 1;
const MESSAGE_NOTIFICATION_ICON_QUIT: u32 = winapi::WM_USER + 2;
const MESSAGE_NOTIFICATION_ICON: u32 = winapi::um::winuser::WM_USER + 1;
const MESSAGE_NOTIFICATION_ICON_QUIT: u32 = winapi::um::winuser::WM_USER + 2;
pub trait ToWin {
type Out;
@ -29,14 +26,14 @@ impl<'a> ToWin for &'a str {
}
impl ToWin for uuid::Uuid {
type Out = winapi::GUID;
type Out = winapi::shared::guiddef::GUID;
fn to_win(&self) -> Self::Out {
let bytes = self.as_bytes();
let end = [bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14],
bytes[15]];
winapi::GUID {
winapi::shared::guiddef::GUID {
Data1: ((bytes[0] as u32) << 24 | (bytes[1] as u32) << 16 | (bytes[2] as u32) << 8 |
(bytes[3] as u32)),
Data2: ((bytes[4] as u16) << 8 | (bytes[5] as u16)),
@ -51,12 +48,19 @@ pub trait Constructible {
fn new() -> Self::Out;
}
impl Constructible for winapi::NOTIFYICONDATAW {
type Out = winapi::NOTIFYICONDATAW;
impl Constructible for winapi::um::shellapi::NOTIFYICONDATAW {
type Out = winapi::um::shellapi::NOTIFYICONDATAW;
fn new() -> Self::Out {
winapi::NOTIFYICONDATAW {
cbSize: std::mem::size_of::<winapi::NOTIFYICONDATAW>() as u32,
let mut version_union: winapi::um::shellapi::NOTIFYICONDATAW_u = unsafe { std::mem::zeroed() };
unsafe {
let version = version_union.uVersion_mut();
*version = winapi::um::shellapi::NOTIFYICON_VERSION_4;
}
winapi::um::shellapi::NOTIFYICONDATAW {
cbSize: std::mem::size_of::<winapi::um::shellapi::NOTIFYICONDATAW>() as u32,
hWnd: std::ptr::null_mut(),
uFlags: 0,
guidItem: uuid::Uuid::nil().to_win(),
@ -67,7 +71,7 @@ impl Constructible for winapi::NOTIFYICONDATAW {
dwState: 0,
dwStateMask: 0,
szInfo: [0; 256],
uTimeout: winapi::NOTIFYICON_VERSION_4,
u: version_union,
szInfoTitle: [0; 64],
dwInfoFlags: 0,
hBalloonIcon: std::ptr::null_mut(),
@ -75,40 +79,40 @@ impl Constructible for winapi::NOTIFYICONDATAW {
}
}
fn create_window() -> Option<winapi::HWND> {
fn create_window() -> Option<winapi::shared::windef::HWND> {
let class_name = "Polaris-class".to_win();
let window_name = "Polaris-window".to_win();
unsafe {
let module_handle = kernel32::GetModuleHandleW(std::ptr::null());
let wnd = winapi::WNDCLASSW {
let module_handle = winapi::um::libloaderapi::GetModuleHandleW(std::ptr::null());
let wnd = winapi::um::winuser::WNDCLASSW {
style: 0,
lpfnWndProc: Some(window_proc),
hInstance: module_handle,
hIcon: std::ptr::null_mut(),
hCursor: std::ptr::null_mut(),
lpszClassName: class_name.as_ptr(),
hbrBackground: winapi::COLOR_WINDOW as winapi::HBRUSH,
hbrBackground: winapi::um::winuser::COLOR_WINDOW as winapi::shared::windef::HBRUSH,
lpszMenuName: std::ptr::null_mut(),
cbClsExtra: 0,
cbWndExtra: 0,
};
let atom = user32::RegisterClassW(&wnd);
let atom = winapi::um::winuser::RegisterClassW(&wnd);
if atom == 0 {
return None;
}
let window_handle = user32::CreateWindowExW(0,
atom as winapi::LPCWSTR,
let window_handle = winapi::um::winuser::CreateWindowExW(0,
atom as winapi::shared::ntdef::LPCWSTR,
window_name.as_ptr(),
winapi::WS_DISABLED,
winapi::um::winuser::WS_DISABLED,
0,
0,
0,
0,
user32::GetDesktopWindow(),
winapi::um::winuser::GetDesktopWindow(),
std::ptr::null_mut(),
std::ptr::null_mut(),
std::ptr::null_mut());
@ -121,22 +125,22 @@ fn create_window() -> Option<winapi::HWND> {
}
}
fn add_notification_icon(window: winapi::HWND) {
fn add_notification_icon(window: winapi::shared::windef::HWND) {
let mut tooltip = [0 as winapi::WCHAR; 128];
let mut tooltip = [0 as winapi::um::winnt::WCHAR; 128];
for (&x, p) in "Polaris".to_win().iter().zip(tooltip.iter_mut()) {
*p = x;
}
unsafe {
let module = kernel32::GetModuleHandleW(std::ptr::null());
let icon = user32::LoadIconW(module, std::mem::transmute(IDI_POLARIS_TRAY));
let mut flags = winapi::NIF_MESSAGE | winapi::NIF_TIP;
let module = winapi::um::libloaderapi::GetModuleHandleW(std::ptr::null());
let icon = winapi::um::winuser::LoadIconW(module, std::mem::transmute(IDI_POLARIS_TRAY));
let mut flags = winapi::um::shellapi::NIF_MESSAGE | winapi::um::shellapi::NIF_TIP;
if !icon.is_null() {
flags |= winapi::NIF_ICON;
flags |= winapi::um::shellapi::NIF_ICON;
}
let mut icon_data = winapi::NOTIFYICONDATAW::new();
let mut icon_data = winapi::um::shellapi::NOTIFYICONDATAW::new();
icon_data.hWnd = window;
icon_data.uID = UID_NOTIFICATION_ICON;
icon_data.uFlags = flags;
@ -144,58 +148,58 @@ fn add_notification_icon(window: winapi::HWND) {
icon_data.uCallbackMessage = MESSAGE_NOTIFICATION_ICON;
icon_data.szTip = tooltip;
shell32::Shell_NotifyIconW(winapi::NIM_ADD, &mut icon_data);
winapi::um::shellapi::Shell_NotifyIconW(winapi::um::shellapi::NIM_ADD, &mut icon_data);
}
}
fn remove_notification_icon(window: winapi::HWND) {
let mut icon_data = winapi::NOTIFYICONDATAW::new();
fn remove_notification_icon(window: winapi::shared::windef::HWND) {
let mut icon_data = winapi::um::shellapi::NOTIFYICONDATAW::new();
icon_data.hWnd = window;
icon_data.uID = UID_NOTIFICATION_ICON;
unsafe {
shell32::Shell_NotifyIconW(winapi::NIM_DELETE, &mut icon_data);
winapi::um::shellapi::Shell_NotifyIconW(winapi::um::shellapi::NIM_DELETE, &mut icon_data);
}
}
fn open_notification_context_menu(window: winapi::HWND) {
fn open_notification_context_menu(window: winapi::shared::windef::HWND) {
info!("Opening notification icon context menu");
let quit_string = "Quit Polaris".to_win();
unsafe {
let context_menu = user32::CreatePopupMenu();
let context_menu = winapi::um::winuser::CreatePopupMenu();
if context_menu.is_null() {
return;
}
user32::InsertMenuW(context_menu,
winapi::um::winuser::InsertMenuW(context_menu,
0,
winapi::winuser::MF_STRING,
MESSAGE_NOTIFICATION_ICON_QUIT as u64,
winapi::um::winuser::MF_STRING,
MESSAGE_NOTIFICATION_ICON_QUIT as usize,
quit_string.as_ptr());
let mut cursor_position = winapi::POINT { x: 0, y: 0 };
user32::GetCursorPos(&mut cursor_position);
let mut cursor_position = winapi::shared::windef::POINT { x: 0, y: 0 };
winapi::um::winuser::GetCursorPos(&mut cursor_position);
user32::SetForegroundWindow(window);
let flags = winapi::winuser::TPM_RIGHTALIGN | winapi::winuser::TPM_BOTTOMALIGN |
winapi::winuser::TPM_RIGHTBUTTON;
user32::TrackPopupMenu(context_menu,
winapi::um::winuser::SetForegroundWindow(window);
let flags = winapi::um::winuser::TPM_RIGHTALIGN | winapi::um::winuser::TPM_BOTTOMALIGN |
winapi::um::winuser::TPM_RIGHTBUTTON;
winapi::um::winuser::TrackPopupMenu(context_menu,
flags,
cursor_position.x,
cursor_position.y,
0,
window,
std::ptr::null_mut());
user32::PostMessageW(window, 0, 0, 0);
winapi::um::winuser::PostMessageW(window, 0, 0, 0);
info!("Closing notification context menu");
user32::DestroyMenu(context_menu);
winapi::um::winuser::DestroyMenu(context_menu);
}
}
fn quit(window: winapi::HWND) {
fn quit(window: winapi::shared::windef::HWND) {
info!("Shutting down UI");
unsafe {
user32::PostMessageW(window, winapi::winuser::WM_CLOSE, 0, 0);
winapi::um::winuser::PostMessageW(window, winapi::um::winuser::WM_CLOSE, 0, 0);
}
}
@ -204,53 +208,53 @@ pub fn run() {
create_window().expect("Could not initialize window");
let mut message = winapi::MSG {
let mut message = winapi::um::winuser::MSG {
hwnd: std::ptr::null_mut(),
message: 0,
wParam: 0,
lParam: 0,
time: 0,
pt: winapi::POINT { x: 0, y: 0 },
pt: winapi::shared::windef::POINT { x: 0, y: 0 },
};
loop {
let status: i32;
unsafe {
status = user32::GetMessageW(&mut message, std::ptr::null_mut(), 0, 0);
status = winapi::um::winuser::GetMessageW(&mut message, std::ptr::null_mut(), 0, 0);
if status == -1 {
panic!("GetMessageW error: {}", kernel32::GetLastError());
panic!("GetMessageW error: {}", winapi::um::errhandlingapi::GetLastError());
}
if status == 0 {
break;
}
user32::TranslateMessage(&message);
user32::DispatchMessageW(&message);
winapi::um::winuser::TranslateMessage(&message);
winapi::um::winuser::DispatchMessageW(&message);
}
}
}
pub unsafe extern "system" fn window_proc(window: winapi::HWND,
msg: winapi::UINT,
w_param: winapi::WPARAM,
l_param: winapi::LPARAM)
-> winapi::LRESULT {
pub unsafe extern "system" fn window_proc(window: winapi::shared::windef::HWND,
msg: winapi::shared::minwindef::UINT,
w_param: winapi::shared::minwindef::WPARAM,
l_param: winapi::shared::minwindef::LPARAM)
-> winapi::shared::minwindef::LRESULT {
match msg {
winapi::winuser::WM_CREATE => {
winapi::um::winuser::WM_CREATE => {
add_notification_icon(window);
}
MESSAGE_NOTIFICATION_ICON => {
match winapi::LOWORD(l_param as winapi::DWORD) as u32 {
winapi::winuser::WM_RBUTTONUP => {
match winapi::shared::minwindef::LOWORD(l_param as winapi::shared::minwindef::DWORD) as u32 {
winapi::um::winuser::WM_RBUTTONUP => {
open_notification_context_menu(window);
}
_ => (),
}
}
winapi::winuser::WM_COMMAND => {
match winapi::LOWORD(w_param as winapi::DWORD) as u32 {
winapi::um::winuser::WM_COMMAND => {
match winapi::shared::minwindef::LOWORD(w_param as winapi::shared::minwindef::DWORD) as u32 {
MESSAGE_NOTIFICATION_ICON_QUIT => {
quit(window);
}
@ -258,13 +262,13 @@ pub unsafe extern "system" fn window_proc(window: winapi::HWND,
}
}
winapi::winuser::WM_DESTROY => {
winapi::um::winuser::WM_DESTROY => {
remove_notification_icon(window);
user32::PostQuitMessage(0);
winapi::um::winuser::PostQuitMessage(0);
}
_ => (),
};
return user32::DefWindowProcW(window, msg, w_param, l_param);
return winapi::um::winuser::DefWindowProcW(window, msg, w_param, l_param);
}