Merge remote-tracking branch 'upstream/master' into output-damage

This commit is contained in:
emersion 2018-01-28 21:22:50 +01:00
commit 1ee61dbd0f
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
11 changed files with 87 additions and 26 deletions

2
.gitignore vendored
View file

@ -4,12 +4,10 @@ Makefile
cmake_install.cmake cmake_install.cmake
install_manifest.txt install_manifest.txt
.clang_complete .clang_complete
*.swp
*.o *.o
*.a *.a
bin/ bin/
test/ test/
build/ build/
.lvimrc
wayland-*-protocol.* wayland-*-protocol.*
wlr-example.ini wlr-example.ini

View file

@ -6,6 +6,12 @@ compiler:
- gcc - gcc
- clang - 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: arch:
packages: packages:
- meson - meson
@ -19,7 +25,7 @@ arch:
- xcb-util-image - xcb-util-image
- libcap - libcap
script: script:
- "meson build" - "meson build $OPTIONS"
- "ninja -C build" - "ninja -C build"
script: script:

View file

@ -168,6 +168,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
return &drm->backend; return &drm->backend;
error_event: error_event:
wl_list_remove(&drm->session_signal.link);
wl_event_source_remove(drm->drm_event); wl_event_source_remove(drm->drm_event);
error_fd: error_fd:
wlr_session_close_file(drm->session, drm->fd); wlr_session_close_file(drm->session, drm->fd);

View file

