Compare commits

...

3 Commits

Author SHA1 Message Date
Smit Barmase
4cf19bdf8e text content type 2025-09-10 00:42:04 +05:30
Smit Barmase
426bd9c8f8 handle more methods 2025-09-09 11:20:51 +05:30
Smit Barmase
8cdddd28b8 disable text substitution and stuff 2025-09-09 10:28:56 +05:30

View File

@@ -84,6 +84,10 @@ type NSDragOperation = NSUInteger;
const NSDragOperationNone: NSDragOperation = 0;
#[allow(non_upper_case_globals)]
const NSDragOperationCopy: NSDragOperation = 1;
#[allow(non_upper_case_globals)]
const NSTextAutocorrectionTypeNo: NSInteger = 1;
#[allow(non_upper_case_globals)]
const NSTextInlinePredictionTypeNone: NSInteger = 1;
#[derive(PartialEq)]
pub enum UserTabbingPreference {
Never,
@@ -249,6 +253,61 @@ unsafe fn build_classes() {
sel!(characterIndexForPoint:),
character_index_for_point as extern "C" fn(&Object, Sel, NSPoint) -> u64,
);
// Disable automatic text substitutions and services, which cause
// performance issues by constantly running heuristics on macOS 26.
decl.add_method(
sel!(isAutomaticTextCompletionEnabled),
no as extern "C" fn(&Object, Sel) -> BOOL,
);
decl.add_method(
sel!(isAutomaticQuoteSubstitutionEnabled),
no as extern "C" fn(&Object, Sel) -> BOOL,
);
decl.add_method(
sel!(isAutomaticDashSubstitutionEnabled),
no as extern "C" fn(&Object, Sel) -> BOOL,
);
decl.add_method(
sel!(isAutomaticLinkDetectionEnabled),
no as extern "C" fn(&Object, Sel) -> BOOL,
);
decl.add_method(
sel!(isAutomaticDataDetectionEnabled),
no as extern "C" fn(&Object, Sel) -> BOOL,
);
decl.add_method(
sel!(isAutomaticSpellingCorrectionEnabled),
no as extern "C" fn(&Object, Sel) -> BOOL,
);
decl.add_method(
sel!(isAutomaticTextReplacementEnabled),
no as extern "C" fn(&Object, Sel) -> BOOL,
);
decl.add_method(
sel!(isContinuousSpellCheckingEnabled),
no as extern "C" fn(&Object, Sel) -> BOOL,
);
decl.add_method(
sel!(isGrammarCheckingEnabled),
no as extern "C" fn(&Object, Sel) -> BOOL,
);
decl.add_method(
sel!(isSmartInsertDeleteEnabled),
no as extern "C" fn(&Object, Sel) -> BOOL,
);
decl.add_method(
sel!(autocorrectionType),
autocorrection_type_no as extern "C" fn(&Object, Sel) -> NSInteger,
);
decl.add_method(
sel!(inlinePredictionType),
inline_prediction_type_none as extern "C" fn(&Object, Sel) -> NSInteger,
);
decl.add_method(
sel!(textContentType),
return_nil as extern "C" fn(&Object, Sel) -> id,
);
}
decl.register()
};
@@ -1600,6 +1659,22 @@ extern "C" fn yes(_: &Object, _: Sel) -> BOOL {
YES
}
extern "C" fn no(_: &Object, _: Sel) -> BOOL {
NO
}
extern "C" fn autocorrection_type_no(_: &Object, _: Sel) -> NSInteger {
NSTextAutocorrectionTypeNo
}
extern "C" fn inline_prediction_type_none(_: &Object, _: Sel) -> NSInteger {
NSTextInlinePredictionTypeNone
}
extern "C" fn return_nil(_: &Object, _: Sel) -> id {
nil
}
extern "C" fn dealloc_window(this: &Object, _: Sel) {
unsafe {
drop_window_state(this);