Git Product home page Git Product logo

waylandpp's People

Contributors

bkuhls avatar candrews avatar nilsbrause avatar nolange avatar olafhering avatar pkerling avatar rechi avatar topisani avatar whot avatar yzsolt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

waylandpp's Issues

Use a different build system

Can you please use a different build system?
cmake, meson, autotools... anything but scons.

scons is just really horrible to work with... it's nonstandard (every scons project is different) and doesn't do anything automatically (like handle libdir, cc, ldflag, cxxflags, cflags, etc) among other problems.

No distribution is going to be happy having to work with scons, so if you want waylandpp to be packaged in distros and widely distributed (which I think is the point), it's best to use something else.

See https://wiki.gentoo.org/wiki/SCons#Why_you_should_NOT_use_SCons_in_your_project for details.

CMake on Debian stable

While the cmake support (kindly provided by pkerling) works perfectly well on my Arch Linux desktop, I have some problems on my Debian stable server. The scanner doesn't seem to get built and therefore the protocol headers are not found:

~/waylandpp % mkcd build                                                                                                        
~/waylandpp/build % cmake .. && make                                                                                            
-- The C compiler identification is GNU 6.3.0                                                                                                                 
-- The CXX compiler identification is GNU 6.3.0                                                                                                               
-- Check for working C compiler: /usr/bin/cc                                                                                                                  
-- Check for working C compiler: /usr/bin/cc -- works                                                                                                         
-- Detecting C compiler ABI info                                                                                                                              
-- Detecting C compiler ABI info - done                                                                                                                       
-- Detecting C compile features                                                                                                                               
-- Detecting C compile features - done                                                                                                                        
-- Check for working CXX compiler: /usr/bin/c++                                                                                                               
-- Check for working CXX compiler: /usr/bin/c++ -- works                                                                                                      
-- Detecting CXX compiler ABI info                                                                                                                            
-- Detecting CXX compiler ABI info - done                                                                                                                     
-- Detecting CXX compile features                                                                                                                             
-- Detecting CXX compile features - done                                                                                                                      
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29")                                                                                                
-- Checking for module 'wayland-client>=1.11.0'                                                                                                               
--   Found wayland-client, version 1.13.91                                                                                                                    
-- Checking for module 'wayland-egl'                                                                                                                          
--   Found wayland-egl, version 13.0.6                                                                                                                        
-- Checking for module 'wayland-cursor'                                                                                                                       
--   Found wayland-cursor, version 1.13.91                                                                                                                    
-- Configuring done                                                                                                                                           
-- Generating done                                                                                                                                            
-- Build files have been written to: /home/nils/waylandpp/build                                                                                               
Scanning dependencies of target wayland-cursor++                                                                                                              
[  8%] Building CXX object CMakeFiles/wayland-cursor++.dir/src/wayland-cursor.cpp.o                                                                           
In file included from /home/nils/waylandpp/src/wayland-cursor.cpp:26:0:                                                                                       
/home/nils/waylandpp/include/wayland-cursor.hpp:32:39: fatal error: wayland-client-protocol.hpp: No such file or directory
 #include <wayland-client-protocol.hpp>
                                       ^