@ -469,7 +469,7 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output,
if (!crtc) { if (!crtc) {
return false; 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 - drm->crtcs,
crtc->overlay ? crtc->overlay - drm->overlay_planes : -1, crtc->overlay ? crtc->overlay - drm->overlay_planes : -1,
crtc->primary ? crtc->primary - drm->primary_planes : -1, crtc->primary ? crtc->primary - drm->primary_planes : -1,

View file

@ -33,11 +33,11 @@ else
backend_files += files('session/direct.c') backend_files += files('session/direct.c')
endif endif
if systemd.found() if systemd.found() and get_option('enable_systemd')
backend_files += files('session/logind.c') backend_files += files('session/logind.c')
endif endif
if elogind.found() if elogind.found() and get_option('enable_elogind')
backend_files += files('session/logind.c') backend_files += files('session/logind.c')
endif endif

View file

@ -54,7 +54,9 @@ struct roots_xwayland_surface {
enum roots_view_type { enum roots_view_type {
ROOTS_WL_SHELL_VIEW, ROOTS_WL_SHELL_VIEW,
ROOTS_XDG_SHELL_V6_VIEW, ROOTS_XDG_SHELL_V6_VIEW,
#ifdef WLR_HAS_XWAYLAND
ROOTS_XWAYLAND_VIEW, ROOTS_XWAYLAND_VIEW,
#endif
}; };
struct roots_view { struct roots_view {

View file

@ -153,6 +153,22 @@ wlroots = declare_dependency(
include_directories: wlr_inc, 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('rootston')
subdir('examples') subdir('examples')
@ -164,3 +180,31 @@ pkgconfig.generate(
name: meson.project_name(), name: meson.project_name(),
description: 'Wayland compositor library', 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

View file

@ -628,6 +628,24 @@ struct roots_desktop *desktop_create(struct roots_server *server,
desktop->server = server; desktop->server = server;
desktop->config = config; 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_theme = NULL;
const char *cursor_default = ROOTS_XCURSOR_DEFAULT; const char *cursor_default = ROOTS_XCURSOR_DEFAULT;
struct roots_cursor_config *cc = struct roots_cursor_config *cc =
@ -648,24 +666,6 @@ struct roots_desktop *desktop_create(struct roots_server *server,
return NULL; return NULL;
} }
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) { if (config->xwayland) {
desktop->xwayland = wlr_xwayland_create(server->wl_display, desktop->xwayland = wlr_xwayland_create(server->wl_display,
desktop->compositor); desktop->compositor);

View file

@ -120,15 +120,18 @@ static void view_for_each_surface(struct roots_view *view,
wl_shell_surface_for_each_surface(view->wl_shell_surface, view->x, wl_shell_surface_for_each_surface(view->wl_shell_surface, view->x,
view->y, view->rotation, false, iterator, user_data); view->y, view->rotation, false, iterator, user_data);
break; break;
#ifdef WLR_HAS_XWAYLAND
case ROOTS_XWAYLAND_VIEW: case ROOTS_XWAYLAND_VIEW:
if (view->wlr_surface != NULL) { if (view->wlr_surface != NULL) {
surface_for_each_surface(view->wlr_surface, view->x, view->y, surface_for_each_surface(view->wlr_surface, view->x, view->y,
view->rotation, iterator, user_data); view->rotation, iterator, user_data);
} }
break; break;
#endif
} }
} }
#ifdef WLR_HAS_XWAYLAND
static void xwayland_children_for_each_surface( static void xwayland_children_for_each_surface(
struct wlr_xwayland_surface *surface, struct wlr_xwayland_surface *surface,
surface_iterator_func_t iterator, void *user_data) { surface_iterator_func_t iterator, void *user_data) {
@ -141,6 +144,7 @@ static void xwayland_children_for_each_surface(
xwayland_children_for_each_surface(child, iterator, user_data); xwayland_children_for_each_surface(child, iterator, user_data);
} }
} }
#endif
struct render_data { struct render_data {
@ -333,8 +337,10 @@ static bool has_standalone_surface(struct roots_view *view) {
return wl_list_empty(&view->xdg_surface_v6->popups); return wl_list_empty(&view->xdg_surface_v6->popups);
case ROOTS_WL_SHELL_VIEW: case ROOTS_WL_SHELL_VIEW:
return wl_list_empty(&view->wl_shell_surface->popups); return wl_list_empty(&view->wl_shell_surface->popups);
#ifdef WLR_HAS_XWAYLAND
case ROOTS_XWAYLAND_VIEW: case ROOTS_XWAYLAND_VIEW:
return wl_list_empty(&view->xwayland_surface->children); return wl_list_empty(&view->xwayland_surface->children);
#endif
} }
return true; return true;
} }
@ -444,10 +450,12 @@ static void render_output(struct roots_output *output) {
// During normal rendering the xwayland window tree isn't traversed // During normal rendering the xwayland window tree isn't traversed
// because all windows are rendered. Here we only want to render // because all windows are rendered. Here we only want to render
// the fullscreen window's children so we have to traverse the tree. // the fullscreen window's children so we have to traverse the tree.
#ifdef WLR_HAS_XWAYLAND
if (view->type == ROOTS_XWAYLAND_VIEW) { if (view->type == ROOTS_XWAYLAND_VIEW) {
xwayland_children_for_each_surface(view->xwayland_surface, xwayland_children_for_each_surface(view->xwayland_surface,
render_surface, &data); render_surface, &data);
} }
#endif
goto renderer_end; goto renderer_end;
} }

View file

@ -732,10 +732,12 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
return; return;
} }
#ifdef WLR_HAS_XWAYLAND
if (view && view->type == ROOTS_XWAYLAND_VIEW && if (view && view->type == ROOTS_XWAYLAND_VIEW &&
view->xwayland_surface->override_redirect) { view->xwayland_surface->override_redirect) {
return; return;
} }
#endif
struct roots_seat_view *seat_view = NULL; struct roots_seat_view *seat_view = NULL;
if (view != NULL) { if (view != NULL) {
seat_view = roots_seat_view_from_view(seat, view); seat_view = roots_seat_view_from_view(seat, view);

View file

@ -215,13 +215,13 @@ void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
} }
kb->keymap_fd = os_create_anonymous_file(kb->keymap_size); kb->keymap_fd = os_create_anonymous_file(kb->keymap_size);
if (kb->keymap_fd < 0) { 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; goto err;
} }
void *ptr = mmap(NULL, kb->keymap_size, void *ptr = mmap(NULL, kb->keymap_size,
PROT_READ | PROT_WRITE, MAP_SHARED, kb->keymap_fd, 0); PROT_READ | PROT_WRITE, MAP_SHARED, kb->keymap_fd, 0);
if (ptr == (void*)-1) { 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; goto err;
} }
strcpy(ptr, keymap_str); strcpy(ptr, keymap_str);