cdk_swindow(3)
π cdk_swindow(3) β Library calls π
okay bestie, sit DOWN, because we're about to talk about the scrolling window widget and honestly? it's giving main character energy. this is a <pink>library call</pink> from the Cdk crew, so grab your cc and let's go β¨
πΈ NAME πΈ
cdk_swindow β the Cdk scrolling window widget, aka the little box that just keeps scrolling and never misses π
β¨ SYNOPSIS β¨
lowkey the whole vibe is: you compile with the flag, you include the header, you call the functions. iconic. no cap.
cc [ flag ... ] file ... -lcdk [ library ... ]
#include <cdk.h>
void activateCDKSwindow (
CDKSWINDOW *swindow,
chtype * actions);
void addCDKSwindow (
CDKSWINDOW *swindow,
const char *info,
int insertPosition);
void cleanCDKSwindow (
CDKSWINDOW *swindow);
int execCDKSwindow (
CDKSWINDOW *swindow,
const char * command,
int insertPosition);
void destroyCDKSwindow (
CDKSWINDOW *swindow);
void drawCDKSwindow (
CDKSWINDOW *swindow,
boolean box);
void dumpCDKSwindow (
CDKSWINDOW *swindow,
const char *filename);
void eraseCDKSwindow (
CDKSWINDOW *swindow);
void execCDKSwindow (
CDKSWINDOW *swindow,
char *command,
int insertPosition);
boolean getCDKSwindowBox (
CDKSWINDOW *swindow);
chtype **getCDKSwindowContents (
CDKSWINDOW *swindow);
int injectCDKSwindow (
CDKSWINDOW *swindow,
chtype input);
void jumpToLineCDKSwindow (
CDKSWINDOW *swindow,
int line);
void loadCDKSwindowInformation (
CDKSWINDOW *swindow);
void moveCDKSwindow (
CDKSWINDOW *swindow,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKSWINDOW *newCDKSwindow (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
int height,
int width,
const char *title,
int saveLines,
boolean box,
boolean shadow);
void positionCDKSwindow (
CDKSWINDOW *swindow);
void saveCDKSwindowInformation (
CDKSWINDOW *swindow);
void setCDKSwindow (
CDKSWINDOW *swindow,
CDK_CONST char **info,
int lines,
boolean box);
void setCDKSwindowBackgroundAttrib (
CDKSWINDOW *swindow,
chtype attribute);
void setCDKSwindowBackgroundColor (
CDKSWINDOW *swindow,
const char * color);
void setCDKSwindowBox (
CDKSWINDOW *swindow,
boolean boxWidget);
void setCDKSwindowBoxAttribute (
CDKSWINDOW *swindow,
chtype character);
void setCDKSwindowContents (
CDKSWINDOW *swindow,
char **info,
int lines);
void setCDKSwindowHorizontalChar (
CDKSWINDOW *swindow,
chtype character);
void setCDKSwindowLLChar (
CDKSWINDOW *swindow,
chtype character);
void setCDKSwindowLRChar (
CDKSWINDOW *swindow,
chtype character);
void setCDKSwindowPostProcess (
CDKSWINDOW *swindow,
PROCESSFN callback,
void * data);
void setCDKSwindowPreProcess (
CDKSWINDOW *swindow,
PROCESSFN callback,
void * data);
void setCDKSwindowULChar (
CDKSWINDOW *swindow,
chtype character);
void setCDKSwindowURChar (
CDKSWINDOW *swindow,
chtype character);
void setCDKSwindowVerticalChar (
CDKSWINDOW *swindow,
chtype character);
void trimCDKSwindow (
CDKSWINDOW *swindow,
int start,
int finish);
heads up bestie π«Ά notice howeraseCDKSwindowin that list kind of runs straight into anotherexecCDKSwindowdeclaration with the wonky indentation? yeah, that's exactly how the page hands it to us. i'm not touching it, i'm not "fixing" it, i'm just delivering it to you fr fr. also yes,execCDKSwindowshows up twice β once returningintwithconst char * command, once returningvoidwithchar *command. that's the tea. β
π¦ DESCRIPTION π¦
so what IS this thing? the Cdk scrolling window β lovingly nicknamed swindow β is literally built to display messages. that's the whole job. it shows your messages, it scrolls, it serves cunt, periodt. π
and the functions listed up there? they're your lil toolbox for creating and manipulating the Cdk swindow box widget. new ones, setters, getters, drawers, movers, destroyers β the full roster, no one left out π
more parts coming, don't go anywhere bestie π
β¨ AVAILABLE FUNCTIONS β¨
Okay bestie, here's the whole squad of functions you can call on your swindow widget. Each one is a little legend, and we're gonna go through every single one. No skips. π
β¨ activateCDKSwindow β¨
This function activates the swindow widget and lets the user actually interact with it. It's the go live moment. π¬
- The parameter
swindowis a pointer to a non-NULLswindowwidget. - If the
actionsparameter is passed with a non-NULLvalue, the characters in the array will be injected into the widget.
To activate the widget interactively, pass in a NULL pointer for actions.
If the character entered into this widget is RETURN or TAB, then this function will return 1. It will also set the widget data exitType to vNORMAL.
If the character entered into this widget was ESCAPE, then the widget will return a value of -1 and the widget data exitType will be set to vESCAPE_HIT.
β¨ addCDKSwindow β¨
Adds information to a scrolling window. It's like dropping new messages into the group chat. π¬
- The information is supplied by the
infoparameter. The information is immediately added to the scrolling window. - The position of the new information is governed by the value of the parameter
insertPosition. This parameter may be two values:TOPorBOTTOM.
β¨ cleanCDKSwindow β¨
Clears the information from the window. Poof, gone. β¨
β¨ destroyCDKSwindow β¨
Removes the widget from the screen and frees the memory the object used. It's the ultimate goodbye. π
β¨ drawCDKSwindow β¨
Draws the swindow widget on the screen. It's the glow-up moment. β¨
If the box parameter is true, the widget is drawn with a box.
β¨ dumpCDKSwindow β¨
Saves the contents of the scrolling window into the file specified by the filename parameter. It returns -1 on failure, and the number of lines saved if the dump was successful. Like saving your bestie's texts for later. π±
β¨ eraseCDKSwindow β¨
Removes the widget from the screen. This does NOT destroy the widget. It's just hiding, not deleting. π
β¨ execCDKSwindow β¨
Allows the user to execute a shell command and have the output of the shell command direct itself to the scrolling window. Shell command? In my widget? It's more likely than you think. π
- The
commandparameter is the command to execute. - The
insertPositionparameter tells where the output will be inserted within the scrolling window.
β¨ getCDKSwindowBox β¨
Returns true if the widget will be drawn with a box around it. Box check! π¦
β¨ getCDKSwindowContents β¨
Returns the contents of the scrolling window. It's giving "what's in the box?" π¦
The parameter lines will be set to the number of lines returned.
β¨ injectCDKSwindow β¨
Injects a single character into the widget. Like a little keyboard shortcut for your code. π
- The parameter
swindowis a pointer to a non-NULLswindowwidget. - The parameter
characteris the character to inject into the widget.
The return value and side-effect (setting the widget data exitType) depend upon the injected character:
RETURNorTAB: the function returns1. The widget dataexitTypeis set tovNORMAL.ESCAPE: the function returns-1. The widget dataexitTypeis set tovESCAPE_HIT.- Otherwise: unless modified by preprocessing, postprocessing or key bindings, the function returns
-1. The widget dataexitTypeis set tovEARLY_EXIT.
β¨ jumpToLineCDKSwindow β¨
Moves the scrolling window to the given line. Like scrolling straight to the tea. β
The parameter line may be an integer or one of the two predefined values TOP and BOTTOM.
β¨ loadCDKSwindowInformation β¨
Allows the user to load the contents of a file into the scrolling window. This function is interactive, and will ask for a filename. It's the "choose file" button of the widget world. π
β¨ moveCDKSwindow β¨
Moves the given widget to the given position. It's the widget's main character travel arc. βοΈ
- The parameters
xposandyposare the new position of the widget.
The parameter xpos may be an integer or one of the pre-defined values TOP, BOTTOM, and CENTER.
The parameter ypos may be an integer or one of the pre-defined values LEFT, RIGHT, and CENTER.
- The parameter
relativestates whether thexpos/ypospair is a relative move or an absolute move.
For example, if xpos = 1 and ypos = 2 and relative = TRUE, then the widget would move one row down and two columns right. If the value of relative was FALSE, then the widget would move to the position (1,2).
Do not use the valuesTOP,BOTTOM,LEFT,RIGHT, orCENTERwhenrelative = TRUE(weird things may happen).
- The final parameter
refreshis a boolean value which states whether the widget will get refreshed after the move.
β¨ newCDKSwindow β¨
Creates a swindow widget and returns a pointer to it. It's the birth of a star. π
Parameters:
screenβ is the screen you wish this widget to be placed in.xposβ controls the placement of the object along the horizontal axis. It may be an integer or one of the pre-defined valuesLEFT,RIGHT, andCENTER.yposβ controls the placement of the object along the vertical axis. It may be an integer or one of the pre-defined valuesTOP,BOTTOM, andCENTER.heightandwidthβ control the height and width of the widget. If you provide a value of zero for either of theheightor thewidth, the widget will be created with the full width and height of the screen. If you provide a negative value, the widget will be created the full height or width minus the value provided.titleβ is the string to display at the top of the widget. The title can be more than one line; just provide a carriage return character at the line break.saveLinesβ is the number of lines to save before throwing information away.boxβ is true if the widget should be drawn with a box around it.shadowβ turns the shadow on or off around this widget.
If the widget could not be created then a NULL pointer is returned.
β¨ positionCDKSwindow β¨
Allows the user to move the widget around the screen via the cursor/keypad keys. See cdk_position (3) for key bindings. It's the widget's dance floor. π
β¨ saveCDKSwindowInformation β¨
Allows the user to save the contents of the scrolling window into a file. This function is interactive, and will ask for a filename. Like saving a screenshot of your fave convo. πΈ
β¨ setCDKSwindow β¨
Lets the programmer modify certain elements of an existing swindow widget. It's the customization era. π¨
- The parameter
infois achar **of the information to set in the scrolling window;linesis the number of lines being added. - The other parameter names correspond to the same parameter names listed in the
newCDKSwindowfunction.
β¨ setCDKSwindowBackgroundAttrib β¨
Sets the background attribute of the widget. It's the aesthetic. π
The parameter attribute is a curses attribute, e.g., A_BOLD.
β¨ setCDKSwindowBackgroundColor β¨
Sets the background color of the widget. It's giving mood board. π
The parameter color is in the format of the Cdk format strings.
See cdk_display (3).
β¨ setCDKSwindowBox β¨
Sets whether the widget will be drawn with a box around it. Box on or box off, you decide. π¦
β¨ setCDKSwindowBoxAttribute β¨
Sets the attribute of the box. Fancy box, bestie. β¨
β¨ setCDKSwindowContents β¨
Lets the programmer modify certain elements of an existing swindow widget. Content update! π
- The parameter
infois achar **of the information to set in the scrolling window. linesis the number of lines being added.
β¨ setCDKSwindowHorizontalChar β¨
Sets the horizontal drawing character for the box to the given character. Horizontal line, but make it fashion. β
β¨ setCDKSwindowLLChar β¨
Sets the lower left hand corner of the widget's box to the given character. Corner customization! π
β¨ setCDKSwindowLRChar β¨
Sets the lower right hand corner of the widget's box to the given character. Another corner, another slay. π
β¨ setCDKSwindowPostProcess β¨
Allows the user to have the widget call a function after the key has been applied to the widget. It's the after-party function. π
- The parameter
functionis the callback function. - The parameter
datapoints to data passed to the callback function.
To learn more about post-processing see cdk_process(3).
β¨ setCDKSwindowPreProcess β¨
Allows the user to have the widget call a function after a key is hit and before the key is applied to the widget. It's the pre-game. ποΈ
- The parameter
functionis the callback function. - The parameter
datapoints to data passed to the callback function.
To learn more about pre-processing see cdk_process(3).
β¨ setCDKSwindowULChar β¨
Sets the upper left hand corner of the widget's box to the given character. Upper left, but make it cute. π
β¨ setCDKSwindowURChar β¨
Sets the upper right hand corner of the widget's box to the given character. Upper right, iconic. π
β¨ setCDKSwindowVerticalChar β¨
Sets the vertical drawing character for the box to the given character. Vertical line, serving looks. β
β¨ trimCDKSwindow β¨
Removes information from a scrolling window. It's the cleanup era. π§Ή
The parameters start and end state where to start cutting from and where to stop.
The first element in the scrolling window starts at index 0.
β¨ KEY BINDINGS β¨
Okay so when this widget gets activated, there are default key bindings that help the user enter or manipulate the info quickly. Here's the full rundown of keys and their actions for this widget, bestie. No cap, every single one is here.
Left Arrowβ scrolls the window left one column. smooth.Right Arrowβ scrolls the window right one column. smooth.Up Arrowβ scrolls the window up one row.Down Arrowβ scrolls the window down one row.Prev Page,Ctrl-B,b,Bβ scroll the window backward one page. back it up.Next Page,Ctrl-F,Space,f,Fβ scroll the window forward one page. go go go.Home,|β scroll the list to the left margin.End,$β scroll the list to the right margin.1,<,gβ move to the top of the scrolling window.>,Gβ move to the bottom of the scrolling window.l,Lβ load a file into the scrolling window.s,Sβ save the contents of the scrolling window into a file.Returnβ set the widget'sexitTypetovNORMAL, exit the widget and return1.Tabβ set the widget'sexitTypetovNORMAL, exit the widget and return1.Escapeβ set the widget'sexitTypetovESCAPE_HIT, exit the widget and return-1.Ctrl-Lβ refreshes the screen.
Not me noticing:Escapeis the dramatic exit, whileReturnandTabare the "we're so back" exits. Choose your fighter π
π SEE ALSO π
This was cdk_swindow(3), dated 2025-01-14. Bye bestie, stay iconic! πβ¨
π¦ where this page comes from
- debian trixie: libcdk5-dev 5.0.20250116-1 Β· BSD-4-Clause
- fedora 43: cdk 5.0.20251014-1.fc43 Β· X11-distribute-modifications-variant
- fedora 43: cdk 5.0.20251014-1.fc43 Β· X11-distribute-modifications-variant
- fedora 44: cdk 5.0.20251014-3.fc44 Β· X11-distribute-modifications-variant
- fedora 44: cdk 5.0.20251014-3.fc44 Β· X11-distribute-modifications-variant
- nixos 26.05: cdk 5.0-20260119
- nixpkgs unstable: cdk 5.0-20260119
- ubuntu questing: libcdk5-dev 5.0.20250116-1
- ubuntu resolute: libcdk5-dev 5.0.20251014-1 Β· BSD-4-Clause
- ubuntu stonking: libcdk5-dev 5.0.20260119-1 Β· BSD-4-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms