Skip to content

Commit

Permalink
deps: update windows dep to 0.4 -> 0.9
Browse files Browse the repository at this point in the history
dependabot keeps trying and failing because lots of things changed.
Let's try and get ahead of it...
  • Loading branch information
wez committed May 4, 2021
1 parent e400f2f commit d64b785
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 101 deletions.
94 changes: 11 additions & 83 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions wezterm-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ anyhow = "1.0"
[target.'cfg(windows)'.build-dependencies]
embed-resource = "1.3"
cc = "1.0"
windows = "0.5"
windows = "0.9"

[dependencies]
anyhow = "1.0"
Expand Down Expand Up @@ -73,7 +73,7 @@ window = { path = "../window", features=["wayland"]}

[target."cfg(windows)".dependencies]
shared_library = "0.1"
windows = "0.5"
windows = "0.9"
winapi = { version = "0.3", features = [
"winuser",
"consoleapi",
Expand Down
2 changes: 1 addition & 1 deletion wezterm-gui/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ END
}
embed_resource::compile(rcfile_name);

windows::build!(windows::win32::shell::SetCurrentProcessExplicitAppUserModelID);
windows::build!(Windows::Win32::Shell::SetCurrentProcessExplicitAppUserModelID);
}

#[cfg(target_os = "macos")]
Expand Down
2 changes: 1 addition & 1 deletion wezterm-gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ pub fn run_ls_fonts(config: config::ConfigHandle, _cmd: &LsFontsCommand) -> anyh
#[cfg(windows)]
mod win_bindings {
::windows::include_bindings!();
pub use self::windows::win32::shell::SetCurrentProcessExplicitAppUserModelID;
pub use self::Windows::Win32::Shell::SetCurrentProcessExplicitAppUserModelID;
}

fn run() -> anyhow::Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions wezterm-toast-notification/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ core-foundation = "0.7"
objc = "0.2"

[target.'cfg(windows)'.dependencies]
windows = "0.4"
windows = "0.9"
xml-rs = "0.8"

[target.'cfg(windows)'.build-dependencies]
windows = "0.4"
windows = "0.9"
7 changes: 4 additions & 3 deletions wezterm-toast-notification/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ fn main() {
#[cfg(windows)]
{
windows::build!(
windows::data::xml::dom::XmlDocument,
windows::foundation::*,
windows::ui::notifications::*,
Windows::Data::Xml::Dom::XmlDocument,
Windows::Foundation::*,
Windows::UI::Notifications::*,
Windows::Win32::SystemServices::E_POINTER,
);
}
}
17 changes: 8 additions & 9 deletions wezterm-toast-notification/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ mod bindings {
}

use bindings::{
windows::data::xml::dom::XmlDocument, windows::foundation::*, windows::ui::notifications::*,
Windows::Data::Xml::Dom::XmlDocument, Windows::Foundation::*, Windows::UI::Notifications::*,
};
use windows::{Error as WinError, Interface, Object};

fn unwrap_arg<T>(a: &Option<T>) -> Result<&T, WinError> {
match a {
Some(t) => Ok(t),
None => Err(WinError::new(
::windows::ErrorCode::E_POINTER,
crate::windows::bindings::Windows::Win32::SystemServices::E_POINTER,
"option is none",
)),
}
Expand All @@ -36,7 +36,7 @@ fn show_notif_impl(toast: TN) -> Result<(), Box<dyn std::error::Error>> {
""
};

xml.load_xml(format!(
xml.LoadXml(format!(
r#"<toast duration="long">
<visual>
<binding template="ToastGeneric">
Expand All @@ -51,14 +51,14 @@ fn show_notif_impl(toast: TN) -> Result<(), Box<dyn std::error::Error>> {
url_actions
))?;

let notif = ToastNotification::create_toast_notification(xml)?;
let notif = ToastNotification::CreateToastNotification(xml)?;

notif.activated(TypedEventHandler::new(
notif.Activated(TypedEventHandler::new(
move |_: &Option<ToastNotification>, result: &Option<Object>| {
// let myself = unwrap_arg(myself)?;
let result = unwrap_arg(result)?.cast::<ToastActivatedEventArgs>()?;

let args = result.arguments()?;
let args = result.Arguments()?;

if args == "show" {
if let Some(url) = toast.url.as_ref() {
Expand All @@ -82,10 +82,9 @@ fn show_notif_impl(toast: TN) -> Result<(), Box<dyn std::error::Error>> {
}))?;
*/

let notifier =
ToastNotificationManager::create_toast_notifier_with_id("org.wezfurlong.wezterm")?;
let notifier = ToastNotificationManager::CreateToastNotifierWithId("org.wezfurlong.wezterm")?;

notifier.show(&notif)?;
notifier.Show(&notif)?;

Ok(())
}
Expand Down

0 comments on commit d64b785

Please sign in to comment.