Fixed clang-format; updated cmakelists

split-selection
Jef Roosens 2020-12-26 11:26:08 +01:00
parent 39fd726a51
commit 8d792bbc50
17 changed files with 1858 additions and 1685 deletions

View File

@ -1 +1,149 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 79
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentWidth: 4 IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
...

View File

@ -0,0 +1,3 @@
#!/usr/bin/env sh
make format

View File

@ -1,5 +1,5 @@
# Upcoming # Upcoming
## v0.1 ## v1.0
* Switched build to CMake * Switched build to CMake
* Completely overhauled code structure * Completely overhauled code structure
* Separate code into logical blocks * Separate code into logical blocks
@ -7,7 +7,7 @@
* Add a desktop entry when installing * Add a desktop entry when installing
based on [desktopentry](https://st.suckless.org/patches/desktopentry/) based on [desktopentry](https://st.suckless.org/patches/desktopentry/)
## v0.2 ## v1.1
* Configurable transparency (focused and unfocused) * Configurable transparency (focused and unfocused)
based on [alpha](https://st.suckless.org/patches/alpha/) and based on [alpha](https://st.suckless.org/patches/alpha/) and
[alpha focus highlight](https://st.suckless.org/patches/alpha_focus_highlight/) [alpha focus highlight](https://st.suckless.org/patches/alpha_focus_highlight/)
@ -16,7 +16,7 @@
* Copy to clipboard on selection * Copy to clipboard on selection
based on [one clipboard](https://st.suckless.org/patches/clipboard/) based on [one clipboard](https://st.suckless.org/patches/clipboard/)
## v0.3 ## v1.2
* Add better/gapless rendering of lines/blocks * Add better/gapless rendering of lines/blocks
based on [boxdraw](https://st.suckless.org/patches/boxdraw/) based on [boxdraw](https://st.suckless.org/patches/boxdraw/)
* Add support for multiple fonts * Add support for multiple fonts
@ -24,7 +24,7 @@
* Hide cursor when working in the terminal * Hide cursor when working in the terminal
based on [hidecursor](https://st.suckless.org/patches/hidecursor/) based on [hidecursor](https://st.suckless.org/patches/hidecursor/)
## v0.4 ## v2.0
* Add ligature support * Add ligature support
based on [ligature support](https://st.suckless.org/patches/ligatures/) based on [ligature support](https://st.suckless.org/patches/ligatures/)
* Support for multiple color pallets * Support for multiple color pallets

View File

@ -10,6 +10,9 @@ PREFIX := /usr/local
MANPREFIX := $(PREFIX)/share/man MANPREFIX := $(PREFIX)/share/man
SHELL := $(shell which sh)
all: debug all: debug
.PHONY: all .PHONY: all
@ -90,4 +93,4 @@ clean-debug:
# =====FORMAT CODE===== # =====FORMAT CODE=====
format: format:
@ clang-format -i --style=file src/**/*.c src/**/*.h @ clang-format -i --style=file src/**/*.c src/**/*.h src/*.c src/*.h

View File

@ -19,7 +19,7 @@ add_definitions(-DVERSION="${CMAKE_PROJECT_VERSION}" -D_XOPEN_SOURCE=600)
# =====BUILD TYPES===== # =====BUILD TYPES=====
# Debug # Debug
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -Wall -O0 -fsanitize=address -fno-omit-frame-pointer") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -O0 -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address -pedantic") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address -pedantic")
# Arch doesn't use static libraries # Arch doesn't use static libraries
@ -43,8 +43,6 @@ add_executable(stj x.c "${st_SRC}" "${main_SRC}")
find_package(Freetype 2 REQUIRED) find_package(Freetype 2 REQUIRED)
target_include_directories(stj PRIVATE "${FREETYPE_INCLUDE_DIRS}") target_include_directories(stj PRIVATE "${FREETYPE_INCLUDE_DIRS}")
target_link_libraries(stj PRIVATE "${FREETYPE_LIBRARIES}") target_link_libraries(stj PRIVATE "${FREETYPE_LIBRARIES}")
target_link_libraries(stj PRIVATE Xft)
target_link_libraries(stj PRIVATE Xrender)
find_package(Fontconfig 2 REQUIRED) find_package(Fontconfig 2 REQUIRED)
target_include_directories(stj PRIVATE "${Fontconfig_INCLUDE_DIRS}") target_include_directories(stj PRIVATE "${Fontconfig_INCLUDE_DIRS}")
@ -53,6 +51,9 @@ target_link_libraries(stj PRIVATE "${Fontconfig_LIBRARIES}")
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
target_include_directories(stj PRIVATE "${X11_INCLUDE_DIR}") target_include_directories(stj PRIVATE "${X11_INCLUDE_DIR}")
target_link_libraries(stj PRIVATE "${X11_LIBRARIES}") target_link_libraries(stj PRIVATE "${X11_LIBRARIES}")
# TODO Find out if these are included in the above statement or not
# target_link_libraries(stj PRIVATE Xft)
# target_link_libraries(stj PRIVATE Xrender)
# Normally provided with clang # Normally provided with clang
target_link_libraries(stj PRIVATE m) target_link_libraries(stj PRIVATE m)

View File

@ -5,7 +5,8 @@
* *
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/ */
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; static char *font =
"Liberation Mono:pixelsize=12:antialias=true:autohint=true";
static int borderpx = 2; static int borderpx = 2;
/* /*

View File

@ -5,7 +5,8 @@
* *
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/ */
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; static char *font =
"Liberation Mono:pixelsize=12:antialias=true:autohint=true";
static int borderpx = 2; static int borderpx = 2;
/* /*

View File

@ -43,8 +43,8 @@ void selscroll(int orig, int n) {
sel.ob.y += n; sel.ob.y += n;
sel.oe.y += n; sel.oe.y += n;
if (sel.ob.y < term.top || sel.ob.y > term.bot || sel.oe.y < term.top || if (sel.ob.y < term.top || sel.ob.y > term.bot ||
sel.oe.y > term.bot) { sel.oe.y < term.top || sel.oe.y > term.bot) {
selclear(); selclear();
} else { } else {

View File

@ -203,8 +203,8 @@ static pid_t pid;
* @param p_file_desc file descriptor to write to; same logic as write * @param p_file_desc file descriptor to write to; same logic as write
* @param p_str char array to write to the file descriptor * @param p_str char array to write to the file descriptor
* @param p_nbytes amount of bytes to write * @param p_nbytes amount of bytes to write
* @return p_nbytes if the write was successful, otherwise return negative error * @return p_nbytes if the write was successful, otherwise return negative
* value of write * error value of write
*/ */
ssize_t xwrite(int p_file_desc, const char *p_str, size_t p_nbytes) { ssize_t xwrite(int p_file_desc, const char *p_str, size_t p_nbytes) {
size_t aux = p_nbytes; size_t aux = p_nbytes;
@ -378,9 +378,11 @@ int selected(int x, int y) {
return 0; return 0;
if (sel.type == SEL_RECTANGULAR) if (sel.type == SEL_RECTANGULAR)
return BETWEEN(y, sel.nb.y, sel.ne.y) && BETWEEN(x, sel.nb.x, sel.ne.x); return BETWEEN(y, sel.nb.y, sel.ne.y) &&
BETWEEN(x, sel.nb.x, sel.ne.x);
return BETWEEN(y, sel.nb.y, sel.ne.y) && (y != sel.nb.y || x >= sel.nb.x) && return BETWEEN(y, sel.nb.y, sel.ne.y) &&
(y != sel.nb.y || x >= sel.nb.x) &&
(y != sel.ne.y || x <= sel.ne.x); (y != sel.ne.y || x <= sel.ne.x);
} }
@ -1076,7 +1078,8 @@ int32_t tdefcolor(int *attr, int *npar, int l) {
switch (attr[*npar + 1]) { switch (attr[*npar + 1]) {
case 2: /* direct color in RGB space */ case 2: /* direct color in RGB space */
if (*npar + 4 >= l) { if (*npar + 4 >= l) {
fprintf(stderr, "erresc(38): Incorrect number of parameters (%d)\n", fprintf(stderr,
"erresc(38): Incorrect number of parameters (%d)\n",
*npar); *npar);
break; break;
} }
@ -1091,7 +1094,8 @@ int32_t tdefcolor(int *attr, int *npar, int l) {
break; break;
case 5: /* indexed color */ case 5: /* indexed color */
if (*npar + 2 >= l) { if (*npar + 2 >= l) {
fprintf(stderr, "erresc(38): Incorrect number of parameters (%d)\n", fprintf(stderr,
"erresc(38): Incorrect number of parameters (%d)\n",
*npar); *npar);
break; break;
} }

View File

@ -82,7 +82,9 @@ size_t utf8encode(Rune p_rune, char *p_char) {
return len; return len;
} }
char utf8encodebyte(Rune u, size_t i) { return utfbyte[i] | (u & ~utfmask[i]); } char utf8encodebyte(Rune u, size_t i) {
return utfbyte[i] | (u & ~utfmask[i]);
}
/** /**
* Check if a given rune is a valid UTF-8 rune * Check if a given rune is a valid UTF-8 rune

74
src/x.c
View File

@ -144,7 +144,8 @@ typedef struct {
static inline ushort sixd_to_16bit(int); static inline ushort sixd_to_16bit(int);
static int xmakeglyphfontspecs(XftGlyphFontSpec *, const Glyph *, int, int, static int xmakeglyphfontspecs(XftGlyphFontSpec *, const Glyph *, int, int,
int); int);
static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int); static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int,
int);
static void xdrawglyph(Glyph, int, int); static void xdrawglyph(Glyph, int, int);
static void xclear(int, int, int, int); static void xclear(int, int, int, int);
static int xgeommasktogravity(int); static int xgeommasktogravity(int);
@ -374,16 +375,17 @@ void mousereport(XEvent *e) {
} }
if (!IS_SET(MODE_MOUSEX10)) { if (!IS_SET(MODE_MOUSEX10)) {
button += ((state & ShiftMask) ? 4 : 0) + ((state & Mod4Mask) ? 8 : 0) + button += ((state & ShiftMask) ? 4 : 0) +
((state & Mod4Mask) ? 8 : 0) +
((state & ControlMask) ? 16 : 0); ((state & ControlMask) ? 16 : 0);
} }
if (IS_SET(MODE_MOUSESGR)) { if (IS_SET(MODE_MOUSESGR)) {
len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c", button, x + 1, y + 1, len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c", button, x + 1,
e->xbutton.type == ButtonRelease ? 'm' : 'M'); y + 1, e->xbutton.type == ButtonRelease ? 'm' : 'M');
} else if (x < 223 && y < 223) { } else if (x < 223 && y < 223) {
len = snprintf(buf, sizeof(buf), "\033[M%c%c%c", 32 + button, 32 + x + 1, len = snprintf(buf, sizeof(buf), "\033[M%c%c%c", 32 + button,
32 + y + 1); 32 + x + 1, 32 + y + 1);
} else { } else {
return; return;
} }
@ -479,9 +481,9 @@ void selnotify(XEvent *e) {
return; return;
do { do {
if (XGetWindowProperty(xw.dpy, xw.win, property, ofs, BUFSIZ / 4, False, if (XGetWindowProperty(xw.dpy, xw.win, property, ofs, BUFSIZ / 4,
AnyPropertyType, &type, &format, &nitems, &rem, False, AnyPropertyType, &type, &format, &nitems,
&data)) { &rem, &data)) {
fprintf(stderr, "Clipboard allocation failed\n"); fprintf(stderr, "Clipboard allocation failed\n");
return; return;
} }
@ -569,8 +571,8 @@ void selrequest(XEvent *e) {
if (xsre->target == xa_targets) { if (xsre->target == xa_targets) {
/* respond with the supported type */ /* respond with the supported type */
string = xsel.xtarget; string = xsel.xtarget;
XChangeProperty(xsre->display, xsre->requestor, xsre->property, XA_ATOM, 32, XChangeProperty(xsre->display, xsre->requestor, xsre->property,
PropModeReplace, (uchar *)&string, 1); XA_ATOM, 32, PropModeReplace, (uchar *)&string, 1);
xev.property = xsre->property; xev.property = xsre->property;
} else if (xsre->target == xsel.xtarget || xsre->target == XA_STRING) { } else if (xsre->target == xsel.xtarget || xsre->target == XA_STRING) {
/* /*
@ -583,7 +585,8 @@ void selrequest(XEvent *e) {
} else if (xsre->selection == clipboard) { } else if (xsre->selection == clipboard) {
seltext = xsel.clipboard; seltext = xsel.clipboard;
} else { } else {
fprintf(stderr, "Unhandled clipboard selection 0x%lx\n", xsre->selection); fprintf(stderr, "Unhandled clipboard selection 0x%lx\n",
xsre->selection);
return; return;
} }
if (seltext != NULL) { if (seltext != NULL) {
@ -657,8 +660,8 @@ void xresize(int col, int row) {
win.th = row * win.ch; win.th = row * win.ch;
XFreePixmap(xw.dpy, xw.buf); XFreePixmap(xw.dpy, xw.buf);
xw.buf = xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
XCreatePixmap(xw.dpy, xw.win, win.w, win.h, DefaultDepth(xw.dpy, xw.scr)); DefaultDepth(xw.dpy, xw.scr));
XftDrawChange(xw.draw, xw.buf); XftDrawChange(xw.draw, xw.buf);
xclear(0, 0, win.w, win.h); xclear(0, 0, win.w, win.h);
@ -950,12 +953,13 @@ int ximopen(Display *dpy) {
fprintf(stderr, "XSetIMValues: " fprintf(stderr, "XSetIMValues: "
"Could not set XNDestroyCallback.\n"); "Could not set XNDestroyCallback.\n");
xw.ime.spotlist = XVaCreateNestedList(0, XNSpotLocation, &xw.ime.spot, NULL); xw.ime.spotlist =
XVaCreateNestedList(0, XNSpotLocation, &xw.ime.spot, NULL);
if (xw.ime.xic == NULL) { if (xw.ime.xic == NULL) {
xw.ime.xic = XCreateIC(xw.ime.xim, XNInputStyle, xw.ime.xic = XCreateIC(
XIMPreeditNothing | XIMStatusNothing, XNClientWindow, xw.ime.xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
xw.win, XNDestroyCallback, &icdestroy, NULL); XNClientWindow, xw.win, XNDestroyCallback, &icdestroy, NULL);
} }
if (xw.ime.xic == NULL) if (xw.ime.xic == NULL)
fprintf(stderr, "XCreateIC: Could not create input context.\n"); fprintf(stderr, "XCreateIC: Could not create input context.\n");
@ -965,8 +969,8 @@ int ximopen(Display *dpy) {
void ximinstantiate(Display *dpy, XPointer client, XPointer call) { void ximinstantiate(Display *dpy, XPointer client, XPointer call) {
if (ximopen(dpy)) if (ximopen(dpy))
XUnregisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL, ximinstantiate, XUnregisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
NULL); ximinstantiate, NULL);
} }
void ximdestroy(XIM xim, XPointer client, XPointer call) { void ximdestroy(XIM xim, XPointer client, XPointer call) {
@ -1033,8 +1037,8 @@ void xinit(int cols, int rows) {
memset(&gcvalues, 0, sizeof(gcvalues)); memset(&gcvalues, 0, sizeof(gcvalues));
gcvalues.graphics_exposures = False; gcvalues.graphics_exposures = False;
dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, &gcvalues); dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, &gcvalues);
xw.buf = xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
XCreatePixmap(xw.dpy, xw.win, win.w, win.h, DefaultDepth(xw.dpy, xw.scr)); DefaultDepth(xw.dpy, xw.scr));
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
@ -1046,8 +1050,8 @@ void xinit(int cols, int rows) {
/* input methods */ /* input methods */
if (!ximopen(xw.dpy)) { if (!ximopen(xw.dpy)) {
XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL, ximinstantiate, XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
NULL); ximinstantiate, NULL);
} }
/* white cursor, black outline */ /* white cursor, black outline */
@ -1075,8 +1079,8 @@ void xinit(int cols, int rows) {
XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1); XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1);
xw.netwmpid = XInternAtom(xw.dpy, "_NET_WM_PID", False); xw.netwmpid = XInternAtom(xw.dpy, "_NET_WM_PID", False);
XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32, PropModeReplace, XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32,
(uchar *)&thispid, 1); PropModeReplace, (uchar *)&thispid, 1);
win.mode = MODE_NUMLOCK; win.mode = MODE_NUMLOCK;
resettitle(); resettitle();
@ -1155,7 +1159,8 @@ int xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len,
if (glyphidx && frc[f].flags == frcflags) if (glyphidx && frc[f].flags == frcflags)
break; break;
/* We got a default font for a not found glyph. */ /* We got a default font for a not found glyph. */
if (!glyphidx && frc[f].flags == frcflags && frc[f].unicodep == rune) { if (!glyphidx && frc[f].flags == frcflags &&
frc[f].unicodep == rune) {
break; break;
} }
} }
@ -1310,10 +1315,12 @@ void xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len,
/* Intelligent cleaning up of the borders. */ /* Intelligent cleaning up of the borders. */
if (x == 0) { if (x == 0) {
xclear(0, (y == 0) ? 0 : winy, borderpx, xclear(0, (y == 0) ? 0 : winy, borderpx,
winy + win.ch + ((winy + win.ch >= borderpx + win.th) ? win.h : 0)); winy + win.ch +
((winy + win.ch >= borderpx + win.th) ? win.h : 0));
} }
if (winx + width >= borderpx + win.tw) { if (winx + width >= borderpx + win.tw) {
xclear(winx + width, (y == 0) ? 0 : winy, win.w, xclear(
winx + width, (y == 0) ? 0 : winy, win.w,
((winy + win.ch >= borderpx + win.th) ? win.h : (winy + win.ch))); ((winy + win.ch >= borderpx + win.th) ? win.h : (winy + win.ch)));
} }
if (y == 0) if (y == 0)
@ -1340,7 +1347,8 @@ void xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len,
} }
if (base.mode & ATTR_STRUCK) { if (base.mode & ATTR_STRUCK) {
XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3, width, 1); XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3, width,
1);
} }
/* Reset clip to none. */ /* Reset clip to none. */
@ -1369,7 +1377,8 @@ void xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) {
/* /*
* Select the right color for the right mode. * Select the right color for the right mode.
*/ */
g.mode &= ATTR_BOLD | ATTR_ITALIC | ATTR_UNDERLINE | ATTR_STRUCK | ATTR_WIDE; g.mode &=
ATTR_BOLD | ATTR_ITALIC | ATTR_UNDERLINE | ATTR_STRUCK | ATTR_WIDE;
if (IS_SET(MODE_REVERSE)) { if (IS_SET(MODE_REVERSE)) {
g.mode |= ATTR_REVERSE; g.mode |= ATTR_REVERSE;
@ -1754,7 +1763,8 @@ void run(void) {
trigger = now; trigger = now;
drawing = 1; drawing = 1;
} }
timeout = (maxlatency - TIMEDIFF(now, trigger)) / maxlatency * minlatency; timeout = (maxlatency - TIMEDIFF(now, trigger)) / maxlatency *
minlatency;
if (timeout > 0) if (timeout > 0)
continue; /* we have time, try to find idle */ continue; /* we have time, try to find idle */
} }