Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
- apply precommit hooks
- make sure all files contain a newline at EOF
- remove trailing whitespace (for non-markdown files)
  • Loading branch information
ardera committed Apr 8, 2023
1 parent 3bd8699 commit ad4cabd
Show file tree
Hide file tree
Showing 60 changed files with 604 additions and 604 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
include:
- enable-vulkan: 'on'
vulkan-deps: 'libvulkan-dev'

- compiler: 'clang'
clang-deps: 'clang'
steps:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Test
working-directory: build
run: ctest -C ${{ matrix.build-type }} --output-on-failure

container:
name: Build & Test in Container
runs-on: ubuntu-latest
Expand All @@ -91,12 +91,12 @@ jobs:
include:
- enable-vulkan: 'on'
vulkan-deps: 'libvulkan-dev'

- compiler: 'clang'
clang-deps: 'clang'
steps:
# git needs to be installed before checking out, otherwise the checkout will fallback to the REST API,
# and the submodule download won't work.
# and the submodule download won't work.
- name: Install dependencies
run: |
apt-get update && apt-get install -y \
Expand Down Expand Up @@ -129,4 +129,3 @@ jobs:
- name: Test
working-directory: build
run: ctest -C ${{ matrix.build-type }} --output-on-failure

4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
exclude_types: ['markdown']
- id: forbid-new-submodules
- id: mixed-line-ending
args: ['--fix=lf']
description: Forces to replace line ending by the UNIX 'lf' character.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ target_compile_definitions(flutterpi_module PRIVATE
LIBINPUT_VERSION_PATCH=${LIBINPUT_VERSION_PATCH}
)

# TODO: Just unconditionally define those, make them optional later
# TODO: Just unconditionally define those, make them optional later
target_compile_definitions(flutterpi_module PRIVATE HAS_KMS HAS_GBM HAS_FBDEV)

pkg_check_modules(EGL IMPORTED_TARGET egl)
Expand Down Expand Up @@ -259,7 +259,7 @@ else()
if(NOT ogl_registry_POPULATED)
FetchContent_Populate(ogl_registry)
endif()

target_include_directories(flutterpi_module PRIVATE ${ogl_registry_SOURCE_DIR}/api/)
endif()

