diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-11-18 22:01:22 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-11-18 22:01:22 -0500 |
commit | 137b6185c3f41d61702bdf5e64f28bc93bd5529a (patch) | |
tree | 1152bab35bb3b37e9e93cdae637a7aaca1f7c6fc | |
parent | 2d43bb10064b7e373584c75ff849dff3571641d8 (diff) | |
download | swaybg-137b6185c3f41d61702bdf5e64f28bc93bd5529a.tar.gz swaybg-137b6185c3f41d61702bdf5e64f28bc93bd5529a.tar.bz2 |
Basic support for extensions in server and clients
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | main.c | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f0556d..d4de69d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ find_package(Pango REQUIRED) include(Wayland) set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../bin/) WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell "${PROJECT_SOURCE_DIR}/../protocols/xdg-shell.xml" xdg-shell) +WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell "${PROJECT_SOURCE_DIR}/../protocols/desktop-shell.xml" desktop-shell) include_directories( ${WAYLAND_CLIENT_INCLUDE_DIR} @@ -24,6 +25,7 @@ add_executable(swaybg ${wl_sources} ${common} ${proto-xdg-shell} + ${proto-desktop-shell} ) TARGET_LINK_LIBRARIES(swaybg ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES} ${CAIRO_LIBRARIES} ${PANGO_LIBRARIES} m) @@ -1,3 +1,4 @@ +#include "wayland-desktop-shell-client-protocol.h" #include <stdio.h> #include <stdlib.h> #include <wayland-client.h> @@ -14,12 +15,16 @@ void sway_terminate(void) { int main(int argc, char **argv) { init_log(L_INFO); - if (!(state = client_setup(100, 100))) { + if (!(state = client_setup(100, 100, false))) { return -1; } + if (!state->desktop_shell) { + sway_abort("swaybg requires the compositor to support the desktop-shell extension."); + } struct output_state *output = state->outputs->items[0]; state->width = output->width; state->height = output->height; + desktop_shell_set_background(state->desktop_shell, output->output, state->surface); uint8_t r = 0, g = 0, b = 0; |