forked from speedie/spmenu
version bump: 2.0
also remove code-docs, the wiki should have this instead.
This commit is contained in:
parent
17dd06139d
commit
410b8b206a
483
code.html
483
code.html
|
@ -1,483 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<title>spmenu documentation 2.0</title>
|
||||
<style>
|
||||
html {
|
||||
color: #1a1a1a;
|
||||
background-color: #fdfdfd;
|
||||
}
|
||||
body {
|
||||
margin: 0 auto;
|
||||
max-width: 36em;
|
||||
padding-left: 50px;
|
||||
padding-right: 50px;
|
||||
padding-top: 50px;
|
||||
padding-bottom: 50px;
|
||||
hyphens: auto;
|
||||
overflow-wrap: break-word;
|
||||
text-rendering: optimizeLegibility;
|
||||
font-kerning: normal;
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
body {
|
||||
font-size: 0.9em;
|
||||
padding: 12px;
|
||||
}
|
||||
h1 {
|
||||
font-size: 1.8em;
|
||||
}
|
||||
}
|
||||
@media print {
|
||||
html {
|
||||
background-color: white;
|
||||
}
|
||||
body {
|
||||
background-color: transparent;
|
||||
color: black;
|
||||
font-size: 12pt;
|
||||
}
|
||||
p, h2, h3 {
|
||||
orphans: 3;
|
||||
widows: 3;
|
||||
}
|
||||
h2, h3, h4 {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
}
|
||||
p {
|
||||
margin: 1em 0;
|
||||
}
|
||||
a {
|
||||
color: #1a1a1a;
|
||||
}
|
||||
a:visited {
|
||||
color: #1a1a1a;
|
||||
}
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin-top: 1.4em;
|
||||
}
|
||||
h5, h6 {
|
||||
font-size: 1em;
|
||||
font-style: italic;
|
||||
}
|
||||
h6 {
|
||||
font-weight: normal;
|
||||
}
|
||||
ol, ul {
|
||||
padding-left: 1.7em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
li > ol, li > ul {
|
||||
margin-top: 0;
|
||||
}
|
||||
blockquote {
|
||||
margin: 1em 0 1em 1.7em;
|
||||
padding-left: 1em;
|
||||
border-left: 2px solid #e6e6e6;
|
||||
color: #606060;
|
||||
}
|
||||
code {
|
||||
font-family: Menlo, Monaco, Consolas, 'Lucida Console', monospace;
|
||||
font-size: 85%;
|
||||
margin: 0;
|
||||
hyphens: manual;
|
||||
}
|
||||
pre {
|
||||
margin: 1em 0;
|
||||
overflow: auto;
|
||||
}
|
||||
pre code {
|
||||
padding: 0;
|
||||
overflow: visible;
|
||||
overflow-wrap: normal;
|
||||
}
|
||||
.sourceCode {
|
||||
background-color: transparent;
|
||||
overflow: visible;
|
||||
}
|
||||
hr {
|
||||
background-color: #1a1a1a;
|
||||
border: none;
|
||||
height: 1px;
|
||||
margin: 1em 0;
|
||||
}
|
||||
table {
|
||||
margin: 1em 0;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
display: block;
|
||||
font-variant-numeric: lining-nums tabular-nums;
|
||||
}
|
||||
table caption {
|
||||
margin-bottom: 0.75em;
|
||||
}
|
||||
tbody {
|
||||
margin-top: 0.5em;
|
||||
border-top: 1px solid #1a1a1a;
|
||||
border-bottom: 1px solid #1a1a1a;
|
||||
}
|
||||
th {
|
||||
border-top: 1px solid #1a1a1a;
|
||||
padding: 0.25em 0.5em 0.25em 0.5em;
|
||||
}
|
||||
td {
|
||||
padding: 0.125em 0.5em 0.25em 0.5em;
|
||||
}
|
||||
header {
|
||||
margin-bottom: 4em;
|
||||
text-align: center;
|
||||
}
|
||||
#TOC li {
|
||||
list-style: none;
|
||||
}
|
||||
#TOC ul {
|
||||
padding-left: 1.3em;
|
||||
}
|
||||
#TOC > ul {
|
||||
padding-left: 0;
|
||||
}
|
||||
#TOC a:not(:hover) {
|
||||
text-decoration: none;
|
||||
}
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
||||
div.column{flex: auto; overflow-x: auto;}
|
||||
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
ul.task-list{list-style: none;}
|
||||
ul.task-list li input[type="checkbox"] {
|
||||
width: 0.8em;
|
||||
margin: 0 0.8em 0.2em -1.6em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
|
||||
</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<header id="title-block-header">
|
||||
<h1 class="title">spmenu documentation 2.0</h1>
|
||||
</header>
|
||||
<nav id="TOC" role="doc-toc">
|
||||
<ul>
|
||||
<li><a href="#code-documentation" id="toc-code-documentation">Code
|
||||
documentation</a>
|
||||
<ul>
|
||||
<li><a href="#position-and-widthheight-variables"
|
||||
id="toc-position-and-widthheight-variables">Position and width/height
|
||||
variables</a></li>
|
||||
<li><a href="#drawable-abstraction-functions"
|
||||
id="toc-drawable-abstraction-functions">Drawable abstraction
|
||||
functions</a></li>
|
||||
<li><a href="#font-abstraction-functions"
|
||||
id="toc-font-abstraction-functions">Font abstraction functions</a></li>
|
||||
<li><a href="#colorscheme-abstraction-functions"
|
||||
id="toc-colorscheme-abstraction-functions">Colorscheme abstraction
|
||||
functions</a></li>
|
||||
<li><a href="#cursor-abstraction-functions"
|
||||
id="toc-cursor-abstraction-functions">Cursor abstraction
|
||||
functions</a></li>
|
||||
<li><a href="#drawable-context-functions"
|
||||
id="toc-drawable-context-functions">Drawable context functions</a></li>
|
||||
<li><a href="#drawing-functions" id="toc-drawing-functions">Drawing
|
||||
functions</a></li>
|
||||
<li><a href="#map-functions" id="toc-map-functions">Map
|
||||
functions</a></li>
|
||||
<li><a href="#removed-functions" id="toc-removed-functions">Removed
|
||||
functions</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<h1 id="code-documentation">Code documentation</h1>
|
||||
<p>Some of spmenu’s code documented. If you want to hack on the project,
|
||||
this should be useful. Note that these may be renamed in the future to
|
||||
make the codebase easier to understand and make changes to. Also note
|
||||
that this is <strong>definitely not</strong> a complete list.</p>
|
||||
<h2 id="position-and-widthheight-variables">Position and width/height
|
||||
variables</h2>
|
||||
<ul>
|
||||
<li><code>bh</code>
|
||||
<ul>
|
||||
<li>Menu height divided by lines gets you <code>bh</code>. The name
|
||||
comes from dwm’s <code>bh</code> meaning ‘bar height’. This is the
|
||||
height of each item in the list.</li>
|
||||
</ul></li>
|
||||
<li><code>mh</code>
|
||||
<ul>
|
||||
<li>Menu height (or height of the window)</li>
|
||||
<li>Use <code>drw_resize()</code> and <code>XResizeWindow()</code> to
|
||||
adjust this.</li>
|
||||
</ul></li>
|
||||
<li><code>mw</code>
|
||||
<ul>
|
||||
<li>Menu width (or width of the window)</li>
|
||||
<li>Use <code>drw_resize()</code> and <code>XResizeWindow()</code> to
|
||||
adjust this.</li>
|
||||
<li><code>2 * borderwidth</code> is removed from <code>mw</code> (2*
|
||||
because we have two sides)</li>
|
||||
<li><code>2 * sp</code> is removed from <code>mw</code> (2* because we
|
||||
have two sides)</li>
|
||||
</ul></li>
|
||||
<li><code>x</code>
|
||||
<ul>
|
||||
<li>X position, functions like <code>drw_text</code> use this.</li>
|
||||
<li>If you set this in bar drawing functions, you must apply the same to
|
||||
<code>buttonpress()</code>, otherwise clicks will be offset.</li>
|
||||
</ul></li>
|
||||
<li><code>y</code>
|
||||
<ul>
|
||||
<li>Y position, functions like <code>drw_text</code> use this.</li>
|
||||
<li>If you set this in bar drawing functions, you must apply the same to
|
||||
<code>buttonpress()</code>, otherwise clicks will be offset.</li>
|
||||
</ul></li>
|
||||
<li><code>ev->x</code>
|
||||
<ul>
|
||||
<li>X position where you clicked. This is used in the
|
||||
<code>buttonpress()</code> function to check where you clicked.</li>
|
||||
</ul></li>
|
||||
<li><code>ev->y</code>
|
||||
<ul>
|
||||
<li>Y position where you clicked. This is used in the
|
||||
<code>buttonpress()</code> function to check where you clicked.</li>
|
||||
</ul></li>
|
||||
<li><code>w</code>
|
||||
<ul>
|
||||
<li>Width of something, this is passed to <code>drw_text()</code> for
|
||||
example, but you may override this.</li>
|
||||
</ul></li>
|
||||
<li><code>plw</code>
|
||||
<ul>
|
||||
<li>This is the width of the powerline arrow. It must be added on in the
|
||||
<code>buttonpress()</code> and draw functions.</li>
|
||||
</ul></li>
|
||||
<li><code>vp</code>
|
||||
<ul>
|
||||
<li>Vertical padding, this is initially added on in the
|
||||
<code>create_window()</code> function.</li>
|
||||
</ul></li>
|
||||
<li><code>sp</code>
|
||||
<ul>
|
||||
<li>Horizontal padding, this is initially added on in the
|
||||
<code>create_window()</code> function.</li>
|
||||
</ul></li>
|
||||
<li><code>promptw</code>
|
||||
<ul>
|
||||
<li>Width of the prompt text, this is going to be the same as
|
||||
<code>TEXTW(prompt)</code>.</li>
|
||||
</ul></li>
|
||||
<li><code>inputw</code>
|
||||
<ul>
|
||||
<li>Width of the input text.</li>
|
||||
</ul></li>
|
||||
<li><code>fh</code>
|
||||
<ul>
|
||||
<li>Font height. Used to calculate the height of the cursor. See
|
||||
<code>drawcaret()</code>.</li>
|
||||
</ul></li>
|
||||
<li><code>menuposition</code>
|
||||
<ul>
|
||||
<li>Integer the user is meant to configure. If it’s set to
|
||||
<code>0</code>, spmenu will be put on the bottom of the screen. If it’s
|
||||
set to <code>1</code> it will be put on the top of the screen. If it’s
|
||||
<code>2</code> it will be put in the center of the screen.</li>
|
||||
</ul></li>
|
||||
<li><code>wa.width</code>
|
||||
<ul>
|
||||
<li>Window width, <code>wa</code> is
|
||||
<code>XWindowAttributes</code>.</li>
|
||||
</ul></li>
|
||||
<li><code>wa.height</code>
|
||||
<ul>
|
||||
<li>Window height, <code>wa</code> is
|
||||
<code>XWindowAttributes</code>.</li>
|
||||
</ul></li>
|
||||
<li><code>imageheight</code>
|
||||
<ul>
|
||||
<li>Image height, This is <strong>not</strong> the height of the image,
|
||||
it is the height that the image will be scaled to fit.</li>
|
||||
</ul></li>
|
||||
<li><code>imagewidth</code>
|
||||
<ul>
|
||||
<li>Image width, This is <strong>not</strong> the width of the image, it
|
||||
is the width that the image will be scaled to fit.</li>
|
||||
</ul></li>
|
||||
<li><code>imagegaps</code>
|
||||
<ul>
|
||||
<li>Image gaps, this is extra space added around the image.</li>
|
||||
</ul></li>
|
||||
<li><code>imageh</code>
|
||||
<ul>
|
||||
<li>Usually the same as <code>imageheight</code>. This is what
|
||||
<code>imageheight</code> is initially set to.</li>
|
||||
</ul></li>
|
||||
<li><code>imagew</code>
|
||||
<ul>
|
||||
<li>Usually the same as <code>imagewidth</code>. This is what
|
||||
<code>imagewidth</code> is initially set to.</li>
|
||||
</ul></li>
|
||||
<li><code>imageg</code>
|
||||
<ul>
|
||||
<li>Usually the same as <code>imagegaps</code>. This is what
|
||||
<code>imagegaps</code> is initially set to.</li>
|
||||
</ul></li>
|
||||
<li><code>longestedge</code>
|
||||
<ul>
|
||||
<li>As the name implies, it is the longest (highest value) of
|
||||
<code>imageheight</code> and <code>imagewidth</code>.</li>
|
||||
</ul></li>
|
||||
<li><code>numberWidth</code>
|
||||
<ul>
|
||||
<li>Integer set in some functions, it is simply
|
||||
<code>TEXTW(numbers)</code> if the match count isn’t hidden.</li>
|
||||
</ul></li>
|
||||
<li><code>modeWidth</code>
|
||||
<ul>
|
||||
<li>Integer set in some functions, it is simply
|
||||
<code>TEXTW(modetext)</code> if the mode indicator isn’t hidden.</li>
|
||||
</ul></li>
|
||||
<li><code>larrowWidth</code>
|
||||
<ul>
|
||||
<li>Integer set in some functions, it is simply
|
||||
<code>TEXTW(leftarrow)</code> if the left arrow isn’t hidden.</li>
|
||||
</ul></li>
|
||||
<li><code>rarrowWidth</code>
|
||||
<ul>
|
||||
<li>Integer set in some functions, it is simply
|
||||
<code>TEXTW(rightarrow)</code> if the right arrow isn’t hidden.</li>
|
||||
</ul></li>
|
||||
<li><code>powerlinewidth</code>
|
||||
<ul>
|
||||
<li>Integer set in some functions, it is simply <code>plw / 2</code> if
|
||||
powerlines are enabled.</li>
|
||||
</ul></li>
|
||||
<li><code>curpos</code>
|
||||
<ul>
|
||||
<li>Cursor/caret position. When text is added to the input, the width of
|
||||
that text is added to this.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="drawable-abstraction-functions">Drawable abstraction
|
||||
functions</h2>
|
||||
<p>Most of these are in <code>libs/sl/draw.c</code> and
|
||||
<code>libs/sl/draw.h</code>.</p>
|
||||
<ul>
|
||||
<li><code>drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);</code>
|
||||
<ul>
|
||||
<li>This function creates a drawable from <code>Display *dpy</code>,
|
||||
<code>Drw</code>. Think of it as a canvas.</li>
|
||||
</ul></li>
|
||||
<li><code>drw_resize(Drw *drw, unsigned int w, unsigned int h)</code>
|
||||
<ul>
|
||||
<li>This function resizes the drawable to the dimensions passed as
|
||||
arguments (<code>w</code>, <code>h</code>).</li>
|
||||
</ul></li>
|
||||
<li><code>drw_free(Drw *drw);</code>
|
||||
<ul>
|
||||
<li>This function will free the drawable from memory. It is
|
||||
<em>usually</em> called in cleanup functions like <code>cleanup()</code>
|
||||
so most of the time you don’t need to use this.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="font-abstraction-functions">Font abstraction functions</h2>
|
||||
<p>Most of these are in <code>libs/sl/draw.c</code> and
|
||||
<code>libs/sl/draw.h</code>. NOTE: These will differ slightly depending
|
||||
on if Pango is enabled or not.</p>
|
||||
<ul>
|
||||
<li><code>drw_font_create(Drw* drw, char *font[], size_t fontcount);</code>
|
||||
<ul>
|
||||
<li>This function will return a font libXft can use.</li>
|
||||
</ul></li>
|
||||
<li><code>drw_font_free(Fnt *set);</code>
|
||||
<ul>
|
||||
<li>This function will free the font from memory.</li>
|
||||
</ul></li>
|
||||
<li><code>drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n, Bool markup);</code>
|
||||
<ul>
|
||||
<li>This function returns the smallest value out of the passed argument
|
||||
<code>n</code> and the length of the text drawn. The text is not
|
||||
actually drawn though.</li>
|
||||
</ul></li>
|
||||
<li><code>drw_font_getwidth(Drw *drw, const char *text, Bool markup);</code>
|
||||
<ul>
|
||||
<li>This function returns the width of drawn text. The text is not
|
||||
actually drawn though.</li>
|
||||
</ul></li>
|
||||
<li><code>drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup);</code>
|
||||
<ul>
|
||||
<li>This function returns the length of the text with the used
|
||||
font.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="colorscheme-abstraction-functions">Colorscheme abstraction
|
||||
functions</h2>
|
||||
<ul>
|
||||
<li><code>drw_clr_create(Drw *drw, Clr *dest, char *clrname, unsigned int alpha);</code>
|
||||
<ul>
|
||||
<li>This function allocates space for a color.</li>
|
||||
</ul></li>
|
||||
<li><code>drw_scm_create(Drw *drw, char *clrnames[], unsigned int alphas[], size_t clrcount);</code>
|
||||
<ul>
|
||||
<li>This function returns a color scheme from an array of colors and
|
||||
alpha.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="cursor-abstraction-functions">Cursor abstraction functions</h2>
|
||||
<ul>
|
||||
<li><code>drw_cur_create(Drw *drw, int shape);</code>
|
||||
<ul>
|
||||
<li>This function creates and returns a cursor.</li>
|
||||
</ul></li>
|
||||
<li><code>drw_cur_free(Drw *drw, Cur *cursor);</code>
|
||||
<ul>
|
||||
<li>This function will free the cursor from memory.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="drawable-context-functions">Drawable context functions</h2>
|
||||
<ul>
|
||||
<li><code>drw_setscheme(Drw *drw, Clr *scm);</code>
|
||||
<ul>
|
||||
<li>Sets the color scheme to <code>*scm</code> created by
|
||||
<code>drw_scm_create()</code></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="drawing-functions">Drawing functions</h2>
|
||||
<ul>
|
||||
<li><code>drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled , int invert);</code>
|
||||
<ul>
|
||||
<li>Draws a simple rectangle. Used in other functions to create more
|
||||
useful shapes, such as a cursor.</li>
|
||||
</ul></li>
|
||||
<li><code>drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup);</code>
|
||||
<ul>
|
||||
<li>Draws text on the drawable using the font created.
|
||||
<code>const char *text</code> contains the text itself.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="map-functions">Map functions</h2>
|
||||
<ul>
|
||||
<li><code>drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);</code>
|
||||
<ul>
|
||||
<li>Maps the drawable. (makes it visible)</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="removed-functions">Removed functions</h2>
|
||||
<p>Various functions that have been removed for some reason.</p>
|
||||
<ul>
|
||||
<li><code>drw_setfont(Drw *drw, Fnt *set);</code>
|
||||
<ul>
|
||||
<li>Sets the font.</li>
|
||||
<li>NOTE: Applies only if Pango is disabled.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
|
@ -1,171 +0,0 @@
|
|||
# Code documentation
|
||||
|
||||
Some of spmenu's code documented. If you want to hack on the project, this
|
||||
should be useful. Note that these may be renamed in the future to make the
|
||||
codebase easier to understand and make changes to. Also note that this is
|
||||
**definitely not** a complete list.
|
||||
|
||||
## Position and width/height variables
|
||||
|
||||
- `bh`
|
||||
- Menu height divided by lines gets you `bh`. The name comes from dwm's `bh`
|
||||
meaning 'bar height'. This is the height of each item in the list.
|
||||
- `mh`
|
||||
- Menu height (or height of the window)
|
||||
- Use `drw_resize()` and `XResizeWindow()` to adjust this.
|
||||
- `mw`
|
||||
- Menu width (or width of the window)
|
||||
- Use `drw_resize()` and `XResizeWindow()` to adjust this.
|
||||
- `2 * borderwidth` is removed from `mw` (2* because we have two sides)
|
||||
- `2 * sp` is removed from `mw` (2* because we have two sides)
|
||||
- `x`
|
||||
- X position, functions like `drw_text` use this.
|
||||
- If you set this in bar drawing functions, you must apply the same
|
||||
to `buttonpress()`, otherwise clicks will be offset.
|
||||
- `y`
|
||||
- Y position, functions like `drw_text` use this.
|
||||
- If you set this in bar drawing functions, you must apply the same
|
||||
to `buttonpress()`, otherwise clicks will be offset.
|
||||
- `ev->x`
|
||||
- X position where you clicked. This is used in the `buttonpress()` function
|
||||
to check where you clicked.
|
||||
- `ev->y`
|
||||
- Y position where you clicked. This is used in the `buttonpress()` function
|
||||
to check where you clicked.
|
||||
- `w`
|
||||
- Width of something, this is passed to `drw_text()` for example, but you may
|
||||
override this.
|
||||
- `plw`
|
||||
- This is the width of the powerline arrow. It must be added on in
|
||||
the `buttonpress()` and draw functions.
|
||||
- `vp`
|
||||
- Vertical padding, this is initially added on in the `create_window()` function.
|
||||
- `sp`
|
||||
- Horizontal padding, this is initially added on in the `create_window()` function.
|
||||
- `promptw`
|
||||
- Width of the prompt text, this is going to be the same as `TEXTW(prompt)`.
|
||||
- `inputw`
|
||||
- Width of the input text.
|
||||
- `fh`
|
||||
- Font height. Used to calculate the height of the cursor. See `drawcaret()`.
|
||||
- `menuposition`
|
||||
- Integer the user is meant to configure. If it's set to `0`, spmenu will be
|
||||
put on the bottom of the screen. If it's set to `1` it will be put on the
|
||||
top of the screen. If it's `2` it will be put in the center of the screen.
|
||||
- `wa.width`
|
||||
- Window width, `wa` is `XWindowAttributes`.
|
||||
- `wa.height`
|
||||
- Window height, `wa` is `XWindowAttributes`.
|
||||
- `imageheight`
|
||||
- Image height, This is **not** the height of the image, it is the height
|
||||
that the image will be scaled to fit.
|
||||
- `imagewidth`
|
||||
- Image width, This is **not** the width of the image, it is the width
|
||||
that the image will be scaled to fit.
|
||||
- `imagegaps`
|
||||
- Image gaps, this is extra space added around the image.
|
||||
- `imageh`
|
||||
- Usually the same as `imageheight`. This is what `imageheight` is initially
|
||||
set to.
|
||||
- `imagew`
|
||||
- Usually the same as `imagewidth`. This is what `imagewidth` is initially
|
||||
set to.
|
||||
- `imageg`
|
||||
- Usually the same as `imagegaps`. This is what `imagegaps` is initially set to.
|
||||
- `longestedge`
|
||||
- As the name implies, it is the longest (highest value) of `imageheight` and `imagewidth`.
|
||||
- `numberWidth`
|
||||
- Integer set in some functions, it is simply `TEXTW(numbers)` if the match
|
||||
count isn't hidden.
|
||||
- `modeWidth`
|
||||
- Integer set in some functions, it is simply `TEXTW(modetext)` if the mode
|
||||
indicator isn't hidden.
|
||||
- `larrowWidth`
|
||||
- Integer set in some functions, it is simply `TEXTW(leftarrow)` if the left
|
||||
arrow isn't hidden.
|
||||
- `rarrowWidth`
|
||||
- Integer set in some functions, it is simply `TEXTW(rightarrow)` if the right
|
||||
arrow isn't hidden.
|
||||
- `powerlinewidth`
|
||||
- Integer set in some functions, it is simply `plw / 2` if powerlines are enabled.
|
||||
- `curpos`
|
||||
- Cursor/caret position. When text is added to the input, the width of that text
|
||||
is added to this.
|
||||
|
||||
## Drawable abstraction functions
|
||||
|
||||
Most of these are in `libs/sl/draw.c` and `libs/sl/draw.h`.
|
||||
|
||||
- `drw_create(Display *dpy, int screen, Window win, unsigned int w,
|
||||
unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);`
|
||||
- This function creates a drawable from `Display *dpy`, `Drw`. Think of
|
||||
it as a canvas.
|
||||
- `drw_resize(Drw *drw, unsigned int w, unsigned int h)`
|
||||
- This function resizes the drawable to the dimensions passed as
|
||||
arguments (`w`, `h`).
|
||||
- `drw_free(Drw *drw);`
|
||||
- This function will free the drawable from memory. It is *usually* called in
|
||||
cleanup functions like `cleanup()` so most of the time you don't need to use this.
|
||||
|
||||
## Font abstraction functions
|
||||
|
||||
Most of these are in `libs/sl/draw.c` and `libs/sl/draw.h`.
|
||||
NOTE: These will differ slightly depending on if Pango is enabled or not.
|
||||
|
||||
- `drw_font_create(Drw* drw, char *font[], size_t fontcount);`
|
||||
- This function will return a font libXft can use.
|
||||
- `drw_font_free(Fnt *set);`
|
||||
- This function will free the font from memory.
|
||||
- `drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n, Bool markup);`
|
||||
- This function returns the smallest value out of the passed argument `n`
|
||||
and the length of the text drawn. The text is not actually drawn though.
|
||||
- `drw_font_getwidth(Drw *drw, const char *text, Bool markup);`
|
||||
- This function returns the width of drawn text. The text is not actually
|
||||
drawn though.
|
||||
- `drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned
|
||||
int *w, unsigned int *h, Bool markup);`
|
||||
- This function returns the length of the text with the used font.
|
||||
|
||||
## Colorscheme abstraction functions
|
||||
|
||||
- `drw_clr_create(Drw *drw, Clr *dest, char *clrname, unsigned int alpha);`
|
||||
- This function allocates space for a color.
|
||||
- `drw_scm_create(Drw *drw, char *clrnames[], unsigned int alphas[],
|
||||
size_t clrcount);`
|
||||
- This function returns a color scheme from an array of colors and alpha.
|
||||
|
||||
## Cursor abstraction functions
|
||||
|
||||
- `drw_cur_create(Drw *drw, int shape);`
|
||||
- This function creates and returns a cursor.
|
||||
- `drw_cur_free(Drw *drw, Cur *cursor);`
|
||||
- This function will free the cursor from memory.
|
||||
|
||||
## Drawable context functions
|
||||
|
||||
- `drw_setscheme(Drw *drw, Clr *scm);`
|
||||
- Sets the color scheme to `*scm` created by `drw_scm_create()`
|
||||
|
||||
## Drawing functions
|
||||
|
||||
- `drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled
|
||||
, int invert);`
|
||||
- Draws a simple rectangle. Used in other functions to create more useful
|
||||
shapes, such as a cursor.
|
||||
- `drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned
|
||||
int lpad, const char *text, int invert, Bool markup);`
|
||||
- Draws text on the drawable using the font created. `const char *text`
|
||||
contains the text itself.
|
||||
|
||||
## Map functions
|
||||
|
||||
- `drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);`
|
||||
- Maps the drawable. (makes it visible)
|
||||
|
||||
## Removed functions
|
||||
|
||||
Various functions that have been removed for some reason.
|
||||
|
||||
- `drw_setfont(Drw *drw, Fnt *set);`
|
||||
- Sets the font.
|
||||
- NOTE: Applies only if Pango is disabled.
|
|
@ -12,5 +12,4 @@ grep -v docs/preview.png docs/run-docs.md >> .man.md
|
|||
pandoc --standalone --to man .man.md -o spmenu_run.1
|
||||
rm -f .man.md
|
||||
|
||||
scripts/make/generate-code-docs.sh docs/code-docs.md code.html || return
|
||||
pandoc --standalone README.md -o README.html --metadata title="spmenu README"
|
||||
|
|
Loading…
Reference in a new issue