Expand Down Expand Up @@ -485,37 +485,37 @@ if(LTO AND (CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL RelWi
if (NOT IPO_SUPPORTED)
message(WARNING "IPO/LTO was requested in the configure options, but is not supported by the toolchain. Check CMakeFiles/CMakeError.log for details.")
endif()

# Try to enable IPO with gold and lld.
# Needs CMP0138.
# (untested because CMP0138 required CMake 3.24, that's why it's commented out)
# if (NOT IPO_SUPPORTED)
# check_linker_flag(C "-fuse-ld=gold" SUPPORTS_GOLD)
# if (SUPPORTS_GOLD)
# set(OLD_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
#
#
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
# try_compile()
# check_ipo_supported(RESULT IPO_SUPPORTED_WITH_GOLD OUTPUT IPO_SUPPORT_OUTPUT)
# if (IPO_SUPPORTED_WITH_GOLD)
# set(IPO_SUPPORTED ON)
# set(NEEDS_GOLD ON)
# endif()
#
#
# set(CMAKE_C_FLAGS "${OLD_CMAKE_C_FLAGS}")
# endif()
#
# check_linker_flag(C "-fuse-ld=lld" SUPPORTS_LLD)
# if (SUPPORTS_LLD)
# set(OLD_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
#
#
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=lld")
# check_ipo_supported(RESULT IPO_SUPPORTED_WITH_LLD OUTPUT IPO_SUPPORT_OUTPUT)
# if (IPO_SUPPORTED_WITH_LLD)
# set(IPO_SUPPORTED ON)
# set(NEEDS_LLD ON)
# endif()
#
#
# set(CMAKE_C_FLAGS "${OLD_CMAKE_C_FLAGS}")
# endif()
# endif()
Expand All @@ -528,7 +528,7 @@ if(LTO AND (CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL RelWi
set(IPO_SUPPORTED OFF)
endif()
endif()

if (IPO_SUPPORTED)
set(USE_LTO ON)
endif()
Expand Down
22 changes: 11 additions & 11 deletions include/collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct concurrent_queue {

struct pointer_set {
/**
* @brief The number of non-NULL pointers currently stored in @ref pointers.
* @brief The number of non-NULL pointers currently stored in @ref pointers.
*/
size_t count_pointers;

Expand Down Expand Up @@ -351,7 +351,7 @@ static inline int cpset_remove_locked(
struct concurrent_pointer_set *set,
const void *pointer
) {
return pset_remove(&set->set, pointer);
return pset_remove(&set->set, pointer);
}

static inline int cpset_remove(
Expand Down Expand Up @@ -540,7 +540,7 @@ static inline bool refcount_is_zero(refcount_t *refcount) {
}

/// Get the current reference count, without any memory ordering restrictions.
/// Not strictly correct, should only be used for debugging.
/// Not strictly correct, should only be used for debugging.
static inline int refcount_get_for_debug(refcount_t *refcount) {
return atomic_load_explicit(refcount, memory_order_relaxed);
}
Expand Down Expand Up @@ -749,7 +749,7 @@ typedef void (*void_callback_t)(void *userdata);

/**
* @brief A 2-dimensional vector with 2 float coordinates.
*
*
*/
struct vec2f {
double x, y;
Expand All @@ -762,14 +762,14 @@ ATTR_CONST static inline struct vec2f vec2f_add(struct vec2f a, struct vec2f b)
}

struct vec2i {
int x, y;
int x, y;
};

#define VEC2I(_x, _y) ((struct vec2i) {.x = (_x), .y = (_y)})

/**
* @brief A quadrilateral with 4 2-dimensional float coordinates.
*
*
*/
struct quad {
struct vec2f top_left, top_right, bottom_left, bottom_right;
Expand Down Expand Up @@ -852,8 +852,8 @@ struct mat3f {

/**
* @brief Returns a matrix that is the result of matrix-multiplying a with b.
*
* @param a The first (lhs) input matrix.
*
* @param a The first (lhs) input matrix.
* @param b The second (rhs) input matrix.
* @return struct mat3f The product of a x b.
*/
Expand All @@ -873,7 +873,7 @@ ATTR_CONST static inline struct mat3f multiply_mat3f(const struct mat3f a, const

/**
* @brief Returns a matrix that is the result of element-wise addition of a and b.
*
*
* @param a The lhs input matrix.
* @param b The rhs input matrix.
* @return struct mat3f The result of a + b. (element-wise)
Expand All @@ -888,7 +888,7 @@ ATTR_CONST static inline struct mat3f add_mat3f(const struct mat3f a, const stru

/**
* @brief Returns the transponated of a.
*
*
* @param a The input matrix.
* @return struct mat3f a transponated.
*/
Expand All @@ -902,7 +902,7 @@ ATTR_CONST static inline struct mat3f transponate_mat3f(const struct mat3f a) {

ATTR_CONST static inline struct vec2f transform_point(const struct mat3f transform, const struct vec2f point) {
return VEC2F(
transform.scaleX*point.x + transform.skewX*point.y + transform.transX,
transform.scaleX*point.x + transform.skewX*point.y + transform.transX,
transform.skewY*point.x + transform.scaleY*point.y + transform.transY
);
}
Expand Down
12 changes: 6 additions & 6 deletions include/compositor.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ struct compositor {
/**
* @brief Contains a struct for each existing platform view, containing the view id
* and platform view callbacks.
*
*
* @see compositor_set_view_callbacks compositor_remove_view_callbacks
*/
struct concurrent_pointer_set cbs;

/**
* @brief Whether the compositor should invoke @ref rendertarget_gbm_new the next time
* flutter creates a backing store. Otherwise @ref rendertarget_nogbm_new is invoked.
*
*
* It's only possible to have at most one GBM-Surface backed backing store (== @ref rendertarget_gbm). So the first
* time @ref on_create_backing_store is invoked, a GBM-Surface backed backing store is returned and after that,
* only backing stores with @ref rendertarget_nogbm.
Expand All @@ -61,7 +61,7 @@ struct compositor {
/**
* @brief A cache of rendertargets that are not currently in use for
* any flutter layers and can be reused.
*
*
* Make sure to destroy all stale rendertargets before presentation so all the DRM planes
* that are reserved by any stale rendertargets get freed.
*/
Expand All @@ -77,10 +77,10 @@ struct compositor {

/**
* If true, @ref on_present_layers will commit blockingly.
*
*
* It will also schedule a simulated page flip event on the main thread
* afterwards so the frame queue works.
*
*
* If false, @ref on_present_layers will commit nonblocking using page flip events,
* like usual.
*/
Expand Down Expand Up @@ -160,4 +160,4 @@ int compositor_initialize(
);


#endif
#endif
16 changes: 8 additions & 8 deletions include/compositor_ng.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ struct compositor;
struct drm_connector_config {
uint32_t connector_type;
uint32_t connector_type_id;

bool disable, primary;

bool has_mode_size;
int mode_width, mode_height;

bool has_mode_refreshrate;
int mode_refreshrate_n, mode_refreshrate_d;

Expand All @@ -45,7 +45,7 @@ struct drm_device_config {
const char *path;

size_t n_connector_configs;
struct drm_connector_config *connector_configs;
struct drm_connector_config *connector_configs;
};

struct fbdev_device_config {
Expand Down Expand Up @@ -78,7 +78,7 @@ struct clip_rect {
bool is_aa;

struct aa_rect aa_rect;

bool is_rounded;
struct vec2f upper_left_corner_radius;
struct vec2f upper_right_corner_radius;
Expand All @@ -91,7 +91,7 @@ struct fl_layer_props {
* @brief True if the presentation quadrangle (the quadrangle on the target window into which the
* layer should be rendered) is an axis-aligned rectangle. For example, allows us to use a plain
* hardware overlay layer for this layer.
*
*
* This should always be true for backing stores, but might be false for platform views.
*/
bool is_aa_rect;
Expand All @@ -100,7 +100,7 @@ struct fl_layer_props {
* @brief The coords of the axis aligned rectangle if @ref is_aa_rect is true.
*/
struct aa_rect aa_rect;

/**
* @brief The quadrangle on the target window into which the layer should be rendered.
*/
Expand All @@ -115,7 +115,7 @@ struct fl_layer_props {
* @brief Rotation of the buffer in degrees clockwise, normalized to a range 0 - 360.
*/
double rotation;

/**
* @brief The number of clip rectangles in the @ref clip_rects array.
*/
Expand Down
2 changes: 1 addition & 1 deletion include/cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ struct cursor_icon {
extern const struct cursor_icon cursors[5];
extern int n_cursors;

#endif
#endif
2 changes: 1 addition & 1 deletion include/egl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static inline bool check_egl_extension(const char *client_ext_string, const char
return true;
}
}

if (display_ext_string != NULL) {
const char *result = strstr(display_ext_string, extension);
if (result != NULL && (result[len] == ' ' || result[len] == '\0')) {
Expand Down
8 changes: 4 additions & 4 deletions include/flutter-pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
#include <stdio.h>
#include <glob.h>

#include <xf86drm.h>
Expand Down Expand Up @@ -51,7 +51,7 @@ enum device_orientation {
(o) == kLandscapeLeft ? 90 : \
(o) == kPortraitDown ? 180 : \
(o) == kLandscapeRight ? 270 : 0)

#define ANGLE_BETWEEN_ORIENTATIONS(o_start, o_end) \
(ANGLE_FROM_ORIENTATION(o_end) \
- ANGLE_FROM_ORIENTATION(o_start) \
Expand Down Expand Up @@ -191,4 +191,4 @@ void flutterpi_trace_event_begin(struct flutterpi *flutterpi, const char *name);

void flutterpi_trace_event_end(struct flutterpi *flutterpi, const char *name);

#endif
#endif
Loading

0 comments on commit ad4cabd

Please sign in to comment.