cdk_process(3)

๐Ÿ“ฆ
version 5.0.20260119 ยท 2 versions
, in debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu questing, ubuntu resolute, ubuntu stonking

๐Ÿ’– cdk_process โ€” bestie, it's giving Cdk widget pre/post-processing ๐Ÿ’–

okay so real talk, this is cdk_process(3) from the Cdk library calls, and it's literally the glow-up your widget's input handling has been waiting for. no cap. โœจ


๐ŸŒธ NAME ๐ŸŒธ

cdk_process โ€” Cdk widget pre/post-processing ๐ŸŽ€


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

Perform pre- and post-processing of data which is injected into a widget.

like. that's the whole vibe. you're intercepting the data going in and the aftermath going out. iconic behavior honestly. ๐Ÿ’…


โœจ DESCRIPTION โœจ

So here's the tea, bestie. โ˜• Character input is handled by each widget by its injection function. And that injection function? It's typically a large case-statement consisting of the actions to be taken for editing and scrolling keys. Big girl. Lots of branches. She's doing the most, and we love her for it. ๐Ÿ’–

But plot twist: the calling application can modify the behavior of the injection function by defining either or both preprocess and postprocess functions. Not one, not the other โ€” either or both. choose your fighter, or honestly, choose both, main character energy. ๐Ÿ‘‘

๐Ÿ”ฎ preprocessing (the before times)

Preprocessing is performed before doing anything with the injected keystroke. So like, before the widget even looks at it. ๐Ÿ™ˆ

๐Ÿšจ If the preprocess function returns zero, no further action is taken in the injection function. Like, door's closed, party's over, go home. ๐Ÿ˜ญ

And ngl, note that the preprocess function may do more than filter out characters โ€” it can fill in logic to coordinate different widgets. So it's not just a bouncer at the door, it's like, a whole event planner. She's networking. She's connecting widgets to each other. lowkey powerful. ๐Ÿซถ

๐ŸŒˆ postprocessing (the after party)

Postprocessing is performed after all other actions have been done in the injection function. Cleanup crew. Closing shift. โœจ

Like the other actions, it is performed only if the preprocess function returns a nonzero value. So remember: preprocess says yes, postprocess gets to play. ๐Ÿ’ซ

And unlike the preprocess function, its return value is ignored. Bestie said her opinion does not matter and she's at peace with it. ๐Ÿ’€


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

go read those too, iykyk ๐Ÿฆ‹


and that's the whole page, bestie!! ๐Ÿ’œ this one's from 2024-03-28, sourced from the Cdk library โ€” mwah, no notes, slay, periodt. ๐ŸŽ€โœจ