From 579909a36857575ee23a39abc82d4e3b34096385 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 31 May 2017 15:43:13 -0400 Subject: Promote types to a standalone subproject --- CMakeLists.txt | 2 +- backend/CMakeLists.txt | 2 +- types/CMakeLists.txt | 13 +++++++++++++ types/wlr_output.c | 35 +++++++++++++++++++++++++++++++++++ wayland/CMakeLists.txt | 13 ------------- wayland/types/wlr_output.c | 35 ----------------------------------- 6 files changed, 50 insertions(+), 50 deletions(-) create mode 100644 types/CMakeLists.txt create mode 100644 types/wlr_output.c delete mode 100644 wayland/CMakeLists.txt delete mode 100644 wayland/types/wlr_output.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 616a8911..efb741df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ include_directories(include) add_subdirectory(backend) add_subdirectory(common) -add_subdirectory(wayland) +add_subdirectory(types) add_subdirectory(session) add_subdirectory(example) diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt index fc1793cf..ef612639 100644 --- a/backend/CMakeLists.txt +++ b/backend/CMakeLists.txt @@ -18,7 +18,7 @@ add_library(wlr-backend target_link_libraries(wlr-backend wlr-common - wlr-wayland + wlr-types ${WAYLAND_LIBRARIES} ${DRM_LIBRARIES} ${GBM_LIBRARIES} diff --git a/types/CMakeLists.txt b/types/CMakeLists.txt new file mode 100644 index 00000000..eba92cc0 --- /dev/null +++ b/types/CMakeLists.txt @@ -0,0 +1,13 @@ +include_directories( + ${PROTOCOLS_INCLUDE_DIRS} + ${WAYLAND_INCLUDE_DIR} +) + +add_library(wlr-types + wlr_output.c +) + +target_link_libraries(wlr-types + wlr-common + ${WAYLAND_LIBRARIES} +) diff --git a/types/wlr_output.c b/types/wlr_output.c new file mode 100644 index 00000000..21ffa078 --- /dev/null +++ b/types/wlr_output.c @@ -0,0 +1,35 @@ +#include +#include +#include "wlr/wayland.h" +#include "wlr/common/list.h" +#include "wayland.h" + +struct wlr_output *wlr_output_create(struct wlr_output_impl *impl, + struct wlr_output_state *state) { + struct wlr_output *output = calloc(1, sizeof(struct wlr_output)); + output->impl = impl; + output->state = state; + output->modes = list_create(); + wl_signal_init(&output->events.frame); + return output; +} + +void wlr_output_free(struct wlr_output *output) { + if (!output) return; + if (output->make) free(output->make); + if (output->model) free(output->model); + for (size_t i = 0; output->modes && i < output->modes->length; ++i) { + free(output->modes->items[i]); + } + list_free(output->modes); + output->impl->destroy(output->state); + free(output); +} + +bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode) { + return output->impl->set_mode(output->state, mode); +} + +void wlr_output_enable(struct wlr_output *output, bool enable) { + output->impl->enable(output->state, enable); +} diff --git a/wayland/CMakeLists.txt b/wayland/CMakeLists.txt deleted file mode 100644 index 675a7bd2..00000000 --- a/wayland/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -include_directories( - ${PROTOCOLS_INCLUDE_DIRS} - ${WAYLAND_INCLUDE_DIR} -) - -add_library(wlr-wayland - types/wlr_output.c -) - -target_link_libraries(wlr-wayland - wlr-common - ${WAYLAND_LIBRARIES} -) diff --git a/wayland/types/wlr_output.c b/wayland/types/wlr_output.c deleted file mode 100644 index 21ffa078..00000000 --- a/wayland/types/wlr_output.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include "wlr/wayland.h" -#include "wlr/common/list.h" -#include "wayland.h" - -struct wlr_output *wlr_output_create(struct wlr_output_impl *impl, - struct wlr_output_state *state) { - struct wlr_output *output = calloc(1, sizeof(struct wlr_output)); - output->impl = impl; - output->state = state; - output->modes = list_create(); - wl_signal_init(&output->events.frame); - return output; -} - -void wlr_output_free(struct wlr_output *output) { - if (!output) return; - if (output->make) free(output->make); - if (output->model) free(output->model); - for (size_t i = 0; output->modes && i < output->modes->length; ++i) { - free(output->modes->items[i]); - } - list_free(output->modes); - output->impl->destroy(output->state); - free(output); -} - -bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode) { - return output->impl->set_mode(output->state, mode); -} - -void wlr_output_enable(struct wlr_output *output, bool enable) { - output->impl->enable(output->state, enable); -} -- cgit v1.2.3