From eaaf98ad2fe9215e1bf608fef747c8ba25903503 Mon Sep 17 00:00:00 2001 From: David Rios Date: Fri, 25 Mar 2022 22:28:43 +0100 Subject: [PATCH] Uncomment title font --- window/src/os/windows/extra_constants.rs | 2 -- window/src/os/windows/window.rs | 23 ++++++++++------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/window/src/os/windows/extra_constants.rs b/window/src/os/windows/extra_constants.rs index 051feeae4..b093ba5e8 100644 --- a/window/src/os/windows/extra_constants.rs +++ b/window/src/os/windows/extra_constants.rs @@ -1,5 +1,3 @@ -use winapi::um::winuser::WM_USER; - pub const TMT_CAPTIONFONT: i32 = 801; pub const HP_HEADERITEM: i32 = 1; pub const HIS_NORMAL: i32 = 1; diff --git a/window/src/os/windows/window.rs b/window/src/os/windows/window.rs index f3b3f04d3..4da348126 100644 --- a/window/src/os/windows/window.rs +++ b/window/src/os/windows/window.rs @@ -753,19 +753,16 @@ impl WindowOps for Window { let has_focus = unsafe { GetFocus() } == hwnd; let is_full_screen = window_state.contains(WindowState::FULL_SCREEN); - // let title_font = unsafe { - // let hdc = GetDC(hwnd); - // if hdc.is_null() { - // return Err(anyhow::anyhow!("Could not get device context")); - // } - // let result = match get_title_log_font(hwnd, hdc) { - // Some(lf) => Some(wezterm_font::locator::gdi::parse_log_font(&lf, hdc)?), - // None => None, - // }; - // ReleaseDC(hwnd, hdc); - // result - // }; - let title_font = None; + let title_font = unsafe { + let hdc = GetDC(hwnd); + anyhow::ensure!(!hdc.is_null(), "Could not get device context"); + let result = match get_title_log_font(hwnd, hdc) { + Some(lf) => wezterm_font::locator::gdi::parse_log_font(&lf, hdc).ok(), + None => None, + }; + ReleaseDC(hwnd, hdc); + result + }; let hkcu = RegKey::predef(HKEY_CURRENT_USER); let use_accent = hkcu