compilation terminated.
CMakeFiles/wayland-cursor++.dir/build.make:62: recipe for target 'CMakeFiles/wayland-cursor++.dir/src/wayland-cursor.cpp.o' failed
make[2]: *** [CMakeFiles/wayland-cursor++.dir/src/wayland-cursor.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/wayland-cursor++.dir/all' failed
make[1]: *** [CMakeFiles/wayland-cursor++.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Unfortunately I know too little about CMake to fix this.

Allow specifying libdir in SCons

Some distributions use a libdir other that "lib" - it would be great if, similar to ROOT and PREFIX, LIBDIR could be specified (with a default value of "lib" of course).

Please update wayland.xml protocol

Hi,

I was trying to run a Wayland tool and I found this error output:
interface 'wl_output' has no event 4
I found that "wayland.xml" of my system is newer than version included in waylandpp. I recompiled waylandpp with new version of "wayland.xml" and it worked properly.

Can "wayland.xml" updated?

Thanks for your work.

What happens if libwayland-client.so and libwaylandpp-client.so are compiled each using a different version of wayland.xml file

I am wondering if I compile waylandpp libraries version 1.0.0 based on core protocol 1.22? and run them in a program on Ubuntu 22 where, for example, wl_output interface has a different version than the one compiled (version 2 vs 4), would it work properly ?

Do I re-compile wayland libraries with the same protocol files than those present in waylandpp repository ? And then embed libraries libwayland & libwaylandpp with the binary on the target platform ?

Thanks in advance.

Issues with the weston-desktop-shell protocol

Ive been trying to use this for a new WM I'm playing around with. First step was to convert this to waylandpp, but im having some issues. My version is here

Basically, it seems that the weston_desktop_shell_t doesnt work at all. on_configure, and any of its other events, are never fired, and setting background, grab and panel surfaces doesnt work.

What i believe to be the corresponding code with the C API works fine, and it leads me to believe, that either i dont initialize something correctly, or waylandpp generates code witch doesnt adhere to the protocol. Either way, id really apreciate it if you could take a look.

Some extra info:
Bound Desktop Shell on line 219 is logged
The following is the minimal version of what i believe should work

#include <iostream>

#include "weston-desktop-shell-protocol.hpp"

int main(int argc, char* argv[])
{
  wayland::display_t display;
  wayland::registry_t registry;
  wayland::weston_desktop_shell_t shell;

  registry = display.get_registry();
  registry.on_global() = [&] (int name, std::string interface, int version) {
    if (interface == wayland::weston_desktop_shell_t::interface_name) {
      registry.bind(name, shell, version);
      shell.on_configure() = [&] (uint32_t edges, wayland::surface_t, int width, int height) {
        std::cout << "CONFIGURE :" << width << "x" << height;
      };
    }
  };
  display.roundtrip();

  while (true);

  return 0;
}

CONFIGURE is never logged.

Confused about usage - custom objects for a shell

Hi all,

I'm trying to convert the following source code into waylandpp compatible code, as this is what a project I'm porting uses:
https://github.com/webosose/samples/blob/master/native-apps/external/com.sample.waylandegl/src/wayland_egl.c

The xml code for those extensions:

https://github.com/webosose/webos-wayland-extensions

How do I deal with custom objects using waylandpp? What would be the equivalent waylandpp code?

The whole point of the code is to simply bind:

if (strcmp(interface, "wl_webos_shell") == 0)
    {
        g_pstWebOSShell = wl_registry_bind(registry, id, &wl_webos_shell_interface, 1);
    }
}

and add some listeners:

    g_pstWebosShellSurface = wl_webos_shell_get_shell_surface(g_pstWebOSShell, g_pstSurface);
    wl_webos_shell_surface_add_listener(g_pstWebosShellSurface, &s_pstWebosShellListener, g_pstDisplay);
    wl_webos_shell_surface_set_property(g_pstWebosShellSurface, "appId", (getenv("APP_ID") ? getenv("APP_ID") : "com.sample.waylandegl"));
    // for secondary display, set the last parameter as 1
    wl_webos_shell_surface_set_property(g_pstWebosShellSurface, "displayAffinity", (getenv("DISPLAY_ID") ? getenv("DISPLAY_ID") : "0"));

Further code from https://github.com/webosose/webos-wayland-extensions

wl_webos_shell
wl_webos_shell_interface

definition of wl_webos_shell_interface

WL_EXPORT const struct wl_interface wl_webos_shell_interface = {
	"wl_webos_shell", 2,
	2, wl_webos_shell_requests,
	0, NULL,
};

static const struct wl_message wl_webos_shell_requests[] = {
	{ "get_system_pip", "", webos_shell_types + 0 },
	{ "get_shell_surface", "no", webos_shell_types + 2 },
};

static const struct wl_interface *webos_shell_types[] = {
	NULL,
	NULL,
	&wl_webos_shell_surface_interface,
	&wl_surface_interface,
};

WL_EXPORT const struct wl_interface wl_webos_shell_surface_interface = {
	"wl_webos_shell_surface", 2,
	6, wl_webos_shell_surface_requests,
	6, wl_webos_shell_surface_events,
};

static const struct wl_message wl_webos_shell_surface_requests[] = {
	{ "set_location_hint", "u", webos_shell_types + 0 },
	{ "set_state", "u", webos_shell_types + 0 },
	{ "set_property", "ss", webos_shell_types + 0 },
	{ "set_key_mask", "u", webos_shell_types + 0 },
	{ "set_addon", "2s", webos_shell_types + 0 },
	{ "reset_addon", "2", webos_shell_types + 0 },
};

static const struct wl_message wl_webos_shell_surface_events[] = {
	{ "state_changed", "u", webos_shell_types + 0 },
	{ "position_changed", "ii", webos_shell_types + 0 },
	{ "close", "", webos_shell_types + 0 },
	{ "exposed", "a", webos_shell_types + 0 },
	{ "state_about_to_change", "u", webos_shell_types + 0 },
	{ "addon_status_changed", "2u", webos_shell_types + 0 },
};

static inline struct wl_shell_surface *
wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
{
	struct wl_proxy *id;

	id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shell,
			 WL_SHELL_GET_SHELL_SURFACE, wl_shell_surface_interface, NULL, surface);

	return (struct wl_shell_surface *) id;
}

static inline struct wl_webos_shell_surface *
wl_webos_shell_get_shell_surface(struct wl_webos_shell *wl_webos_shell, struct wl_surface *surface)
{
	struct wl_proxy *id;

	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_webos_shell,
			 WL_WEBOS_SHELL_GET_SHELL_SURFACE, &wl_webos_shell_surface_interface, wl_proxy_get_version((struct wl_proxy *) wl_webos_shell), 0, NULL, surface);

	return (struct wl_webos_shell_surface *) id;
}

build failures with 0.2.6 release

The 0.2.6 tag fails to build, commit f389962 was still ok X11:Wayland/waylandpp:

X11:Wayland/waylandpp $ grep -C5 -m1 'undefined refere' /dev/shm/*/.build.log
[   27s] /usr/bin/c++  -Dwayland_client_extra___EXPORTS -I/home/abuild/rpmbuild/BUILD/waylandpp-0.2.6.20191003T201733.f7d4fd2/include -I/home/abuild/rpmbuild/BUILD/waylandpp-0.2.6.20191003T201733.f7d4fd2/build  -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG -O2 -g -DNDEBUG -fPIC   -I/usr/include/wayland -std=gnu++11 -o CMakeFiles/wayland-client-extra++.dir/wayland-client-protocol-extra.cpp.o -c /home/abuild/rpmbuild/BUILD/waylandpp-0.2.6.20191003T201733.f7d4fd2/build/wayland-client-protocol-extra.cpp
[   29s] [ 45%] Linking CXX shared library libwayland-client-extra++.so
[   29s] /usr/bin/cmake -E cmake_link_script CMakeFiles/wayland-client-extra++.dir/link.txt --verbose=1
[   29s] /usr/bin/c++ -fPIC -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG -O2 -g -DNDEBUG -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -shared -Wl,-soname,libwayland-client-extra++.so.0 -o libwayland-client-extra++.so.0.2.6 CMakeFiles/wayland-client-extra++.dir/wayland-client-protocol-extra.cpp.o -lwayland-client 
[   30s] /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/wayland-client-extra++.dir/wayland-client-protocol-extra.cpp.o: in function `wayland::presentation_t::presentation_t()':
[   30s] /home/abuild/rpmbuild/BUILD/waylandpp-0.2.6.20191003T201733.f7d4fd2/build/wayland-client-protocol-extra.cpp:626: undefined reference to `wayland::proxy_t::proxy_t()'
[   30s] /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/wayland-client-extra++.dir/wayland-client-protocol-extra.cpp.o: in function `wayland::presentation_t::presentation_t(wayland::proxy_t const&, wayland::proxy_t::construct_proxy_wrapper_tag)':
[   30s] /home/abuild/rpmbuild/BUILD/waylandpp-0.2.6.20191003T201733.f7d4fd2/build/wayland-client-protocol-extra.cpp:646: undefined reference to `wayland::proxy_t::proxy_t(wayland::proxy_t const&, wayland::proxy_t::construct_proxy_wrapper_tag)'
[   30s] /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/wayland-client-extra++.dir/wayland-client-protocol-extra.cpp.o: in function `wayland::presentation_t::on_clock_id()':
[   30s] /home/abuild/rpmbuild/BUILD/waylandpp-0.2.6.20191003T201733.f7d4fd2/build/wayland-client-protocol-extra.cpp:672: undefined reference to `wayland::proxy_t::get_events()'
[   30s] /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/wayland-client-extra++.dir/wayland-client-protocol-extra.cpp.o: in function `wayland::presentation_feedback_t::presentation_feedback_t()':

Allow building static libraries

Hello,

this library is not in debian repositories, and I also prefer not having C++ DSOs if possible (ABI-stability & name-mangling).
Two reasons to use static libraries, and I attached a patch to make this a compiletime option. With this patch, I was able to compile the libs and use them for kodi.

I would help you out getting there, but I have some questions regarding the decisions/implementation.

  • you use set instead of option (option(BUILD_SHARED_LIBS "Build shared library" OFF))
  • pkg-config file would need to somehow be able to display the dependencies for linking DSOs/Executables (-lwayland-cursor -lwayland-client -lwayland-egl)
  • CMake configs would make much of this easier (if used from CMake) than pkg-config. Any reason (apart from obvious stuff like time) you haven't done this?

the patch would be:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb9b81e..406acb7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,7 @@ set(BUILD_SCANNER ON CACHE BOOL "whether to build wayland-scanner++")
 set(BUILD_LIBRARIES ON CACHE BOOL "whether to build the libraries")
 set(BUILD_DOCUMENTATION ${DOXYGEN_FOUND} CACHE BOOL "Create and install the HTML based API documentation (requires Doxygen)")
 set(BUILD_EXAMPLES OFF CACHE BOOL "whether to build the examples (requires BUILD_LIBRARIES to be ON)")
+set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
 
 # variables for .pc.in files
 set(prefix "${CMAKE_INSTALL_PREFIX}")
@@ -126,10 +127,17 @@ if(BUILD_LIBRARIES)
 
   # library building helper functions
   function(define_library TARGET CFLAGS LIBRARIES HEADERS)
-    add_library("${TARGET}" SHARED ${ARGN})
+    add_library("${TARGET}" ${ARGN})
+    get_target_property(libtype "${TARGET}" TYPE)
     target_include_directories("${TARGET}" PUBLIC "include" "${CMAKE_CURRENT_BINARY_DIR}") # latter for wayland-version.hpp
     target_compile_options("${TARGET}" PUBLIC ${CFLAGS})
-    target_link_libraries("${TARGET}" ${LIBRARIES})
+    set(LINK_DEPENDENCIES)
+    if(libtype STREQUAL "STATIC_LIBRARY")
+        # TODO: somehow add information to the pkg-config files
+        # set(LINK_DEPENDENCIES " -l${LIBRARIES}")
+    else()
+      target_link_libraries("${TARGET}" PRIVATE ${LIBRARIES})
+    endif()
     set_target_properties("${TARGET}" PROPERTIES
       PUBLIC_HEADER "${HEADERS}"
       VERSION "${PROJECT_VERSION}"
@@ -158,6 +166,7 @@ if(BUILD_LIBRARIES)
   install(FILES ${PROTO_XMLS} ${PROTO_XMLS_EXTRA} ${PROTO_XMLS_UNSTABLE} DESTINATION "${INSTALL_FULL_PKGDATADIR}/protocols")
   install(TARGETS wayland-client++ wayland-client-extra++ wayland-egl++ wayland-cursor++
     LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
+    ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
     PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}"
     RESOURCE DESTINATION "${INSTALL_FULL_PKGCONFIGDIR}")
 endif()
diff --git a/wayland-client++.pc.in b/wayland-client++.pc.in
index 8baf088..a923c99 100644
--- a/wayland-client++.pc.in
+++ b/wayland-client++.pc.in
@@ -34,4 +34,4 @@ Version: @PROJECT_VERSION@
 URL: https://github.com/NilsBrause/waylandpp
 Requires.private: wayland-client
 Cflags: -I${includedir}
-Libs: -L${libdir} -lwayland-client++
+Libs: -L${libdir} -lwayland-client++@LINK_DEPENDENCIES@
diff --git a/wayland-client-extra++.pc.in b/wayland-client-extra++.pc.in
index 1c4584d..94b2faa 100644
--- a/wayland-client-extra++.pc.in
+++ b/wayland-client-extra++.pc.in
@@ -34,4 +34,4 @@ Version: @PROJECT_VERSION@
 URL: https://github.com/NilsBrause/waylandpp
 Requires: wayland-client++
 Cflags: -I${includedir}
-Libs: -L${libdir} -lwayland-client-extra++
+Libs: -L${libdir} -lwayland-client-extra++@LINK_DEPENDENCIES@
diff --git a/wayland-client-unstable++.pc.in b/wayland-client-unstable++.pc.in
index c5c79b6..708d40d 100644
--- a/wayland-client-unstable++.pc.in
+++ b/wayland-client-unstable++.pc.in
@@ -34,4 +34,4 @@ Version: @PROJECT_VERSION@
 URL: https://github.com/NilsBrause/waylandpp
 Requires: wayland-client++
 Cflags: -I${includedir}
-Libs: -L${libdir} -lwayland-client-unstable++
+Libs: -L${libdir} -lwayland-client-unstable++@LINK_DEPENDENCIES@
diff --git a/wayland-cursor++.pc.in b/wayland-cursor++.pc.in
index ea174f7..e0bed00 100644
--- a/wayland-cursor++.pc.in
+++ b/wayland-cursor++.pc.in
@@ -34,4 +34,4 @@ Version: @PROJECT_VERSION@
 URL: https://github.com/NilsBrause/waylandpp
 Requires.private: wayland-cursor wayland-client++
 Cflags: -I${includedir}
-Libs: -L${libdir} -lwayland-cursor++
+Libs: -L${libdir} -lwayland-cursor++@LINK_DEPENDENCIES@
diff --git a/wayland-egl++.pc.in b/wayland-egl++.pc.in
index 9afbd4b..2cecd61 100644
--- a/wayland-egl++.pc.in
+++ b/wayland-egl++.pc.in
@@ -34,4 +34,4 @@ Version: @PROJECT_VERSION@
 URL: https://github.com/NilsBrause/waylandpp
 Requires.private: egl wayland-egl wayland-client++
 Cflags: -I${includedir}
-Libs: -L${libdir} -lwayland-egl++
+Libs: -L${libdir} -lwayland-egl++@LINK_DEPENDENCIES@

usable like this (added LTO for bragging rights):

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_POLICY_DEFAULT_CMP0069=NEW -DBUILD_SHARED_LIBS=OFF  -DBUILD_DOCUMENTATION=OFF -DBUILD_LIBRARIES=ON -DBUILD_EXAMPLES=OFF  ../waylandpp

Release?

Kodi will be using waylandpp when Wayland support is merged mainline in the next weeks, but waylandpp has not seen a release yet - this makes it hard to depend on it in a predictable way. For instance we cannot even show the user an error message when an incompatible version is used.

I realize that lots of the PRs I did the last months broke API and/or ABI and there may still be some areas that need some more fleshing out, so waylandpp is not exactly "stable" yet probably. But you could release version 0.1 or something :-)

I'll also PR support for pkg-config later this week so the version can be queried.

interface 'xdg_toplevel' has no event 3

I have no idea what this error means, but I guess waylandpp might have an issue with the compositor I am using.
I am using mutter, and I am trying to run the shm example.
(I also might just be dumb.)

Cross-compilation

I just remembered another thing that should probably be fixed before #25: @lrusak did some experimental LibreELEC builds with Kodi/Wayland and encountered the problem that at the moment cross-compiling waylandpp is not possible because the scanner is also compiled for the target instead of the host architecture (which makes it impossible to execute). libwayland also had issues with this for some time so we should not repeat that mistake :-)

Do you know how SCons handles this by any chance? I can try my hand at it, but I have zero SCons experience, mostly used CMake.

Examples for `wayland::detail::any`?

Hi. I've seen it has get<T>() method, but I did not see any methods for checking if value is empty (like std::any::empty()) or checking typeid (like std::any::type()). All methods except get() are private. Maybe we should use std::any here?

Examples fail at runtime: interface 'wl_surface' has no event 2

After upgrading to Sway 1.9 a few days ago, examples started failing at runtime. They used to run fine before the upgrade.

# ./shm
interface 'wl_surface' has no event 2
terminate called after throwing an instance of 'std::system_error'
  what():  wl_display_dispatch: No such file or directory
Aborted (core dumped)
# ./egl
interface 'wl_surface' has no event 2
terminate called after throwing an instance of 'std::system_error'
  what():  wl_display_dispatch: Resource temporarily unavailable
Aborted (core dumped)

Issues with gtk and the wlroots layer-shell protocol

I am having some more issues using waylandpp with gtk.

I have made a minimal example of what works with the c wayland APIs, and doesnt with waylandpp. here is the diff between those two

here is the layer_shell protocol which appears to be the issue. My compositor sees the creation of a layer surface though, and it sends the configure event back.

This is the log of the addressanitizer, it clearly gets a nullptr somewhere, but i think it must be in the waylandpp internals of surface or something. If you have any ideas of where to investigate it would be most helpful.

Addrsan log
AddressSanitizer:DEADLYSIGNAL
=================================================================
==32118==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fa0492dc7cc bp 0x62900005c030 sp 0x7ffc27fbd450 T0)
==32118==The signal is caused by a READ memory access.
==32118==Hint: address points to the zero page.
    #0 0x7fa0492dc7cb in gdk_window_get_scale_factor (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgdk-3.so.0+0x517cb)
    #1 0x7fa0497186c9  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgtk-3.so.0+0x1986c9)
    #2 0x7fa0496fd797  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgtk-3.so.0+0x17d797)
    #3 0x7fa0496fd8e2  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgtk-3.so.0+0x17d8e2)
    #4 0x7fa0496fc904  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgtk-3.so.0+0x17c904)
    #5 0x7fa0496fd6c4  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgtk-3.so.0+0x17d6c4)
    #6 0x7fa0496fd6da  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgtk-3.so.0+0x17d6da)
    #7 0x7fa0496fd6da  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgtk-3.so.0+0x17d6da)
    #8 0x7fa0496fd6da  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgtk-3.so.0+0x17d6da)
    #9 0x7fa04991eb57  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgtk-3.so.0+0x39eb57)
    #10 0x7fa048e3fa4c in g_closure_invoke (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgobject-2.0.so.0+0xfa4c)
    #11 0x7fa048e52f17  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgobject-2.0.so.0+0x22f17)
    #12 0x7fa048e5b6f5 in g_signal_emit_valist (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgobject-2.0.so.0+0x2b6f5)
    #13 0x7fa048e5c12f in g_signal_emit (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgobject-2.0.so.0+0x2c12f)
    #14 0x7fa04990aa3a in gtk_widget_show (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgtk-3.so.0+0x38aa3a)
    #15 0x55ec4b52a4f7 in main::$_2::operator()(unsigned int, unsigned int, unsigned int) const /home/topisani/dev/tablecloth/build/../cloth-bar/test.cpp:85:5
    #16 0x55ec4b52a306 in std::_Function_handler<void (unsigned int, unsigned int, unsigned int), main::$_2>::_M_invoke(std::_Any_data const&, unsigned int&&, unsigned int&&, unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.1.1/../../../../include/c++/8.1.1/bits/std_function.h:297:2
    #17 0x55ec4b5150e4 in std::function<void (unsigned int, unsigned int, unsigned int)>::operator()(unsigned int, unsigned int, unsigned int) const /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.1.1/../../../../include/c++/8.1.1/bits/std_function.h:687:14
    #18 0x55ec4b4d0933 in wayland::zwlr_layer_surface_v1_t::dispatcher(unsigned int, std::vector<wayland::detail::any, std::allocator<wayland::detail::any> >, std::shared_ptr<wayland::detail::events_base_t>) /home/topisani/dev/tablecloth/build/cloth-bar/protocols.cpp:3415:29
    #19 0x7fa04ab004bf in wayland::proxy_t::c_dispatcher(void const*, void*, unsigned int, wl_message const*, wl_argument*) (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libwayland-client++.so.0.2+0x444bf)
    #20 0x7fa04b1050f9  (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libwayland-client.so.0+0x90f9)
    #21 0x7fa04b1016aa in _init (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libwayland-client.so.0+0x56aa)
    #22 0x7fa04b102c5b in wl_display_dispatch_queue_pending (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libwayland-client.so.0+0x6c5b)
    #23 0x7fa04b1030ab in wl_display_roundtrip_queue (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libwayland-client.so.0+0x70ab)
    #24 0x7fa04ab01ee9 in wayland::display_t::roundtrip() (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libwayland-client++.so.0.2+0x45ee9)
    #25 0x55ec4b528611 in main /home/topisani/dev/tablecloth/build/../cloth-bar/test.cpp:90:11
    #26 0x7fa047ecc06a in __libc_start_main (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libc.so.6+0x2306a)
    #27 0x55ec4b3ae1d9 in _start (/home/topisani/dev/tablecloth/build/cloth-bar/cloth-bar+0x4f1d9)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/topisani/dev/tablecloth/build/cloth-bar/../../../../../../lib64/libgdk-3.so.0+0x517cb) in gdk_window_get_scale_factor
==32118==ABORTING

gdb bt full

0.2.9 broke ABI

Hi,

commit 87fb88b broke the ABI, as re-defining a function as const will drop it from the symbols table.

See https://bugs.debian.org/1006812 for a downstream bug showing how a linked program stopped working.

Please either:

  1. revert that commit
  2. add non-const overloaded variant to retain the ABI
  3. bump the SONAME

Thank you for considering.

Enhancement: short interface declaration in generated `${protocol_name}-procotol.cpp`

Hi. Your code is generating sources like this

code
const wl_interface* buffer_interface_destroy_request_server[0] = {
};

const wl_interface* buffer_interface_release_event_server[0] = {
};

const wl_message buffer_interface_requests_server[1] = {
  {
    "destroy",
    "",
    buffer_interface_destroy_request_server,
  },
};

const wl_message buffer_interface_events_server[1] = {
  {
    "release",
    "",
    buffer_interface_release_event_server,
  },
};

const wl_interface wayland::server::detail::buffer_interface =
  {
    "wl_buffer",
    1,
    1,
    buffer_interface_requests_server,
    1,
    buffer_interface_events_server,
  };
But it could be much shorter, like this
code
const wl_interface wayland::server::detail::buffer_interface = {
	"wl_buffer", 1,
	1, new const wl_message[] { 
		{ "destroy", "", new const wl_interface*[] {} }
	},
	1, new const wl_message[] {
		{ "release", "", new const wl_interface*[] {} }
	}
};
Also it can be oneliner because it is machine generated code and nobody reads it carefully.
code
const wl_interface wayland::server::detail::buffer_interface = {"wl_buffer", 1, 1, new const wl_message[] {{ "destroy", "", new const wl_interface*[] {} }}, 1, new const wl_message[] {{ "release", "", new const wl_interface*[] {} }}};

I failed to make it constexpr.

Release new version

Can you please release a new version from master, presumable 0.2.8?

I'm particularly interested in a release that includes 9ca8523

Thank you!

Something is wrong with `resource_t` in `wayland-server++`

I a writing a backend for Xwayland and something is wrong here.

Code
#include <iostream>
#include <cstdio>
#include <wayland-server.hpp>
#include "wayland-server-protocol.hpp"
#include "xdg-shell-protocol.hpp"

using namespace std;
using namespace wayland::server;

int main()
{
    ::remove("/run/user/1000/wayland-0.lock");
    try {
        cout << "Hello World!" << endl;
        display_t display;
        display.add_socket_auto();
        wl_display_init_shm(display.c_ptr());

        global_compositor_t global_compositor(display);
        global_xdg_wm_base_t global_wm_base(display);
        global_output_t global_output(display);
        global_seat_t global_seat(display);

        global_output.on_bind() = [](const client_t& /*client*/, output_t output) {
            output.geometry(0, 0, 270, 158, output_subpixel::unknown, "weston-x11", "none", output_transform::normal);
            output.scale(1);
            output.mode(3, 1024, 600, 60000);
            output.done();
        };
        global_seat.on_bind() = [](const client_t& /*client*/, seat_t seat) {
            seat.on_get_touch() = [](touch_t /*touch*/) {};
            seat.on_get_keyboard() = [](keyboard_t /*kbd*/) {};
            seat.on_get_pointer() = [](pointer_t pointer) {
                pointer.on_set_cursor() = [](uint32_t /*serial*/, surface_t /*surface*/, int32_t /*hotspot_x*/, int32_t /*hotspot_y*/) {};
            };
            seat.capabilities(seat_capability::pointer | seat_capability::keyboard | seat_capability::touch);
        };

        display.run();
    } catch(const std::exception& ex) {
        std::cout << "Error occured: " << ex.what() << std::endl;
    }
    return 0;
}

Header references are relative to sources because I've built waylandpp with this code to see full stack.

Xwayland version is 22.1.3 (12201003) (old versions have no xdg_shell support).

twaik@twaikPC:~$ WAYLAND_DEBUG=1 ./build-waylandpp-lorie-Desktop-Debug/waylandpp-lorie 
Hello World!
[1997996.676] [email protected]_registry(new id wl_registry@2)
[1997996.738]  -> [email protected](1, "wl_shm", 1)
[1997996.760]  -> [email protected](2, "wl_compositor", 5)
[1997996.775]  -> [email protected](3, "xdg_wm_base", 5)
[1997996.789]  -> [email protected](4, "wl_output", 4)
[1997996.805]  -> [email protected](5, "wl_seat", 8)
[1997996.821] [email protected](new id wl_callback@3)
[1997996.836]  -> [email protected](0)
[1997996.850]  -> [email protected]_id(3)
[1997997.313] [email protected](1, "wl_shm", 1, new id [unknown]@4)
[1997997.349]  -> [email protected](0)
[1997997.361]  -> [email protected](1)
[1997997.369] [email protected](2, "wl_compositor", 4, new id [unknown]@5)
[1997997.410] [email protected](3, "xdg_wm_base", 1, new id [unknown]@6)
[1997997.423] [email protected](4, "wl_output", 2, new id [unknown]@7)
[1997997.453]  -> [email protected](0, 0, 270, 158, 0, "weston-x11", "none", 0)
[1997997.490]  -> [email protected](1)
[1997997.503]  -> [email protected](3, 1024, 600, 60000)
[1997997.516]  -> [email protected]()
[1997997.528] [email protected](new id wl_callback@3)
[1997997.539]  -> [email protected](0)
[1997997.548]  -> [email protected]_id(3)
[1998039.809] [email protected]_pool(new id wl_shm_pool@3, fd 11, 2457600)
[1998039.845] [email protected]_buffer(new id wl_buffer@8, 0, 1024, 600, 4096, 1)
[1998039.852] [email protected]()
[1998039.856]  -> [email protected]_id(3)
[1998039.861] [email protected]_surface(new id wl_surface@9)
[1998039.884] [email protected]_xdg_surface(new id xdg_surface@10, wl_surface@9)
[1998039.891] [email protected]_toplevel(new id xdg_toplevel@11)
[1998039.896] [email protected]()
[1998039.900] [email protected]_region(new id wl_region@12)
[1998039.906] [email protected](0, 0, 1024, 600)
[1998039.913] [email protected]_opaque_region(wl_region@12)
[1998039.918] [email protected]()
[1998055.229] [email protected]_pool(new id wl_shm_pool@13, fd 11, 1024)
[1998055.252] [email protected]_buffer(new id wl_buffer@14, 0, 16, 16, 64, 0)
[1998055.258] [email protected]()
[1998055.267]  -> [email protected]_id(13)
[1998055.271] [email protected]_registry(new id wl_registry@15)
[1998055.275]  -> [email protected](1, "wl_shm", 1)
[1998055.279]  -> [email protected](2, "wl_compositor", 5)
[1998055.283]  -> [email protected](3, "xdg_wm_base", 5)
[1998055.287]  -> [email protected](4, "wl_output", 4)
[1998055.291]  -> [email protected](5, "wl_seat", 8)
[1998055.300] [email protected](new id wl_callback@16)
[1998055.304]  -> [email protected](0)
[1998055.306]  -> [email protected]_id(16)
[1998055.346] [email protected](5, "wl_seat", 5, new id [unknown]@13)
[1998055.358]  -> [email protected](7)
[1998055.362] [email protected]_surface(new id wl_surface@3)
[1998055.368] [email protected](new id wl_callback@16)
[1998055.370]  -> [email protected](0)
[1998055.372]  -> [email protected]_id(16)
[1998056.837] [email protected]_pointer(new id wl_pointer@17)
[1998056.846] [email protected]_cursor(0, nil, 0, 0)
Segmentation fault (core dumped)

if the line starting with pointer.on_set_cursor() is not commented out my app falls with segfault.
For some reason data == null is true in resource_t::set_events.
It looks like there is a problem when resource_t should be empty...

Qt stacktrace screenshot

image

Excessive copying of wrapper instances

During debugging I noticed that for one call to a function that takes a waylandpp proxy_t as argument, around 5 copies of the proxy object were constructed and then destroyed again. While it might not matter much for performance, I think that it's unnecessary and also makes stepping through the code a lot harder. What do you think of using const references for the arguments in most places? I know that this won't completely get rid of copying probably, but it should save a few ones.

(I'm willing to write the patch, but I wanted to discuss this first.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.