minput_filter(3m17n)

πŸ“¦
version 1.8.4 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

🌸 NAME 🌸

minput_filter β€” and bestie, the actual description line in the source is literally empty. Just minput_filter - and nothing after the dash. No cap. We move on. πŸ’…

This page is part of The m17n Library, so if you see 3m17n floating around, that's the vibe check passing. πŸ¦‹


✨ SYNOPSIS ✨

int minput_filter (MInputContext * ic, MSymbol key, void * arg)

πŸ’– DESCRIPTION πŸ’–

Okay so minput_filter() is the function that filters an input key. You hand it key, it filters that key according to the input context ic, and if the preedit text, the status, or the current candidate changed, it calls the callback functions that correspond to Minput_preedit_draw, Minput_status_draw, and Minput_candidates_draw respectively. Three possible callbacks, each tied to its own thing changing. Slay. πŸŽ€

Now the special-key tea, because this is the part everyone forgets:

  • If you want the input method to commit the current preedit text (if there is any) and shift to the initial state, call this function with Mnil as key. Yes, Mnil. That's the move. πŸ‘‘
  • Wanna tell the input method about a focus-out event? Call this function with Minput_focus_out as key.
  • Wanna tell it about a focus-in event? Call this function with Minput_focus_in as key.
  • Wanna tell it about a focus-move event β€” that's an input spot change within the same input context, iykyk β€” call this function with Minput_focus_move as key.
Careful bestie: those four magic keys (Mnil, Minput_focus_out, Minput_focus_in, Minput_focus_move) aren't regular keystrokes, they're instructions. Pass them as key and the function does the special thing. Don't treat them like normal input, fr fr. 🫢

🌈 RETURN VALUE 🌈

  • 1 β€” the key got filtered out. In that case, the caller should discard the key. Throw it away, it's not yours anymore. πŸ’€
  • 0 β€” the key was not filtered out. In that case, the caller should handle the key β€” for instance, by calling the function minput_lookup() with the same key. Your turn, main character. ✨

Copyright (C) 2001 Information-technology Promotion Agency (IPA)

Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>.


okay that's the whole page, ily, go filter some keys πŸ’–

This was Version 1.8.4, dated Mon Sep 25 2023 β€” mwah, signing off, bestie πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from