diff options
| author | Federico Angelilli <code@fedang.net> | 2023-11-17 15:42:49 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2023-11-17 15:42:49 +0100 |
| commit | ab92cac18652f72be12f68b5a96095ba8eb5afdf (patch) | |
| tree | e52a5f295c7cda59e67a341fa87d25983bd56745 | |
| parent | f8363e89257e8b0a4ff71accbd7b6be22935274f (diff) | |
Reorganize project structure
| -rw-r--r-- | Makefile | 37 | ||||
| -rw-r--r-- | src/comet.c (renamed from comet.c) | 8 | ||||
| -rw-r--r-- | src/connect.c (renamed from connection.c) | 10 | ||||
| -rw-r--r-- | src/connect.h (renamed from connection.h) | 12 | ||||
| -rw-r--r-- | src/draw.c (renamed from draw.c) | 0 | ||||
| -rw-r--r-- | src/draw.h (renamed from draw.h) | 0 | ||||
| -rw-r--r-- | src/log.c (renamed from log.c) | 0 | ||||
| -rw-r--r-- | src/log.h (renamed from log.h) | 0 | ||||
| -rw-r--r-- | src/state.c (renamed from state.c) | 0 | ||||
| -rw-r--r-- | src/state.h (renamed from state.h) | 0 | ||||
| -rw-r--r-- | src/window.c (renamed from window.c) | 0 | ||||
| -rw-r--r-- | src/window.h (renamed from window.h) | 2 |
12 files changed, 38 insertions, 31 deletions
@@ -1,21 +1,26 @@ -SRC = $(wildcard *.c) +SRC = $(wildcard src/*.c) OBJ = $(SRC:.c=.o) BIN = comet.bin -DEPS = \ - xcb \ - xcb-aux \ - xcb-icccm \ - xcb-ewmh \ - xcb-xrm \ - xcb-shape \ - xcb-errors \ - "xcb-randr >= 1.5" \ - "glib-2.0 >= 2.44" \ - pangocairo - -CFLAGS := $(shell pkg-config --cflags $(DEPS)) -ggdb -LDFLAGS := $(shell pkg-config --libs $(DEPS)) -lm +PCDEP = xcb \ + xcb-aux \ + xcb-icccm \ + xcb-ewmh \ + xcb-xrm \ + xcb-shape \ + xcb-errors \ + "xcb-randr >= 1.5" \ + "glib-2.0 >= 2.44" \ + pangocairo + +CFLAGS := $(shell pkg-config --cflags $(PCDEP)) +LDFLAGS := $(shell pkg-config --libs $(PCDEP)) -lm + +ifdef RELEASE +CFLAGS += -O2 +else +CFLAGS += -ggdb +endif all: $(BIN) @@ -27,3 +32,5 @@ $(BIN): $(OBJ) clean: rm -rf $(BIN) $(OBJ) + +# vim: ts=4 sw=4 @@ -5,7 +5,7 @@ #include "window.h" #include "log.h" #include "draw.h" -#include "connection.h" +#include "connect.h" #include "state.h" #define EVEN(n) ((int)(n) - ((int)(n) % 2 != 0)) @@ -29,7 +29,7 @@ int main(int argc, char **argv) GMainLoop *mainloop = g_main_loop_new(NULL, FALSE); - Connection *con = connection_create(); + Connection *con = connect_create(); Window *win = window_create(con); @@ -45,8 +45,8 @@ int main(int argc, char **argv) Drawable *draw = draw_create("Hack 12", height, x_padding, x_padding, y_padding, 1); State *state = state_create(win, draw); - connection_attach_state(con, state); - connection_attach_source(con); + connect_attach_state(con, state); + connect_attach_source(con); guint source_term = g_unix_signal_add(SIGTERM, mainloop_quit, mainloop); guint source_int = g_unix_signal_add(SIGINT, mainloop_quit, mainloop); diff --git a/connection.c b/src/connect.c index d3eedda..0ef12f9 100644 --- a/connection.c +++ b/src/connect.c @@ -7,7 +7,7 @@ #include <xcb/randr.h> #include "log.h" -#include "connection.h" +#include "connect.h" #include "state.h" static bool query_xrm(Connection *con, const char *res, char **value) @@ -182,7 +182,7 @@ static void attach_source(Connection *con) g_source_attach(con->source, NULL); } -Connection *connection_create() +Connection *connect_create() { Connection *con = g_malloc0(sizeof(Connection)); g_assert_nonnull(con); @@ -265,7 +265,7 @@ Connection *connection_create() return con; } -void connection_attach_source(Connection *con) +void connect_attach_source(Connection *con) { g_assert_null(con->source); @@ -273,14 +273,14 @@ void connection_attach_source(Connection *con) log_debug("Xcb event loop attached"); } -void connection_attach_state(Connection *con, State *state) +void connect_attach_state(Connection *con, State *state) { g_assert_nonnull(state); g_ptr_array_add(con->states, state); log_debug("Attached state to event loop"); } -void connection_destroy(Connection *con) +void connect_destroy(Connection *con) { g_ptr_array_free(con->states, true); diff --git a/connection.h b/src/connect.h index 21cbf3f..e348bcf 100644 --- a/connection.h +++ b/src/connect.h @@ -1,5 +1,5 @@ -#ifndef COMET_CONNECTION_H -#define COMET_CONNECTION_H +#ifndef COMET_CONNEC_H +#define COMET_CONNEC_H #include <glib.h> #include <xcb/xcb.h> @@ -28,13 +28,13 @@ struct Connection { GPtrArray *states; }; -Connection *connection_create(); +Connection *connect_create(); -void connection_attach_source(Connection *con); +void connect_attach_source(Connection *con); -void connection_attach_state(Connection *con, State *state); +void connect_attach_state(Connection *con, State *state); -void connection_destroy(Connection *con); +void connect_destroy(Connection *con); #endif @@ -3,7 +3,7 @@ #include <cairo.h> -#include "connection.h" +#include "connect.h" typedef struct Window Window; |
