[Bf-blender-cvs] [8fbebc7176b] decoration: libdecor_new

Christian Rauch noreply at git.blender.org
Sun May 24 01:15:27 CEST 2020


Commit: 8fbebc7176b6ed118079b129319d5f1edf6a9616
Author: Christian Rauch
Date:   Wed May 20 23:21:28 2020 +0100
Branches: decoration
https://developer.blender.org/rB8fbebc7176b6ed118079b129319d5f1edf6a9616

libdecor_new

===================================================================

M	build_files/cmake/platform/platform_unix.cmake
M	extern/CMakeLists.txt
A	extern/libdecoration.cmake
M	intern/ghost/CMakeLists.txt
M	intern/ghost/intern/GHOST_WindowWayland.cpp
M	source/creator/CMakeLists.txt

===================================================================

diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index 210e7f68c10..93fbfc0394a 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -527,6 +527,8 @@ if(WITH_GHOST_WAYLAND)
     ${xkbcommon_LIBRARIES}
     ${wayland-cursor_LIBRARIES}
   )
+
+  list(APPEND PLATFORM_LINKLIBS "${CMAKE_BINARY_DIR}/lib/libdecoration${CMAKE_SHARED_LIBRARY_SUFFIX}")
 endif()
 
 if(WITH_GHOST_X11)
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 235c2fa931a..ca9cf47e9d0 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -109,3 +109,7 @@ endif()
 if(WITH_MOD_FLUID)
   add_subdirectory(mantaflow)
 endif()
+
+if(WITH_GHOST_WAYLAND)
+  include("libdecoration.cmake")
+endif()
diff --git a/extern/libdecoration.cmake b/extern/libdecoration.cmake
new file mode 100644
index 00000000000..16ba2f289fd
--- /dev/null
+++ b/extern/libdecoration.cmake
@@ -0,0 +1,9 @@
+include(ExternalProject)
+ExternalProject_Add(libdecoration
+    GIT_REPOSITORY https://gitlab.gnome.org/jadahl/libdecoration.git
+    GIT_TAG master
+    PREFIX "${CMAKE_CURRENT_BINARY_DIR}/libdecoration"
+    CONFIGURE_COMMAND meson --prefix "${CMAKE_BINARY_DIR}" --libdir "lib" ../libdecoration
+    BUILD_COMMAND ninja
+    INSTALL_COMMAND ninja install
+)
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 699ac4afe88..2999a64fdea 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -265,6 +265,8 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
       ${wayland-cursor_INCLUDE_DIRS}
     )
 
+    list(APPEND INC_SYS "${CMAKE_BINARY_DIR}/include")
+
     list(APPEND SRC
       intern/GHOST_SystemWayland.cpp
       intern/GHOST_WindowWayland.cpp
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index 0ea6f5f8ecb..3827441c63b 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -29,6 +29,8 @@
 
 #include <wayland-egl.h>
 
+#include <libdecoration/libdecoration.h>
+
 struct window_t {
   GHOST_WindowWayland *w;
   wl_surface *surface;
@@ -122,6 +124,17 @@ static const xdg_surface_listener surface_listener = {
     surface_configure,
 };
 
+static void
+handle_error(struct libdecor *context, enum libdecor_error error, const char *message)
+{
+  GHOST_PRINT("decoration error ("<<  error <<"): " << message << std::endl);
+  exit(EXIT_FAILURE);
+}
+
+static struct libdecor_interface libdecor_iface = {
+  .error = handle_error,
+};
+
 /** \} */
 
 /* -------------------------------------------------------------------- */
@@ -159,6 +172,8 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
   w->surface = wl_compositor_create_surface(m_system->compositor());
   w->egl_window = wl_egl_window_create(w->surface, int(width), int(height));
 
+  struct libdecor *context = libdecor_new(m_system->display(), &libdecor_iface);
+
   w->xdg_surface = xdg_wm_base_get_xdg_surface(m_system->shell(), w->surface);
   w->xdg_toplevel = xdg_surface_get_toplevel(w->xdg_surface);
 
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 1a71022869a..73e50f896a4 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -328,6 +328,10 @@ if(UNIX AND NOT APPLE)
     endif()
   endif()
 
+  if(WITH_GHOST_WAYLAND)
+    add_dependencies(blender libdecoration)
+  endif()
+
 elseif(WIN32)
   set(TARGETDIR_VER ${BLENDER_VERSION})



More information about the Bf-blender-cvs mailing list