aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src
diff options
context:
space:
mode:
authorkillian <killiancharrier8@gmail.com>2022-09-30 13:49:02 +0200
committerGitHub <noreply@github.com>2022-09-30 11:49:02 +0000
commite9ee8dcd9f53096a0096c01b5027d7584376cbd2 (patch)
tree4163304f1e99f878bef7ff5a451f88c8c9571548 /alacritty/src
parentc5ae05e810a5866a9133b2e88edba3a42706319f (diff)
downloadr-alacritty-e9ee8dcd9f53096a0096c01b5027d7584376cbd2.tar.gz
r-alacritty-e9ee8dcd9f53096a0096c01b5027d7584376cbd2.tar.bz2
r-alacritty-e9ee8dcd9f53096a0096c01b5027d7584376cbd2.zip
Migrate from winapi to windows-sys
Diffstat (limited to 'alacritty/src')
-rw-r--r--alacritty/src/daemon.rs2
-rw-r--r--alacritty/src/display/window.rs4
-rw-r--r--alacritty/src/main.rs2
-rw-r--r--alacritty/src/panic.rs15
4 files changed, 10 insertions, 13 deletions
diff --git a/alacritty/src/daemon.rs b/alacritty/src/daemon.rs
index 730a2cc7..df66646a 100644
--- a/alacritty/src/daemon.rs
+++ b/alacritty/src/daemon.rs
@@ -18,7 +18,7 @@ use {
#[cfg(not(windows))]
use libc::pid_t;
#[cfg(windows)]
-use winapi::um::winbase::{CREATE_NEW_PROCESS_GROUP, CREATE_NO_WINDOW};
+use windows_sys::Win32::System::Threading::{CREATE_NEW_PROCESS_GROUP, CREATE_NO_WINDOW};
#[cfg(target_os = "macos")]
use crate::macos;
diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs
index 95b42345..6c88f56f 100644
--- a/alacritty/src/display/window.rs
+++ b/alacritty/src/display/window.rs
@@ -47,8 +47,6 @@ use glutin::{self, ContextBuilder, PossiblyCurrent, Rect, WindowedContext};
use objc::{msg_send, sel, sel_impl};
#[cfg(target_os = "macos")]
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
-#[cfg(windows)]
-use winapi::shared::minwindef::WORD;
use alacritty_terminal::index::Point;
@@ -63,7 +61,7 @@ static WINDOW_ICON: &[u8] = include_bytes!("../../extra/logo/compat/alacritty-te
/// This should match the definition of IDI_ICON from `alacritty.rc`.
#[cfg(windows)]
-const IDI_ICON: WORD = 0x101;
+const IDI_ICON: u16 = 0x101;
/// Context creation flags from probing config.
static GL_CONTEXT_CREATION_FLAGS: AtomicU8 = AtomicU8::new(GlContextFlags::SRGB.bits);
diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs
index 2e7c30a9..569ed30e 100644
--- a/alacritty/src/main.rs
+++ b/alacritty/src/main.rs
@@ -25,7 +25,7 @@ use glutin::event_loop::EventLoopBuilder as GlutinEventLoopBuilder;
use glutin::platform::unix::EventLoopWindowTargetExtUnix;
use log::info;
#[cfg(windows)]
-use winapi::um::wincon::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS};
+use windows_sys::Win32::System::Console::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS};
use alacritty_terminal::tty;
diff --git a/alacritty/src/panic.rs b/alacritty/src/panic.rs
index 2311d7b9..2637f8d6 100644
--- a/alacritty/src/panic.rs
+++ b/alacritty/src/panic.rs
@@ -1,7 +1,9 @@
use std::io::Write;
-use std::{io, panic, ptr};
+use std::{io, panic};
-use winapi::um::winuser;
+use windows_sys::Win32::UI::WindowsAndMessaging::{
+ MessageBoxW, MB_ICONERROR, MB_OK, MB_SETFOREGROUND, MB_TASKMODAL,
+};
use alacritty_terminal::tty::windows::win32_string;
@@ -12,14 +14,11 @@ pub fn attach_handler() {
let _ = writeln!(io::stderr(), "{}", panic_info);
let msg = format!("{}\n\nPress Ctrl-C to Copy", panic_info);
unsafe {
- winuser::MessageBoxW(
- ptr::null_mut(),
+ MessageBoxW(
+ 0isize,
win32_string(&msg).as_ptr(),
win32_string("Alacritty: Runtime Error").as_ptr(),
- winuser::MB_ICONERROR
- | winuser::MB_OK
- | winuser::MB_SETFOREGROUND
- | winuser::MB_TASKMODAL,
+ MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TASKMODAL,
);
}
}));