Skip to content

Commit

Permalink
chore: update .clang-format, format C files
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Oct 8, 2023
1 parent 2e6fa34 commit e823b38
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
13 changes: 11 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
ColumnLimit: 100
BasedOnStyle: LLVM
ColumnLimit: 120
UseTab: ForIndentation
# Not actually 8, but makes clangd use tabs.
# The indent width adapts to the configured tab width.
IndentWidth: 8
UseTab: Always
IndentWrappedFunctionNames: true
AccessModifierOffset: 0
AlignAfterOpenBracket: BlockIndent
PointerAlignment: Left
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: true
AcrossComments: false
8 changes: 4 additions & 4 deletions src/icon/c/icon.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "icon.h"

enum SetIconErrorCode set_icon(const void *ptr, const char *iconFilePath) {
enum SetIconErrorCode set_icon(const void* ptr, const char* iconFilePath) {

#ifdef _WIN32

Expand All @@ -25,15 +25,15 @@ enum SetIconErrorCode set_icon(const void *ptr, const char *iconFilePath) {

#elif __linux__

GtkWidget *window = (GtkWidget *)ptr;
GtkWidget* window = (GtkWidget*)ptr;
if (window == NULL) {
return WINDOW_NOT_FOUND;
}
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(iconFilePath, NULL);
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(iconFilePath, NULL);
if (pixbuf == NULL) {
return ICON_NOT_FOUND;
}
GtkWindow *gtkWindow = GTK_WINDOW(window);
GtkWindow* gtkWindow = GTK_WINDOW(window);
gtk_window_set_icon(GTK_WINDOW(gtkWindow), pixbuf);
g_object_unref(pixbuf);
return OK;
Expand Down
14 changes: 7 additions & 7 deletions src/icon/c/icon.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#pragma once

#ifdef _WIN32
#include <windows.h>
#include <wchar.h>
#include <stdlib.h>
#include <wchar.h>
#include <windows.h>
#elif __linux__
#include <gtk/gtk.h>
#endif

enum SetIconErrorCode {
OK = 0,
WINDOW_NOT_FOUND,
ICON_NOT_FOUND,
OS_UNSUPPORTED,
OK = 0,
WINDOW_NOT_FOUND,
ICON_NOT_FOUND,
OS_UNSUPPORTED,
};

enum SetIconErrorCode set_icon(const void *ptr, const char *iconFilePath);
enum SetIconErrorCode set_icon(const void* ptr, const char* iconFilePath);

0 comments on commit e823b38

Please sign in to comment.