aboutsummaryrefslogtreecommitdiff
path: root/swaybg
diff options
context:
space:
mode:
Diffstat (limited to 'swaybg')
-rw-r--r--swaybg/CMakeLists.txt10
-rw-r--r--swaybg/main.c23
2 files changed, 30 insertions, 3 deletions
diff --git a/swaybg/CMakeLists.txt b/swaybg/CMakeLists.txt
index 89d8afde..9351441a 100644
--- a/swaybg/CMakeLists.txt
+++ b/swaybg/CMakeLists.txt
@@ -9,14 +9,20 @@ WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell "xdg-shell.xml" xdg-shell)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../bin/")
include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/../include
${WAYLAND_CLIENT_INCLUDE_DIR}
${CAIRO_INCLUDE_DIRS}
${PANGO_INCLUDE_DIRS}
)
+FILE(GLOB sources ${PROJECT_SOURCE_DIR}/*.c)
+FILE(GLOB wl_sources ${PROJECT_SOURCE_DIR}/../wayland/*.c)
+FILE(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c)
+
add_executable(swaybg
- main.c
+ ${sources}
+ ${wl_sources}
+ ${common}
)
TARGET_LINK_LIBRARIES(swaybg ${WAYLAND_CLIENT_LIBRARIES} ${CAIRO_LIBRARIES} ${PANGO_LIBRARIES})
diff --git a/swaybg/main.c b/swaybg/main.c
index 4a8ef522..1b4af550 100644
--- a/swaybg/main.c
+++ b/swaybg/main.c
@@ -1,6 +1,27 @@
#include <stdio.h>
+#include <stdlib.h>
+#include <wayland-client.h>
+#include "client.h"
+#include "log.h"
+
+struct client_state *state;
+
+void sway_terminate(void) {
+ client_teardown(state);
+ exit(1);
+}
int main(int argc, char **argv) {
- printf("Hello world");
+ init_log(L_INFO);
+ state = client_setup();
+
+ do {
+ if (!client_prerender(state)) continue;
+ cairo_set_source_rgb(state->cairo, 255, 0, 0);
+ cairo_rectangle(state->cairo, 0, 0, 100, 100);
+ cairo_fill(state->cairo);
+ } while (client_render(state));
+
+ client_teardown(state);
return 0;
}