S3DW_HANDLE_KEY(3)
π S3DW_HANDLE_KEY(3) π
okay bestie, welcome to the s3d manual, section 3 (library calls, the fun ones) π
this one's all about s3dw_handle_key, and honestly? she's a lil legend. let's get into it β¨
πΈ NAME πΈ
s3dw_handle_key β handle key input on widget π
β¨ SYNOPSIS β¨
#include <s3dw.h>
int s3dw_handle_key(const struct s3d_evt *event);
π¦ DESCRIPTION π¦
so basically, this function is somehow useful to call inside your keyhandler functions if you want your input-boxes to actually, y'know, work. π like, no cap, it's the glue that makes typing into a box not feel broken. the original author even threw in a lil smiley, we love that for them ;) π«Ά
here's how you can do it, two ways, pick your fighter:
// way 1:
s3d_set_callback(S3D_EVENT_KEY,s3dw_handle_key);
// way 2:
...
void key(struct s3d_evt *evt)
{
s3dw_handle_key(evt);
....
// your own keyhandler code
...
}
....
s3d_set_callback(S3D_EVENT_KEY,key);
so way 1 is the "just hand it over, I trust you" vibe β you set s3dw_handle_key directly as the callback for S3D_EVENT_KEY and let her cook. π
way 2 is the "I have main character energy and also my own stuff to do" vibe β you write your own key function, call s3dw_handle_key(evt) first so the input boxes stay happy, and then drop all your own keyhandler code right after it. π
then you wire that bad boy up with s3d_set_callback(S3D_EVENT_KEY,key).
either way, the input-boxes get fed and your custom logic still gets to run. it's giving best of both worlds. π
π AUTHOR π
Simon Wunderlich β Author of s3d π§
that's the whole page, bestie, no filler, no notes πβ¨ and if you ever forget who wrote this iconic little library β it's Simon Wunderlich, and the whole thing lives under the s3d source, S3DW_HANDLE_KEY(3), section 3, library-call royalty. go forth and handle those keys, you've got this πππ
π¦ where this page comes from
- debian bookworm: s3d-doc 0.2.2.1-5 Β· GPL-2.0-or-later
- debian trixie: s3d-doc 0.2.2.1-7 Β· GPL-2.0-or-later
- ubuntu jammy: s3d-doc 0.2.2.1-3build1 Β· GPL-2.0-or-later
- ubuntu noble: s3d-doc 0.2.2.1-6build3 Β· GPL-2.0-or-later
- ubuntu questing: s3d-doc 0.2.2.1-7build1
- ubuntu resolute: s3d-doc 0.2.2.1-7build3 Β· GPL-2.0-or-later
- ubuntu stonking: s3d-doc 0.2.3-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms