Fix some typos (#16623)

This PR fixes some typos I found in the source code.

Release Notes:

- N/A
This commit is contained in:
Cherry 2024-08-21 14:33:19 -07:00 committed by GitHub
parent 406d3b413d
commit feab1261c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 17 deletions

View File

@ -301,7 +301,7 @@ impl DirectWriteState {
continue; continue;
}; };
if fonts.GetFontCount() == 0 { if fonts.GetFontCount() == 0 {
log::error!("No mathcing font find for {}", family_name); log::error!("No matching font found for {}", family_name);
continue; continue;
} }
let font = fonts.GetFontFaceReference(0)?.CreateFontFace()?; let font = fonts.GetFontFaceReference(0)?.CreateFontFace()?;

View File

@ -758,7 +758,7 @@ fn handle_dpi_changed_msg(
let new_dpi = wparam.loword() as f32; let new_dpi = wparam.loword() as f32;
let mut lock = state_ptr.state.borrow_mut(); let mut lock = state_ptr.state.borrow_mut();
lock.scale_factor = new_dpi / USER_DEFAULT_SCREEN_DPI as f32; lock.scale_factor = new_dpi / USER_DEFAULT_SCREEN_DPI as f32;
lock.border_offset.udpate(handle).log_err(); lock.border_offset.update(handle).log_err();
drop(lock); drop(lock);
let rect = unsafe { &*(lparam.0 as *const RECT) }; let rect = unsafe { &*(lparam.0 as *const RECT) };
@ -796,7 +796,7 @@ fn handle_dpi_changed_msg(
fn handle_display_change_msg(handle: HWND, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> { fn handle_display_change_msg(handle: HWND, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {
// NOTE: // NOTE:
// Even the `lParam` holds the resolution of the screen, we just ignore it. // Even the `lParam` holds the resolution of the screen, we just ignore it.
// Because WM_DPICHANGED, WM_MOVE, WM_SIEZ will come first, window reposition and resize // Because WM_DPICHANGED, WM_MOVE, WM_SIZE will come first, window reposition and resize
// are handled there. // are handled there.
// So we only care about if monitor is disconnected. // So we only care about if monitor is disconnected.
let previous_monitor = state_ptr.as_ref().state.borrow().display; let previous_monitor = state_ptr.as_ref().state.borrow().display;
@ -1087,7 +1087,7 @@ fn handle_system_settings_changed(
// mouse double click // mouse double click
lock.click_state.system_update(); lock.click_state.system_update();
// window border offset // window border offset
lock.border_offset.udpate(handle).log_err(); lock.border_offset.update(handle).log_err();
Some(0) Some(0)
} }

View File

@ -166,7 +166,7 @@ impl WindowsWindowState {
/// get the logical size of the app's drawable area. /// get the logical size of the app's drawable area.
/// ///
/// Currently, GPUI uses logical size of the app to handle mouse interactions (such as /// Currently, GPUI uses the logical size of the app to handle mouse interactions (such as
/// whether the mouse collides with other elements of GPUI). /// whether the mouse collides with other elements of GPUI).
fn content_size(&self) -> Size<Pixels> { fn content_size(&self) -> Size<Pixels> {
self.logical_size self.logical_size
@ -187,13 +187,13 @@ impl WindowsWindowState {
} }
fn title_bar_height(&self) -> Pixels { fn title_bar_height(&self) -> Pixels {
// todo(windows) this is hard set to match the ui title bar // todo(windows) this is hardcoded to match the ui title bar
// in the future the ui title bar component will report the size // in the future the ui title bar component will report the size
px(32.) + self.title_bar_top_offset() px(32.) + self.title_bar_top_offset()
} }
pub(crate) fn caption_button_width(&self) -> Pixels { pub(crate) fn caption_button_width(&self) -> Pixels {
// todo(windows) this is hard set to match the ui title bar // todo(windows) this is hardcoded to match the ui title bar
// in the future the ui title bar component will report the size // in the future the ui title bar component will report the size
px(36.) px(36.)
} }
@ -343,8 +343,8 @@ impl WindowsWindow {
}; };
let mut lock = state_ptr.state.borrow_mut(); let mut lock = state_ptr.state.borrow_mut();
let bounds = bounds.to_device_pixels(lock.scale_factor); let bounds = bounds.to_device_pixels(lock.scale_factor);
lock.border_offset.udpate(raw_hwnd)?; lock.border_offset.update(raw_hwnd)?;
placement.rcNormalPosition = calcualte_window_rect(bounds, lock.border_offset); placement.rcNormalPosition = calculate_window_rect(bounds, lock.border_offset);
drop(lock); drop(lock);
SetWindowPlacement(raw_hwnd, &placement)?; SetWindowPlacement(raw_hwnd, &placement)?;
} }
@ -404,7 +404,7 @@ impl PlatformWindow for WindowsWindow {
/// get the logical size of the app's drawable area. /// get the logical size of the app's drawable area.
/// ///
/// Currently, GPUI uses logical size of the app to handle mouse interactions (such as /// Currently, GPUI uses the logical size of the app to handle mouse interactions (such as
/// whether the mouse collides with other elements of GPUI). /// whether the mouse collides with other elements of GPUI).
fn content_size(&self) -> Size<Pixels> { fn content_size(&self) -> Size<Pixels> {
self.0.state.borrow().content_size() self.0.state.borrow().content_size()
@ -897,7 +897,7 @@ pub(crate) struct WindowBorderOffset {
} }
impl WindowBorderOffset { impl WindowBorderOffset {
pub(crate) fn udpate(&mut self, hwnd: HWND) -> anyhow::Result<()> { pub(crate) fn update(&mut self, hwnd: HWND) -> anyhow::Result<()> {
let window_rect = unsafe { let window_rect = unsafe {
let mut rect = std::mem::zeroed(); let mut rect = std::mem::zeroed();
GetWindowRect(hwnd, &mut rect)?; GetWindowRect(hwnd, &mut rect)?;
@ -1015,9 +1015,9 @@ fn register_drag_drop(state_ptr: Rc<WindowsWindowStatePtr>) -> Result<()> {
Ok(()) Ok(())
} }
fn calcualte_window_rect(bounds: Bounds<DevicePixels>, border_offset: WindowBorderOffset) -> RECT { fn calculate_window_rect(bounds: Bounds<DevicePixels>, border_offset: WindowBorderOffset) -> RECT {
// NOTE: // NOTE:
// The reason that not using `AdjustWindowRectEx()` here is // The reason we're not using `AdjustWindowRectEx()` here is
// that the size reported by this function is incorrect. // that the size reported by this function is incorrect.
// You can test it, and there are similar discussions online. // You can test it, and there are similar discussions online.
// See: https://stackoverflow.com/questions/12423584/how-to-set-exact-client-size-for-overlapped-window-winapi // See: https://stackoverflow.com/questions/12423584/how-to-set-exact-client-size-for-overlapped-window-winapi
@ -1032,11 +1032,11 @@ fn calcualte_window_rect(bounds: Bounds<DevicePixels>, border_offset: WindowBord
let left_offset = border_offset.width_offset / 2; let left_offset = border_offset.width_offset / 2;
let top_offset = border_offset.height_offset / 2; let top_offset = border_offset.height_offset / 2;
let right_offset = border_offset.width_offset - left_offset; let right_offset = border_offset.width_offset - left_offset;
let bottom_offet = border_offset.height_offset - top_offset; let bottom_offset = border_offset.height_offset - top_offset;
rect.left -= left_offset; rect.left -= left_offset;
rect.top -= top_offset; rect.top -= top_offset;
rect.right += right_offset; rect.right += right_offset;
rect.bottom += bottom_offet; rect.bottom += bottom_offset;
rect rect
} }
@ -1048,11 +1048,11 @@ fn calculate_client_rect(
let left_offset = border_offset.width_offset / 2; let left_offset = border_offset.width_offset / 2;
let top_offset = border_offset.height_offset / 2; let top_offset = border_offset.height_offset / 2;
let right_offset = border_offset.width_offset - left_offset; let right_offset = border_offset.width_offset - left_offset;
let bottom_offet = border_offset.height_offset - top_offset; let bottom_offset = border_offset.height_offset - top_offset;
let left = rect.left + left_offset; let left = rect.left + left_offset;
let top = rect.top + top_offset; let top = rect.top + top_offset;
let right = rect.right - right_offset; let right = rect.right - right_offset;
let bottom = rect.bottom - bottom_offet; let bottom = rect.bottom - bottom_offset;
let physical_size = size(DevicePixels(right - left), DevicePixels(bottom - top)); let physical_size = size(DevicePixels(right - left), DevicePixels(bottom - top));
Bounds { Bounds {
origin: logical_point(left as f32, top as f32, scale_factor), origin: logical_point(left as f32, top as f32, scale_factor),