Fixed clang-format; updated cmakelists
							parent
							
								
									39fd726a51
								
							
						
					
					
						commit
						8d792bbc50
					
				
							
								
								
									
										148
									
								
								.clang-format
								
								
								
								
							
							
						
						
									
										148
									
								
								.clang-format
								
								
								
								
							|  | @ -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 | ||||||
|  | ... | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | @ -0,0 +1,3 @@ | ||||||
|  | #!/usr/bin/env sh | ||||||
|  | 
 | ||||||
|  | make format | ||||||
|  | @ -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 | ||||||
|  |  | ||||||
							
								
								
									
										5
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										5
									
								
								Makefile
								
								
								
								
							|  | @ -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 | ||||||
|  |  | ||||||
|  | @ -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) | ||||||
|  |  | ||||||
|  | @ -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; | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -17,7 +18,7 @@ static int borderpx = 2; | ||||||
|  * 5: value of shell in config.h |  * 5: value of shell in config.h | ||||||
|  */ |  */ | ||||||
| static char *shell = "/bin/sh"; | static char *shell = "/bin/sh"; | ||||||
| char *utmp = NULL; | char *       utmp  = NULL; | ||||||
| /* scroll program: to enable use a string like "scroll" */ | /* scroll program: to enable use a string like "scroll" */ | ||||||
| char *scroll    = NULL; | char *scroll    = NULL; | ||||||
| char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; | char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; | ||||||
|  |  | ||||||
|  | @ -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; | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -17,7 +18,7 @@ static int borderpx = 2; | ||||||
|  * 5: value of shell in config.h |  * 5: value of shell in config.h | ||||||
|  */ |  */ | ||||||
| static char *shell = "/bin/sh"; | static char *shell = "/bin/sh"; | ||||||
| char *utmp = NULL; | char *       utmp  = NULL; | ||||||
| /* scroll program: to enable use a string like "scroll" */ | /* scroll program: to enable use a string like "scroll" */ | ||||||
| char *scroll    = NULL; | char *scroll    = NULL; | ||||||
| char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; | char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; | ||||||
|  |  | ||||||
|  | @ -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 { | ||||||
|  |  | ||||||
							
								
								
									
										40
									
								
								src/st/st.c
								
								
								
								
							
							
						
						
									
										40
									
								
								src/st/st.c
								
								
								
								
							|  | @ -93,9 +93,9 @@ typedef struct { | ||||||
| typedef struct { | typedef struct { | ||||||
|     int     row;        /* nb row */ |     int     row;        /* nb row */ | ||||||
|     int     col;        /* nb col */ |     int     col;        /* nb col */ | ||||||
|     Line *line;      /* screen */ |     Line *  line;       /* screen */ | ||||||
|     Line *alt;       /* alternate screen */ |     Line *  alt;        /* alternate screen */ | ||||||
|     int *dirty;      /* dirtyness of lines */ |     int *   dirty;      /* dirtyness of lines */ | ||||||
|     TCursor c;          /* cursor */ |     TCursor c;          /* cursor */ | ||||||
|     int     ocx;        /* old cursor col */ |     int     ocx;        /* old cursor col */ | ||||||
|     int     ocy;        /* old cursor row */ |     int     ocy;        /* old cursor row */ | ||||||
|  | @ -106,7 +106,7 @@ typedef struct { | ||||||
|     char    trantbl[4]; /* charset table translation */ |     char    trantbl[4]; /* charset table translation */ | ||||||
|     int     charset;    /* current charset */ |     int     charset;    /* current charset */ | ||||||
|     int     icharset;   /* selected charset for sequence */ |     int     icharset;   /* selected charset for sequence */ | ||||||
|     int *tabs; |     int *   tabs; | ||||||
|     Rune    lastc; /* last printed char outside of sequence, 0 if control */ |     Rune    lastc; /* last printed char outside of sequence, 0 if control */ | ||||||
| } Term; | } Term; | ||||||
| 
 | 
 | ||||||
|  | @ -125,10 +125,10 @@ typedef struct { | ||||||
| /* ESC type [[ [<priv>] <arg> [;]] <mode>] ESC '\' */ | /* ESC type [[ [<priv>] <arg> [;]] <mode>] ESC '\' */ | ||||||
| typedef struct { | typedef struct { | ||||||
|     char   type; /* ESC type ... */ |     char   type; /* ESC type ... */ | ||||||
|     char *buf;  /* allocated raw string */ |     char * buf;  /* allocated raw string */ | ||||||
|     size_t siz;  /* allocation size */ |     size_t siz;  /* allocation size */ | ||||||
|     size_t len;  /* raw string length */ |     size_t len;  /* raw string length */ | ||||||
|     char *args[STR_ARG_SIZ]; |     char * args[STR_ARG_SIZ]; | ||||||
|     int    narg; /* nb of args */ |     int    narg; /* nb of args */ | ||||||
| } STREscape; | } STREscape; | ||||||
| 
 | 
 | ||||||
|  | @ -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; | ||||||
|  | @ -290,7 +290,7 @@ char base64dec_getc(const char **src) { | ||||||
| 
 | 
 | ||||||
| char *base64dec(const char *src) { | char *base64dec(const char *src) { | ||||||
|     size_t in_len = strlen(src); |     size_t in_len = strlen(src); | ||||||
|     char *result, *dst; |     char * result, *dst; | ||||||
| 
 | 
 | ||||||
|     if (in_len % 4) |     if (in_len % 4) | ||||||
|         in_len += 4 - (in_len % 4); |         in_len += 4 - (in_len % 4); | ||||||
|  | @ -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); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -454,7 +456,7 @@ void selsnap(int *x, int *y, int direction) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| char *getsel(void) { | char *getsel(void) { | ||||||
|     char *str, *ptr; |     char * str, *ptr; | ||||||
|     int    y, bufsize, lastx, linelen; |     int    y, bufsize, lastx, linelen; | ||||||
|     Glyph *gp, *last; |     Glyph *gp, *last; | ||||||
| 
 | 
 | ||||||
|  | @ -516,7 +518,7 @@ void die(const char *errstr, ...) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void execsh(char *cmd, char **args) { | void execsh(char *cmd, char **args) { | ||||||
|     char *sh, *prog, *arg; |     char *               sh, *prog, *arg; | ||||||
|     const struct passwd *pw; |     const struct passwd *pw; | ||||||
| 
 | 
 | ||||||
|     errno = 0; |     errno = 0; | ||||||
|  | @ -919,7 +921,7 @@ void tnewline(int first_col) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void csiparse(void) { | void csiparse(void) { | ||||||
|     char *p = csiescseq.buf, *np; |     char *   p = csiescseq.buf, *np; | ||||||
|     long int v; |     long int v; | ||||||
| 
 | 
 | ||||||
|     csiescseq.narg = 0; |     csiescseq.narg = 0; | ||||||
|  | @ -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; | ||||||
|         } |         } | ||||||
|  | @ -1772,7 +1776,7 @@ void tdefutf8(char ascii) { | ||||||
| void tdeftran(char ascii) { | void tdeftran(char ascii) { | ||||||
|     static char cs[]  = "0B"; |     static char cs[]  = "0B"; | ||||||
|     static int  vcs[] = {CS_GRAPHIC0, CS_USA}; |     static int  vcs[] = {CS_GRAPHIC0, CS_USA}; | ||||||
|     char *p; |     char *      p; | ||||||
| 
 | 
 | ||||||
|     if ((p = strchr(cs, ascii)) == NULL) { |     if ((p = strchr(cs, ascii)) == NULL) { | ||||||
|         fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii); |         fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii); | ||||||
|  | @ -2160,7 +2164,7 @@ void tresize(int col, int row) { | ||||||
|     int     i; |     int     i; | ||||||
|     int     minrow = MIN(row, term.row); |     int     minrow = MIN(row, term.row); | ||||||
|     int     mincol = MIN(col, term.col); |     int     mincol = MIN(col, term.col); | ||||||
|     int *bp; |     int *   bp; | ||||||
|     TCursor c; |     TCursor c; | ||||||
| 
 | 
 | ||||||
|     if (col < 1 || row < 1) { |     if (col < 1 || row < 1) { | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								src/st/st.h
								
								
								
								
							
							
						
						
									
										12
									
								
								src/st/st.h
								
								
								
								
							|  | @ -79,14 +79,14 @@ void *safe_realloc(void *, size_t); | ||||||
| char *safe_strdup(char *); | char *safe_strdup(char *); | ||||||
| 
 | 
 | ||||||
| /* config.h globals */ | /* config.h globals */ | ||||||
| extern char *utmp; | extern char *       utmp; | ||||||
| extern char *scroll; | extern char *       scroll; | ||||||
| extern char *stty_args; | extern char *       stty_args; | ||||||
| extern char *vtiden; | extern char *       vtiden; | ||||||
| extern wchar_t *worddelimiters; | extern wchar_t *    worddelimiters; | ||||||
| extern int          allowaltscreen; | extern int          allowaltscreen; | ||||||
| extern int          allowwindowops; | extern int          allowwindowops; | ||||||
| extern char *termname; | extern char *       termname; | ||||||
| extern unsigned int tabspaces; | extern unsigned int tabspaces; | ||||||
| extern unsigned int defaultfg; | extern unsigned int defaultfg; | ||||||
| extern unsigned int defaultbg; | extern unsigned int defaultbg; | ||||||
|  |  | ||||||
|  | @ -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 | ||||||
|  |  | ||||||
							
								
								
									
										112
									
								
								src/x.c
								
								
								
								
							
							
						
						
									
										112
									
								
								src/x.c
								
								
								
								
							|  | @ -40,7 +40,7 @@ typedef struct { | ||||||
| typedef struct { | typedef struct { | ||||||
|     KeySym k; |     KeySym k; | ||||||
|     uint   mask; |     uint   mask; | ||||||
|   char *s; |     char * s; | ||||||
|     /* three-valued logic variables: 0 indifferent, 1 on, -1 off */ |     /* three-valued logic variables: 0 indifferent, 1 on, -1 off */ | ||||||
|     signed char appkey;    /* application keypad */ |     signed char appkey;    /* application keypad */ | ||||||
|     signed char appcursor; /* application cursor */ |     signed char appcursor; /* application cursor */ | ||||||
|  | @ -74,7 +74,7 @@ static void ttysend(const Arg *); | ||||||
| #define TRUEGREEN(x) (((x)&0xff00)) | #define TRUEGREEN(x) (((x)&0xff00)) | ||||||
| #define TRUEBLUE(x)  (((x)&0xff) << 8) | #define TRUEBLUE(x)  (((x)&0xff) << 8) | ||||||
| 
 | 
 | ||||||
| typedef XftDraw *Draw; | typedef XftDraw *        Draw; | ||||||
| typedef XftColor         Color; | typedef XftColor         Color; | ||||||
| typedef XftGlyphFontSpec GlyphFontSpec; | typedef XftGlyphFontSpec GlyphFontSpec; | ||||||
| 
 | 
 | ||||||
|  | @ -89,7 +89,7 @@ typedef struct { | ||||||
| } TermWindow; | } TermWindow; | ||||||
| 
 | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
|   Display *dpy; |     Display *      dpy; | ||||||
|     Colormap       cmap; |     Colormap       cmap; | ||||||
|     Window         win; |     Window         win; | ||||||
|     Drawable       buf; |     Drawable       buf; | ||||||
|  | @ -102,7 +102,7 @@ typedef struct { | ||||||
|         XVaNestedList spotlist; |         XVaNestedList spotlist; | ||||||
|     } ime; |     } ime; | ||||||
|     Draw                 draw; |     Draw                 draw; | ||||||
|   Visual *vis; |     Visual *             vis; | ||||||
|     XSetWindowAttributes attrs; |     XSetWindowAttributes attrs; | ||||||
|     int                  scr; |     int                  scr; | ||||||
|     int                  isfixed; /* is fixed geometry? */ |     int                  isfixed; /* is fixed geometry? */ | ||||||
|  | @ -112,7 +112,7 @@ typedef struct { | ||||||
| 
 | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
|     Atom            xtarget; |     Atom            xtarget; | ||||||
|   char *primary, *clipboard; |     char *          primary, *clipboard; | ||||||
|     struct timespec tclick1; |     struct timespec tclick1; | ||||||
|     struct timespec tclick2; |     struct timespec tclick2; | ||||||
| } XSelection; | } XSelection; | ||||||
|  | @ -128,7 +128,7 @@ typedef struct { | ||||||
|     int        badweight; |     int        badweight; | ||||||
|     short      lbearing; |     short      lbearing; | ||||||
|     short      rbearing; |     short      rbearing; | ||||||
|   XftFont *match; |     XftFont *  match; | ||||||
|     FcFontSet *set; |     FcFontSet *set; | ||||||
|     FcPattern *pattern; |     FcPattern *pattern; | ||||||
| } Font; | } Font; | ||||||
|  | @ -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); | ||||||
|  | @ -236,18 +237,18 @@ typedef struct { | ||||||
| static Fontcache *frc             = NULL; | static Fontcache *frc             = NULL; | ||||||
| static int        frclen          = 0; | static int        frclen          = 0; | ||||||
| static int        frccap          = 0; | static int        frccap          = 0; | ||||||
| static char *usedfont = NULL; | static char *     usedfont        = NULL; | ||||||
| static double     usedfontsize    = 0; | static double     usedfontsize    = 0; | ||||||
| static double     defaultfontsize = 0; | static double     defaultfontsize = 0; | ||||||
| 
 | 
 | ||||||
| static char *opt_class = NULL; | static char * opt_class = NULL; | ||||||
| static char **opt_cmd   = NULL; | static char **opt_cmd   = NULL; | ||||||
| static char *opt_embed = NULL; | static char * opt_embed = NULL; | ||||||
| static char *opt_font = NULL; | static char * opt_font  = NULL; | ||||||
| static char *opt_io = NULL; | static char * opt_io    = NULL; | ||||||
| static char *opt_line = NULL; | static char * opt_line  = NULL; | ||||||
| static char *opt_name = NULL; | static char * opt_name  = NULL; | ||||||
| static char *opt_title = NULL; | static char * opt_title = NULL; | ||||||
| 
 | 
 | ||||||
| static int oldbutton = 3; /* button event on startup: 3 = release */ | static int oldbutton = 3; /* button event on startup: 3 = release */ | ||||||
| 
 | 
 | ||||||
|  | @ -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; | ||||||
|         } |         } | ||||||
|  | @ -551,7 +553,7 @@ void selrequest(XEvent *e) { | ||||||
|     XSelectionRequestEvent *xsre; |     XSelectionRequestEvent *xsre; | ||||||
|     XSelectionEvent         xev; |     XSelectionEvent         xev; | ||||||
|     Atom                    xa_targets, string, clipboard; |     Atom                    xa_targets, string, clipboard; | ||||||
|   char *seltext; |     char *                  seltext; | ||||||
| 
 | 
 | ||||||
|     xsre          = (XSelectionRequestEvent *)e; |     xsre          = (XSelectionRequestEvent *)e; | ||||||
|     xev.type      = SelectionNotify; |     xev.type      = SelectionNotify; | ||||||
|  | @ -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); | ||||||
| 
 | 
 | ||||||
|  | @ -692,7 +695,7 @@ int xloadcolor(int i, const char *name, Color *ncolor) { | ||||||
| void xloadcols(void) { | void xloadcols(void) { | ||||||
|     int        i; |     int        i; | ||||||
|     static int loaded; |     static int loaded; | ||||||
|   Color *cp; |     Color *    cp; | ||||||
| 
 | 
 | ||||||
|     if (loaded) { |     if (loaded) { | ||||||
|         for (cp = dc.col; cp < &dc.col[dc.collen]; ++cp) |         for (cp = dc.col; cp < &dc.col[dc.collen]; ++cp) | ||||||
|  | @ -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(); | ||||||
|  | @ -1097,7 +1101,7 @@ int xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, | ||||||
|                         int x, int y) { |                         int x, int y) { | ||||||
|     float   winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp; |     float   winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp; | ||||||
|     ushort  mode, prevmode                     = USHRT_MAX; |     ushort  mode, prevmode                     = USHRT_MAX; | ||||||
|   Font *font = &dc.font; |     Font *  font      = &dc.font; | ||||||
|     int     frcflags  = FRC_NORMAL; |     int     frcflags  = FRC_NORMAL; | ||||||
|     float   runewidth = win.cw; |     float   runewidth = win.cw; | ||||||
|     Rune    rune; |     Rune    rune; | ||||||
|  | @ -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; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | @ -1223,7 +1228,7 @@ void xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, | ||||||
|     int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1); |     int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1); | ||||||
|     int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, |     int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, | ||||||
|         width = charlen * win.cw; |         width = charlen * win.cw; | ||||||
|   Color *fg, *bg, *temp, revfg, revbg, truefg, truebg; |     Color *      fg, *bg, *temp, revfg, revbg, truefg, truebg; | ||||||
|     XRenderColor colfg, colbg; |     XRenderColor colfg, colbg; | ||||||
|     XRectangle   r; |     XRectangle   r; | ||||||
| 
 | 
 | ||||||
|  | @ -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; | ||||||
|  | @ -1613,7 +1622,7 @@ void kpress(XEvent *ev) { | ||||||
|     int        len; |     int        len; | ||||||
|     Rune       c; |     Rune       c; | ||||||
|     Status     status; |     Status     status; | ||||||
|   Shortcut *bp; |     Shortcut * bp; | ||||||
| 
 | 
 | ||||||
|     if (IS_SET(MODE_KBDLOCK)) |     if (IS_SET(MODE_KBDLOCK)) | ||||||
|         return; |         return; | ||||||
|  | @ -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 */ | ||||||
|         } |         } | ||||||
|  |  | ||||||
		Reference in New Issue