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 | 82db2a57a9ab171e77a0765df5dd0b2d92cb4f70 (patch) | |
tree | 024d67d41888e4a14d7e3e281d4115e7268797fd /swaybg | |
parent | Fix warning about uninitialized variable (diff) | |
download | sway-82db2a57a9ab171e77a0765df5dd0b2d92cb4f70.tar.gz sway-82db2a57a9ab171e77a0765df5dd0b2d92cb4f70.tar.zst sway-82db2a57a9ab171e77a0765df5dd0b2d92cb4f70.zip |
Basic support for extensions in server and clients
Diffstat (limited to 'swaybg')
-rw-r--r-- | swaybg/CMakeLists.txt | 2 | ||||
-rw-r--r-- | swaybg/main.c | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/swaybg/CMakeLists.txt b/swaybg/CMakeLists.txt index 7f0556df..d4de69de 100644 --- a/swaybg/CMakeLists.txt +++ b/swaybg/CMakeLists.txt | |||
@@ -7,6 +7,7 @@ find_package(Pango REQUIRED) | |||
7 | include(Wayland) | 7 | include(Wayland) |
8 | set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../bin/) | 8 | set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../bin/) |
9 | WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell "${PROJECT_SOURCE_DIR}/../protocols/xdg-shell.xml" xdg-shell) | 9 | WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell "${PROJECT_SOURCE_DIR}/../protocols/xdg-shell.xml" xdg-shell) |
10 | WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell "${PROJECT_SOURCE_DIR}/../protocols/desktop-shell.xml" desktop-shell) | ||
10 | 11 | ||
11 | include_directories( | 12 | include_directories( |
12 | ${WAYLAND_CLIENT_INCLUDE_DIR} | 13 | ${WAYLAND_CLIENT_INCLUDE_DIR} |
@@ -24,6 +25,7 @@ add_executable(swaybg | |||
24 | ${wl_sources} | 25 | ${wl_sources} |
25 | ${common} | 26 | ${common} |
26 | ${proto-xdg-shell} | 27 | ${proto-xdg-shell} |
28 | ${proto-desktop-shell} | ||
27 | ) | 29 | ) |
28 | 30 | ||
29 | TARGET_LINK_LIBRARIES(swaybg ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES} ${CAIRO_LIBRARIES} ${PANGO_LIBRARIES} m) | 31 | TARGET_LINK_LIBRARIES(swaybg ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES} ${CAIRO_LIBRARIES} ${PANGO_LIBRARIES} m) |
diff --git a/swaybg/main.c b/swaybg/main.c index b4614ac0..8d95f60a 100644 --- a/swaybg/main.c +++ b/swaybg/main.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include "wayland-desktop-shell-client-protocol.h" | ||
1 | #include <stdio.h> | 2 | #include <stdio.h> |
2 | #include <stdlib.h> | 3 | #include <stdlib.h> |
3 | #include <wayland-client.h> | 4 | #include <wayland-client.h> |
@@ -14,12 +15,16 @@ void sway_terminate(void) { | |||
14 | 15 | ||
15 | int main(int argc, char **argv) { | 16 | int main(int argc, char **argv) { |
16 | init_log(L_INFO); | 17 | init_log(L_INFO); |
17 | if (!(state = client_setup(100, 100))) { | 18 | if (!(state = client_setup(100, 100, false))) { |
18 | return -1; | 19 | return -1; |
19 | } | 20 | } |
21 | if (!state->desktop_shell) { | ||
22 | sway_abort("swaybg requires the compositor to support the desktop-shell extension."); | ||
23 | } | ||
20 | struct output_state *output = state->outputs->items[0]; | 24 | struct output_state *output = state->outputs->items[0]; |
21 | state->width = output->width; | 25 | state->width = output->width; |
22 | state->height = output->height; | 26 | state->height = output->height; |
27 | desktop_shell_set_background(state->desktop_shell, output->output, state->surface); | ||
23 | 28 | ||
24 | uint8_t r = 0, g = 0, b = 0; | 29 | uint8_t r = 0, g = 0, b = 0; |
25 | 30 | ||