Skip to content

Commit

Permalink
Merge branch 'main' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Dec 16, 2024
2 parents 1fad053 + 10d96af commit 226a22b
Show file tree
Hide file tree
Showing 9 changed files with 184 additions and 70 deletions.
231 changes: 165 additions & 66 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,124 +1,223 @@
---
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: AcrossEmptyLines
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignArrayOfStructures: Left
AlignConsecutiveAssignments:
AcrossComments: false
AcrossEmptyLines: false
AlignCompound: false
AlignFunctionPointers: false
Enabled: false
PadOperators: true
AlignConsecutiveBitFields:
AcrossComments: false
AcrossEmptyLines: false
AlignCompound: false
AlignFunctionPointers: false
Enabled: false
PadOperators: true
AlignConsecutiveDeclarations:
AcrossComments: false
AcrossEmptyLines: false
AlignCompound: false
AlignFunctionPointers: false
Enabled: false
PadOperators: true
AlignConsecutiveMacros:
AcrossComments: false
AcrossEmptyLines: true
AlignCompound: false
AlignFunctionPointers: false
Enabled: true
PadOperators: true
AlignConsecutiveShortCaseStatements:
AcrossComments: true
AcrossEmptyLines: true
AlignCaseArrows: true
AlignCaseColons: false
Enabled: true
AlignConsecutiveTableGenCondOperatorColons:
AcrossComments: false
AcrossEmptyLines: false
AlignCompound: false
AlignFunctionPointers: false
Enabled: false
PadOperators: false
AlignConsecutiveTableGenDefinitionColons:
AcrossComments: false
AcrossEmptyLines: false
AlignCompound: false
AlignFunctionPointers: false
Enabled: false
PadOperators: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterEnum: false
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterReturnType: None
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: AfterComma
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakFunctionDefinitionParameters: false
BreakInheritanceList: AfterComma
BreakStringLiterals: false
ColumnLimit: 80
BreakTemplateDeclarations: Yes
ColumnLimit: 100
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: false
DeriveLineEnding: false
DerivePointerAlignment: false
DisableFormat: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
IncludeBlocks: Preserve
IndentCaseLabels: true
IncludeBlocks: Preserve
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: BeforeHash
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 2
IndentRequiresClause: false
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
KeepEmptyLinesAtTheStartOfBlocks: false
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
KeepEmptyLines:
AtEndOfFile: false
AtStartOfBlock: false
AtStartOfFile: true
LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MainIncludeChar: Quote
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: 1000
PackConstructorInitializers: CurrentLine
PenaltyBreakAssignment: 50
PenaltyBreakBeforeFirstCallParameter: 2
PenaltyBreakComment: 30
PenaltyBreakFirstLessLess: 12
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 100
PenaltyBreakTemplateDeclaration: 1
PenaltyExcessCharacter: 100
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: false
SortIncludes: true
SortUsingDeclarations: true
PPIndentWidth: -1
QualifierAlignment: Left
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseSensitive
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
ExceptDoubleParentheses: false
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: c++17
TabWidth: 8
UseCRLF: false
UseTab: Never
...
Standard: c++17
TabWidth: 8
UseTab: Never
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
rev: v19.1.5
hooks:
- id: clang-format
files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx)$
files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm)$
types_or: [text]

- repo: https://github.com/pocc/pre-commit-hooks
Expand Down
4 changes: 4 additions & 0 deletions base/base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

namespace base {

// clang-format off

static const char base64Table[] = "ABCDEFGHIJKLMNOP"
"QRSTUVWXYZabcdef"
"ghijklmnopqrstuv"
Expand All @@ -36,6 +38,8 @@ static const int invBase64Table[] = {
// From 112 to 122 'z'
41,42,43,44,45,46,47,48,49,50,51 };

// clang-format on

static inline char base64Char(int index)
{
ASSERT(index >= 0 && index < 64);
Expand Down
1 change: 1 addition & 0 deletions base/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ char* base_strdup(const char* string)

#ifdef _MSC_VER
#include <windows.h>

#include <dbghelp.h>

typedef USHORT (WINAPI* RtlCaptureStackBackTraceType)(ULONG, ULONG, PVOID*, PULONG);
Expand Down
1 change: 1 addition & 0 deletions base/memory_dump_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#if LAF_WINDOWS
#include <windows.h>

#include <dbghelp.h>
#endif

Expand Down
3 changes: 2 additions & 1 deletion base/scoped_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ namespace base {
public:
ScopedValue(T& instance, const U inValue)
: m_instance(instance)
, m_outValue(instance) { // Restore the current value
// Restore the current value
, m_outValue(instance) {
m_instance = inValue;
}

Expand Down
1 change: 1 addition & 0 deletions os/skia/skia_window_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#if SK_SUPPORT_GPU
#if LAF_WINDOWS
#include <windows.h>

#include <GL/gl.h>
#elif LAF_MACOS
#include <OpenGL/gl.h>
Expand Down
10 changes: 8 additions & 2 deletions os/win/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ static PointerType wt_packet_pkcursor_to_pointer_type(int pkCursor)
case 0: return PointerType::Cursor;
case 1: return PointerType::Pen;
case 2: return PointerType::Eraser;
// TODO check if pkCursor=6 to notify about an inverted
// stylus/eraser if we enable EnableMouseInPointer()
default:
// TODO check if pkCursor=6 to notify about an inverted
// stylus/eraser if we enable EnableMouseInPointer()
break;
}
// Impossible case (negative pkCursor?)
ASSERT(false);
Expand Down Expand Up @@ -801,6 +803,7 @@ std::string WindowWin::getLayout()
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
if (GetWindowPlacement(m_hwnd, &wp)) {
// clang-format off
std::ostringstream s;
s << 1 << ' '
<< wp.flags << ' '
Expand All @@ -814,6 +817,7 @@ std::string WindowWin::getLayout()
<< wp.rcNormalPosition.right << ' '
<< wp.rcNormalPosition.bottom;
return s.str();
// clang-format on
}
return "";
}
Expand All @@ -827,6 +831,7 @@ void WindowWin::setLayout(const std::string& layout)
int ver;
s >> ver;
if (ver == 1) {
// clang-format off
s >> wp.flags
>> wp.showCmd
>> wp.ptMinPosition.x
Expand All @@ -837,6 +842,7 @@ void WindowWin::setLayout(const std::string& layout)
>> wp.rcNormalPosition.top
>> wp.rcNormalPosition.right
>> wp.rcNormalPosition.bottom;
// clang-format on
}
else
return;
Expand Down
Loading

0 comments on commit 226a22b

Please sign in to comment.