From 66ab1a98a0cf9312aa0c6507c273b17040c95b09 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Wed, 24 Jan 2018 16:56:08 +0000 Subject: meson: print enabled options This makes it simpler to figure out what was enabled. --- meson.build | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/meson.build b/meson.build index aee4b11b..b86030a6 100644 --- a/meson.build +++ b/meson.build @@ -153,6 +153,22 @@ wlroots = declare_dependency( include_directories: wlr_inc, ) + +summary = [ + '', + '----------------', + 'wlroots @0@'.format(meson.project_version()), + '', + ' libcap: @0@'.format(get_option('enable_libcap')), + ' systemd: @0@'.format(get_option('enable_systemd')), + ' elogind: @0@'.format(get_option('enable_elogind')), + ' xwayland: @0@'.format(get_option('enable_xwayland')), + '----------------', + '' +] +message('\n'.join(summary)) + + subdir('rootston') subdir('examples') -- cgit v1.2.3 From 72507f9820df9da3a7feadc722675c42e59e58a6 Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Wed, 24 Jan 2018 18:14:51 +0100 Subject: Clean up session signal handler on drm init fail --- backend/drm/backend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 112b2b61..c0e49f18 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -168,6 +168,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, return &drm->backend; error_event: + wl_list_remove(&drm->session_signal.link); wl_event_source_remove(drm->drm_event); error_fd: wlr_session_close_file(drm->session, drm->fd); -- cgit v1.2.3 From ab738256ac3cdaadb33dcd6d59accc876c45a51a Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 26 Jan 2018 10:05:27 -0500 Subject: Remove vim stuff from .gitignore If this affects you put this in your vimrc: set backupdir=~/.cache set directory=~/.cache --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index d4edde88..48945461 100644 --- a/.gitignore +++ b/.gitignore @@ -4,12 +4,10 @@ Makefile cmake_install.cmake install_manifest.txt .clang_complete -*.swp *.o *.a bin/ test/ build/ -.lvimrc wayland-*-protocol.* wlr-example.ini -- cgit v1.2.3 From e5dacbae5d0ee2a712e6426440685ed3f73d4fbe Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 26 Jan 2018 15:46:29 +0100 Subject: meson: add ctags and etags targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to create tag files. Idea taken from systemd. Signed-off-by: Guido Günther --- meson.build | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/meson.build b/meson.build index b86030a6..55b07efa 100644 --- a/meson.build +++ b/meson.build @@ -180,3 +180,31 @@ pkgconfig.generate( name: meson.project_name(), description: 'Wayland compositor library', ) + +git = find_program('git', required: false) +if git.found() + all_files = run_command( + git, + ['--git-dir=@0@/.git'.format(meson.source_root()), + 'ls-files', + ':/*.[ch]']) + all_files = files(all_files.stdout().split()) + + etags = find_program('etags', required: false) + if etags.found() and all_files.length() > 0 + custom_target('etags', + build_by_default: true, + input: all_files, + output: 'TAGS', + command: [etags.path(), '-o', 'TAGS'] + all_files) + endif + + ctags = find_program('ctags', required: false) + if ctags.found() and all_files.length() > 0 + custom_target('ctags', + build_by_default: true, + input: all_files, + output: 'tags', + command: [ctags.path(), '-o', 'tags'] + all_files) + endif +endif -- cgit v1.2.3 From 1633b8d793515464b56fe58d1eb62345db04c119 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 26 Jan 2018 20:59:47 +0100 Subject: wlr_keyboard: use correct printf format string for keymap_size keymap_size is a size_t. Otherwise the build fails on arm like ../types/wlr_keyboard.c: In function 'wlr_keyboard_set_keymap': ../include/wlr/util/log.h:34:17: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=] _wlr_log(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, ##__VA_ARGS__) ^ ../types/wlr_keyboard.c:218:3: note: in expansion of macro 'wlr_log' wlr_log(L_ERROR, "creating a keymap file for %lu bytes failed", kb->keymap_size); ^~~~~~~ ../types/wlr_keyboard.c:218:50: note: format string is defined here wlr_log(L_ERROR, "creating a keymap file for %lu bytes failed", kb->keymap_size); ~~^ %u --- types/wlr_keyboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/wlr_keyboard.c b/types/wlr_keyboard.c index b0dc97aa..29552eb4 100644 --- a/types/wlr_keyboard.c +++ b/types/wlr_keyboard.c @@ -215,13 +215,13 @@ void wlr_keyboard_set_keymap(struct wlr_keyboard *kb, } kb->keymap_fd = os_create_anonymous_file(kb->keymap_size); if (kb->keymap_fd < 0) { - wlr_log(L_ERROR, "creating a keymap file for %lu bytes failed", kb->keymap_size); + wlr_log(L_ERROR, "creating a keymap file for %zu bytes failed", kb->keymap_size); goto err; } void *ptr = mmap(NULL, kb->keymap_size, PROT_READ | PROT_WRITE, MAP_SHARED, kb->keymap_fd, 0); if (ptr == (void*)-1) { - wlr_log(L_ERROR, "failed to mmap() %lu bytes", kb->keymap_size); + wlr_log(L_ERROR, "failed to mmap() %zu bytes", kb->keymap_size); goto err; } strcpy(ptr, keymap_str); -- cgit v1.2.3 From d7dfbd23faf0b72a58da58f060a98e9b0023256b Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 26 Jan 2018 20:59:47 +0100 Subject: drm: Use ptrdiff_t instead of intmax_t in format string since we're looking at pointer differences. Otherwise the build fails on arm like In file included from ../backend/drm/drm.c:19:0: ../include/wlr/util/log.h:34:17: error: format '%jd' expects argument of type 'intmax_t', but argument 7 has type 'int' [-Werror=format=] _wlr_log(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, ##__VA_ARGS__) ^ ../backend/drm/drm.c:462:2: note: in expansion of macro 'wlr_log' wlr_log(L_DEBUG, "%s: crtc=%ju ovr=%jd pri=%jd cur=%jd", conn->output.name, ^~~~~~~ ../backend/drm/drm.c:462:39: note: format string is defined here wlr_log(L_DEBUG, "%s: crtc=%ju ovr=%jd pri=%jd cur=%jd", conn->output.name, ~~^ %d --- backend/drm/drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 47bd4e3a..63a6e2da 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -459,7 +459,7 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output, if (!crtc) { return false; } - wlr_log(L_DEBUG, "%s: crtc=%ju ovr=%jd pri=%jd cur=%jd", conn->output.name, + wlr_log(L_DEBUG, "%s: crtc=%td ovr=%td pri=%td cur=%td", conn->output.name, crtc - drm->crtcs, crtc->overlay ? crtc->overlay - drm->overlay_planes : -1, crtc->primary ? crtc->primary - drm->primary_planes : -1, -- cgit v1.2.3 From 52cb19d99d3d667f4475f404a333e347654808dc Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Sun, 28 Jan 2018 12:04:46 +0000 Subject: rootston: fix compilation without XWayland support In case wlroots is not being compiled with XWayland support, we will not have an xwayland surface in our roots view. While we make sure to pay attention to that in some places, we are not being consistent and try to access the xwayland surface in other places. Obviously, this leads to a compiler error due to the field not being present. Fix the issue by sprinkling in a few additional ifdefs where required. --- include/rootston/view.h | 2 ++ rootston/desktop.c | 2 ++ rootston/output.c | 8 ++++++++ rootston/seat.c | 2 ++ 4 files changed, 14 insertions(+) diff --git a/include/rootston/view.h b/include/rootston/view.h index e837586a..e1172bca 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -51,7 +51,9 @@ struct roots_xwayland_surface { enum roots_view_type { ROOTS_WL_SHELL_VIEW, ROOTS_XDG_SHELL_V6_VIEW, +#ifdef WLR_HAS_XWAYLAND ROOTS_XWAYLAND_VIEW, +#endif }; struct roots_view { diff --git a/rootston/desktop.c b/rootston/desktop.c index 70dafec4..59d1e58b 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -490,6 +490,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, desktop->server = server; desktop->config = config; +#ifdef WLR_HAS_XWAYLAND const char *cursor_theme = NULL; const char *cursor_default = ROOTS_XCURSOR_DEFAULT; struct roots_cursor_config *cc = @@ -509,6 +510,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, free(desktop); return NULL; } +#endif desktop->layout = wlr_output_layout_create(); desktop->layout_change.notify = handle_layout_change; diff --git a/rootston/output.c b/rootston/output.c index 689956ad..1fb848b9 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -137,6 +137,7 @@ static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface, } } +#ifdef WLR_HAS_XWAYLAND static void render_xwayland_children(struct wlr_xwayland_surface *surface, struct roots_desktop *desktop, struct wlr_output *wlr_output, struct timespec *when) { @@ -149,6 +150,7 @@ static void render_xwayland_children(struct wlr_xwayland_surface *surface, render_xwayland_children(child, desktop, wlr_output, when); } } +#endif static void render_decorations(struct roots_view *view, struct roots_desktop *desktop, struct wlr_output *output) { @@ -198,10 +200,12 @@ static void render_view(struct roots_view *view, struct roots_desktop *desktop, render_wl_shell_surface(view->wl_shell_surface, desktop, wlr_output, when, view->x, view->y, view->rotation, false); break; +#ifdef WLR_HAS_XWAYLAND case ROOTS_XWAYLAND_VIEW: render_surface(view->wlr_surface, desktop, wlr_output, when, view->x, view->y, view->rotation); break; +#endif } } @@ -215,8 +219,10 @@ static bool has_standalone_surface(struct roots_view *view) { return wl_list_empty(&view->xdg_surface_v6->popups); case ROOTS_WL_SHELL_VIEW: return wl_list_empty(&view->wl_shell_surface->popups); +#ifdef WLR_HAS_XWAYLAND case ROOTS_XWAYLAND_VIEW: return wl_list_empty(&view->xwayland_surface->children); +#endif } return true; } @@ -264,10 +270,12 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { // During normal rendering the xwayland window tree isn't traversed // because all windows are rendered. Here we only want to render // the fullscreen window's children so we have to traverse the tree. +#ifdef WLR_HAS_XWAYLAND if (view->type == ROOTS_XWAYLAND_VIEW) { render_xwayland_children(view->xwayland_surface, desktop, wlr_output, &now); } +#endif } wlr_renderer_end(server->renderer); wlr_output_swap_buffers(wlr_output); diff --git a/rootston/seat.c b/rootston/seat.c index e6e505b5..d7353d1e 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -651,10 +651,12 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { return; } +#ifdef WLR_HAS_XWAYLAND if (view && view->type == ROOTS_XWAYLAND_VIEW && view->xwayland_surface->override_redirect) { return; } +#endif struct roots_seat_view *seat_view = NULL; if (view != NULL) { seat_view = roots_seat_view_from_view(seat, view); -- cgit v1.2.3 From d05143950b7b81ae3454845a899225003ab41f25 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Sun, 28 Jan 2018 12:11:05 +0000 Subject: rootston: move together XWayland setup code The XWayland code for creating the cursor as well as creating the surface itself are currently split up into two ifdef'ed sections in `desktop_create()`. Move together these two sections in order to avoid having multiple ifdefs as well as making it clearer that they do in fact serve the same purpose of setting up the XWayland environment. --- rootston/desktop.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/rootston/desktop.c b/rootston/desktop.c index 59d1e58b..44bdf365 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -490,6 +490,23 @@ struct roots_desktop *desktop_create(struct roots_server *server, desktop->server = server; desktop->config = config; + desktop->layout = wlr_output_layout_create(); + desktop->layout_change.notify = handle_layout_change; + wl_signal_add(&desktop->layout->events.change, &desktop->layout_change); + + desktop->compositor = wlr_compositor_create(server->wl_display, + server->renderer); + + desktop->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display); + wl_signal_add(&desktop->xdg_shell_v6->events.new_surface, + &desktop->xdg_shell_v6_surface); + desktop->xdg_shell_v6_surface.notify = handle_xdg_shell_v6_surface; + + desktop->wl_shell = wlr_wl_shell_create(server->wl_display); + wl_signal_add(&desktop->wl_shell->events.new_surface, + &desktop->wl_shell_surface); + desktop->wl_shell_surface.notify = handle_wl_shell_surface; + #ifdef WLR_HAS_XWAYLAND const char *cursor_theme = NULL; const char *cursor_default = ROOTS_XCURSOR_DEFAULT; @@ -510,26 +527,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, free(desktop); return NULL; } -#endif - desktop->layout = wlr_output_layout_create(); - desktop->layout_change.notify = handle_layout_change; - wl_signal_add(&desktop->layout->events.change, &desktop->layout_change); - - desktop->compositor = wlr_compositor_create(server->wl_display, - server->renderer); - - desktop->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display); - wl_signal_add(&desktop->xdg_shell_v6->events.new_surface, - &desktop->xdg_shell_v6_surface); - desktop->xdg_shell_v6_surface.notify = handle_xdg_shell_v6_surface; - - desktop->wl_shell = wlr_wl_shell_create(server->wl_display); - wl_signal_add(&desktop->wl_shell->events.new_surface, - &desktop->wl_shell_surface); - desktop->wl_shell_surface.notify = handle_wl_shell_surface; - -#ifdef WLR_HAS_XWAYLAND if (config->xwayland) { desktop->xwayland = wlr_xwayland_create(server->wl_display, desktop->compositor); -- cgit v1.2.3 From 91c034d164caccf78f143cec82b25eb5ef0ee96d Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Sun, 28 Jan 2018 12:15:59 +0000 Subject: travis: add job building wlroots without various options Recently, the support for building rootston without XWayland was broken. While the breakage was easily fixable, the more important problem is that actually nobody seems to ever compile wlroots without XWayland, causing silent breakage. This problem can easily be handled by the CI system: in addition to the existing job which enables XWayland, add a second job which compiles wlroots without XWayland. This will catch breakage at a much earlier stage. Catching broken builds without XWayland support obviously only covers one part of a greater issue, as all the other options may cause our builds to break, too. While we cannot test each combination, we can at least make sure to have one build with all options enabled and one with all options disabled. --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f6bbd7f4..0028de93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,12 @@ compiler: - gcc - clang +# Settings to try +env: + matrix: + - OPTIONS="-Denable_libcap=true -Denable_systemd=true -Denable_elogind=false -Denable_xwayland=true" + - OPTIONS="-Denable_libcap=false -Denable_systemd=false -Denable_elogind=false -Denable_xwayland=false" + arch: packages: - meson @@ -19,7 +25,7 @@ arch: - xcb-util-image - libcap script: - - "meson build" + - "meson build $OPTIONS" - "ninja -C build" script: -- cgit v1.2.3 From 41ec686693821d6d436dae193e675a9b2746a369 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Sun, 28 Jan 2018 16:10:53 +0000 Subject: meson: add systemd/elogind backends only if enabled Right now, we are adding systemd and elogind backends to the build system as soon as their libraries are found on the build system. Instead, we should only add them if the libraries have been found _and_ the user has actually requested them to be included. --- backend/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/meson.build b/backend/meson.build index b8084448..173b65f6 100644 --- a/backend/meson.build +++ b/backend/meson.build @@ -33,11 +33,11 @@ else backend_files += files('session/direct.c') endif -if systemd.found() +if systemd.found() and get_option('enable_systemd') backend_files += files('session/logind.c') endif -if elogind.found() +if elogind.found() and get_option('enable_elogind') backend_files += files('session/logind.c') endif -- cgit v1.2.3