Skip to content

Commit

Permalink
Fix some typos (#16623)
Browse files Browse the repository at this point in the history
This PR fixes some typos I found in the source code.

Release Notes:

- N/A
  • Loading branch information
MolotovCherry authored Aug 21, 2024
1 parent 406d3b4 commit feab126
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion crates/gpui/src/platform/windows/direct_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ impl DirectWriteState {
continue;
};
if fonts.GetFontCount() == 0 {
log::error!("No mathcing font find for {}", family_name);
log::error!("No matching font found for {}", family_name);
continue;
}
let font = fonts.GetFontFaceReference(0)?.CreateFontFace()?;
Expand Down
6 changes: 3 additions & 3 deletions crates/gpui/src/platform/windows/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ fn handle_dpi_changed_msg(
let new_dpi = wparam.loword() as f32;
let mut lock = state_ptr.state.borrow_mut();
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);

let rect = unsafe { &*(lparam.0 as *const RECT) };
Expand Down Expand Up @@ -796,7 +796,7 @@ fn handle_dpi_changed_msg(
fn handle_display_change_msg(handle: HWND, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {
// NOTE:
// 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.
// So we only care about if monitor is disconnected.
let previous_monitor = state_ptr.as_ref().state.borrow().display;
Expand Down Expand Up @@ -1087,7 +1087,7 @@ fn handle_system_settings_changed(
// mouse double click
lock.click_state.system_update();
// window border offset
lock.border_offset.udpate(handle).log_err();
lock.border_offset.update(handle).log_err();
Some(0)
}

Expand Down
26 changes: 13 additions & 13 deletions crates/gpui/src/platform/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl WindowsWindowState {

/// 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).
fn content_size(&self) -> Size<Pixels> {
self.logical_size
Expand All @@ -187,13 +187,13 @@ impl WindowsWindowState {
}

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
px(32.) + self.title_bar_top_offset()
}

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
px(36.)
}
Expand Down Expand Up @@ -343,8 +343,8 @@ impl WindowsWindow {
};
let mut lock = state_ptr.state.borrow_mut();
let bounds = bounds.to_device_pixels(lock.scale_factor);
lock.border_offset.udpate(raw_hwnd)?;
placement.rcNormalPosition = calcualte_window_rect(bounds, lock.border_offset);
lock.border_offset.update(raw_hwnd)?;
placement.rcNormalPosition = calculate_window_rect(bounds, lock.border_offset);
drop(lock);
SetWindowPlacement(raw_hwnd, &placement)?;
}
Expand Down Expand Up @@ -404,7 +404,7 @@ impl PlatformWindow for WindowsWindow {

/// 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).
fn content_size(&self) -> Size<Pixels> {
self.0.state.borrow().content_size()
Expand Down Expand Up @@ -897,7 +897,7 @@ pub(crate) struct 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 mut rect = std::mem::zeroed();
GetWindowRect(hwnd, &mut rect)?;
Expand Down Expand Up @@ -1015,9 +1015,9 @@ fn register_drag_drop(state_ptr: Rc<WindowsWindowStatePtr>) -> Result<()> {
Ok(())
}

fn calcualte_window_rect(bounds: Bounds<DevicePixels>, border_offset: WindowBorderOffset) -> RECT {
fn calculate_window_rect(bounds: Bounds<DevicePixels>, border_offset: WindowBorderOffset) -> RECT {
// 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.
// 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
Expand All @@ -1032,11 +1032,11 @@ fn calcualte_window_rect(bounds: Bounds<DevicePixels>, border_offset: WindowBord
let left_offset = border_offset.width_offset / 2;
let top_offset = border_offset.height_offset / 2;
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.top -= top_offset;
rect.right += right_offset;
rect.bottom += bottom_offet;
rect.bottom += bottom_offset;
rect
}

Expand All @@ -1048,11 +1048,11 @@ fn calculate_client_rect(
let left_offset = border_offset.width_offset / 2;
let top_offset = border_offset.height_offset / 2;
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 top = rect.top + top_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));
Bounds {
origin: logical_point(left as f32, top as f32, scale_factor),
Expand Down

0 comments on commit feab126

Please sign in to comment.