windows: Remove allow(deadcode) (#29651)

Release Notes:

- N/A
This commit is contained in:
张小白 2025-04-30 15:39:19 +08:00 committed by GitHub
parent 9767033985
commit edda386827
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 24 deletions

View file

@ -1,6 +1,3 @@
// todo(windows): remove
#![cfg_attr(windows, allow(dead_code))]
mod app_menu; mod app_menu;
mod keystroke; mod keystroke;
@ -802,6 +799,7 @@ impl PlatformInputHandler {
.flatten() .flatten()
} }
#[cfg_attr(target_os = "windows", allow(dead_code))]
fn marked_text_range(&mut self) -> Option<Range<usize>> { fn marked_text_range(&mut self) -> Option<Range<usize>> {
self.cx self.cx
.update(|window, cx| self.handler.marked_text_range(window, cx)) .update(|window, cx| self.handler.marked_text_range(window, cx))
@ -809,7 +807,10 @@ impl PlatformInputHandler {
.flatten() .flatten()
} }
#[cfg_attr(any(target_os = "linux", target_os = "freebsd"), allow(dead_code))] #[cfg_attr(
any(target_os = "linux", target_os = "freebsd", target_os = "windows"),
allow(dead_code)
)]
fn text_for_range( fn text_for_range(
&mut self, &mut self,
range_utf16: Range<usize>, range_utf16: Range<usize>,
@ -852,6 +853,7 @@ impl PlatformInputHandler {
.ok(); .ok();
} }
#[cfg_attr(target_os = "windows", allow(dead_code))]
fn unmark_text(&mut self) { fn unmark_text(&mut self) {
self.cx self.cx
.update(|window, cx| self.handler.unmark_text(window, cx)) .update(|window, cx| self.handler.unmark_text(window, cx))
@ -1069,7 +1071,10 @@ pub(crate) struct WindowParams {
#[cfg_attr(any(target_os = "linux", target_os = "freebsd"), allow(dead_code))] #[cfg_attr(any(target_os = "linux", target_os = "freebsd"), allow(dead_code))]
pub is_movable: bool, pub is_movable: bool,
#[cfg_attr(any(target_os = "linux", target_os = "freebsd"), allow(dead_code))] #[cfg_attr(
any(target_os = "linux", target_os = "freebsd", target_os = "windows"),
allow(dead_code)
)]
pub focus: bool, pub focus: bool,
#[cfg_attr(any(target_os = "linux", target_os = "freebsd"), allow(dead_code))] #[cfg_attr(any(target_os = "linux", target_os = "freebsd"), allow(dead_code))]

View file

@ -453,7 +453,10 @@ impl BladeRenderer {
} }
} }
#[cfg_attr(any(target_os = "macos", feature = "wayland"), allow(dead_code))] #[cfg_attr(
any(target_os = "macos", feature = "wayland", target_os = "windows"),
allow(dead_code)
)]
pub fn viewport_size(&self) -> gpu::Extent { pub fn viewport_size(&self) -> gpu::Extent {
self.surface_config.size self.surface_config.size
} }

View file

@ -33,7 +33,6 @@ struct FontInfo {
features: IDWriteTypography, features: IDWriteTypography,
fallbacks: Option<IDWriteFontFallback>, fallbacks: Option<IDWriteFontFallback>,
is_system_font: bool, is_system_font: bool,
is_emoji: bool,
} }
pub(crate) struct DirectWriteTextSystem(RwLock<DirectWriteState>); pub(crate) struct DirectWriteTextSystem(RwLock<DirectWriteState>);
@ -375,7 +374,6 @@ impl DirectWriteState {
let Some(identifier) = get_font_identifier(&font_face, &self.components.locale) else { let Some(identifier) = get_font_identifier(&font_face, &self.components.locale) else {
continue; continue;
}; };
let is_emoji = unsafe { font_face.IsColorFont().as_bool() };
let Some(direct_write_features) = let Some(direct_write_features) =
(unsafe { self.generate_font_features(font_features).log_err() }) (unsafe { self.generate_font_features(font_features).log_err() })
else { else {
@ -389,7 +387,6 @@ impl DirectWriteState {
features: direct_write_features, features: direct_write_features,
fallbacks, fallbacks,
is_system_font, is_system_font,
is_emoji,
}; };
let font_id = FontId(self.fonts.len()); let font_id = FontId(self.fonts.len());
self.fonts.push(font_info); self.fonts.push(font_info);
@ -1174,6 +1171,7 @@ impl<'a> StringIndexConverter<'a> {
} }
} }
#[allow(dead_code)]
fn advance_to_utf8_ix(&mut self, utf8_target: usize) { fn advance_to_utf8_ix(&mut self, utf8_target: usize) {
for (ix, c) in self.text[self.utf8_ix..].char_indices() { for (ix, c) in self.text[self.utf8_ix..].char_indices() {
if self.utf8_ix + ix >= utf8_target { if self.utf8_ix + ix >= utf8_target {

View file

@ -172,21 +172,6 @@ impl WindowsDisplay {
.collect() .collect()
} }
pub(crate) fn frequency(&self) -> Option<u32> {
get_monitor_info(self.handle).ok().and_then(|info| {
let mut devmode = DEVMODEW::default();
unsafe {
EnumDisplaySettingsW(
PCWSTR(info.szDevice.as_ptr()),
ENUM_CURRENT_SETTINGS,
&mut devmode,
)
}
.as_bool()
.then(|| devmode.dmDisplayFrequency)
})
}
/// Check if this monitor is still online /// Check if this monitor is still online
pub fn is_connected(hmonitor: HMONITOR) -> bool { pub fn is_connected(hmonitor: HMONITOR) -> bool {
available_monitors().iter().contains(&hmonitor) available_monitors().iter().contains(&hmonitor)