clang-format

This commit is contained in:
buffet 2019-02-19 11:50:46 +01:00
parent f2a8b6fdae
commit 42ef57a3e7
5 changed files with 60 additions and 10 deletions

45
.clang-format Normal file
View file

@ -0,0 +1,45 @@
---
Language: Cpp
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: AllDefinitions
AlwaysBreakBeforeMultilineStrings: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Linux
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
ColumnLimit: 80
ContinuationIndentWidth: 4
IncludeBlocks: Preserve
IndentCaseLabels: false
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
PointerAlignment: Right
ReflowComments: false
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
UseTab: Never
...

View file

@ -3,7 +3,7 @@
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. * You can obtain one at https://mozilla.org/MPL/2.0/.
*/ */
#ifndef KIWMI_OUTPUT_H #ifndef KIWMI_OUTPUT_H
#define KIWMI_OUTPUT_H #define KIWMI_OUTPUT_H
@ -21,6 +21,7 @@ struct kiwmi_output {
struct wl_listener destroy; struct wl_listener destroy;
}; };
struct kiwmi_output *output_create(struct wlr_output *wlr_output, struct kiwmi_server *server); struct kiwmi_output *
output_create(struct wlr_output *wlr_output, struct kiwmi_server *server);
#endif /* KIWMI_OUTPUT_H */ #endif /* KIWMI_OUTPUT_H */

View file

@ -23,7 +23,8 @@ new_output_notify(struct wl_listener *listener, void *data)
wlr_log(WLR_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); wlr_log(WLR_DEBUG, "New output %p: %s", wlr_output, wlr_output->name);
if (!wl_list_empty(&wlr_output->modes)) { if (!wl_list_empty(&wlr_output->modes)) {
struct wlr_output_mode *mode = wl_container_of(wlr_output->modes.prev, mode, link); struct wlr_output_mode *mode =
wl_container_of(wlr_output->modes.prev, mode, link);
wlr_output_set_mode(wlr_output, mode); wlr_output_set_mode(wlr_output, mode);
} }

View file

@ -10,8 +10,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <wayland-server.h> #include <wayland-server.h>
#include <wlr/types/wlr_output.h>
#include <wlr/render/wlr_renderer.h> #include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_output.h>
#include "kiwmi/server.h" #include "kiwmi/server.h"
@ -27,7 +27,7 @@ output_create(struct wlr_output *wlr_output, struct kiwmi_server *server)
} }
output->wlr_output = wlr_output; output->wlr_output = wlr_output;
output->server = server; output->server = server;
output->frame.notify = output_frame_notify; output->frame.notify = output_frame_notify;
wl_signal_add(&wlr_output->events.frame, &output->frame); wl_signal_add(&wlr_output->events.frame, &output->frame);
@ -41,9 +41,10 @@ output_create(struct wlr_output *wlr_output, struct kiwmi_server *server)
static void static void
output_frame_notify(struct wl_listener *listener, void *data) output_frame_notify(struct wl_listener *listener, void *data)
{ {
struct kiwmi_output *output = wl_container_of(listener, output, frame); struct kiwmi_output *output = wl_container_of(listener, output, frame);
struct wlr_output *wlr_output = data; struct wlr_output *wlr_output = data;
struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend); struct wlr_renderer *renderer =
wlr_backend_get_renderer(wlr_output->backend);
wlr_output_make_current(wlr_output, NULL); wlr_output_make_current(wlr_output, NULL);
wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height);

View file

@ -25,7 +25,7 @@ server_init(struct kiwmi_server *server)
wlr_log(WLR_DEBUG, "Initializing Wayland server"); wlr_log(WLR_DEBUG, "Initializing Wayland server");
server->wl_display = wl_display_create(); server->wl_display = wl_display_create();
server->backend = wlr_backend_autocreate(server->wl_display, NULL); server->backend = wlr_backend_autocreate(server->wl_display, NULL);
if (!server->backend) { if (!server->backend) {
wlr_log(WLR_ERROR, "Failed to create backend"); wlr_log(WLR_ERROR, "Failed to create backend");
wl_display_destroy(server->wl_display); wl_display_destroy(server->wl_display);
@ -36,7 +36,8 @@ server_init(struct kiwmi_server *server)
wlr_renderer_init_wl_display(renderer, server->wl_display); wlr_renderer_init_wl_display(renderer, server->wl_display);
server->compositor = wlr_compositor_create(server->wl_display, renderer); server->compositor = wlr_compositor_create(server->wl_display, renderer);
server->data_device_manager = wlr_data_device_manager_create(server->wl_display); server->data_device_manager =
wlr_data_device_manager_create(server->wl_display);
server->output_layout = wlr_output_layout_create(); server->output_layout = wlr_output_layout_create();
@ -51,7 +52,8 @@ server_init(struct kiwmi_server *server)
bool bool
server_run(struct kiwmi_server *server) server_run(struct kiwmi_server *server)
{ {
wlr_log(WLR_DEBUG, "Running Wayland server on display '%s'", server->socket); wlr_log(
WLR_DEBUG, "Running Wayland server on display '%s'", server->socket);
server->socket = wl_display_add_socket_auto(server->wl_display); server->socket = wl_display_add_socket_auto(server->wl_display);
if (!server->socket) { if (!server->socket) {