aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/x11/backend.c12
-rw-r--r--examples/screenshot.c22
-rw-r--r--include/render/gles2.h2
-rw-r--r--include/rootston/output.h3
-rw-r--r--include/wlr/types/wlr_compositor.h1
-rw-r--r--include/wlr/types/wlr_idle.h4
-rw-r--r--include/wlr/util/log.h6
-rw-r--r--include/wlr/xwm.h3
-rw-r--r--meson.build3
-rw-r--r--rootston/output.c38
-rw-r--r--rootston/seat.c2
-rw-r--r--types/wlr_compositor.c2
-rw-r--r--types/wlr_idle.c6
-rw-r--r--types/wlr_surface.c6
-rw-r--r--util/log.c2
-rw-r--r--wlroots.syms49
-rw-r--r--xwayland/xwm.c26
17 files changed, 150 insertions, 37 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 65eb0094..8633ece3 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -188,6 +188,17 @@ static void init_atom(struct wlr_x11_backend *x11, struct wlr_x11_atom *atom,
atom->reply = xcb_intern_atom_reply(x11->xcb_conn, atom->cookie, NULL);
}
+static void parse_xcb_setup(struct wlr_output *output, xcb_connection_t *xcb_conn) {
+ const xcb_setup_t *xcb_setup = xcb_get_setup(xcb_conn);
+
+ snprintf(output->make, sizeof(output->make), "%.*s",
+ xcb_setup_vendor_length(xcb_setup),
+ xcb_setup_vendor(xcb_setup));
+ snprintf(output->model, sizeof(output->model), "%"PRIu16".%"PRIu16,
+ xcb_setup->protocol_major_version,
+ xcb_setup->protocol_minor_version);
+}
+
static bool wlr_x11_backend_start(struct wlr_backend *backend) {
struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
struct wlr_x11_output *output = &x11->output;
@@ -207,6 +218,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) {
wlr_output_init(&output->wlr_output, &x11->backend, &output_impl,
x11->wl_display);
snprintf(output->wlr_output.name, sizeof(output->wlr_output.name), "X11-1");
+ parse_xcb_setup(&output->wlr_output, x11->xcb_conn);
output->win = xcb_generate_id(x11->xcb_conn);
xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win,
diff --git a/examples/screenshot.c b/examples/screenshot.c
index c163df75..7edb7327 100644
--- a/examples/screenshot.c
+++ b/examples/screenshot.c
@@ -121,12 +121,32 @@ static const struct wl_registry_listener registry_listener = {
.global_remove = handle_global_remove,
};
+static int backingfile(off_t size) {
+ static char template[] = "/tmp/wlroots-shared-XXXXXX";
+ int fd, ret;
+
+ fd = mkstemp(template);
+ if (fd < 0) {
+ return -1;
+ }
+
+ while ((ret = ftruncate(fd, size)) == EINTR) {}
+ if (ret < 0) {
+ close(fd);
+ return -1;
+ }
+
+ unlink(template);
+ return fd;
+}
+
+
static struct wl_buffer *create_shm_buffer(int width, int height,
void **data_out) {
int stride = width * 4;
int size = stride * height;
- int fd = os_create_anonymous_file(size);
+ int fd = backingfile(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n", size);
return NULL;
diff --git a/include/render/gles2.h b/include/render/gles2.h
index 797c5293..e015160d 100644
--- a/include/render/gles2.h
+++ b/include/render/gles2.h
@@ -62,7 +62,7 @@ extern const GLchar fragment_src_external[];
bool _gles2_flush_errors(const char *file, int line);
#define gles2_flush_errors(...) \
- _gles2_flush_errors(_strip_path(__FILE__), __LINE__)
+ _gles2_flush_errors(wlr_strip_path(__FILE__), __LINE__)
#define GL_CALL(func) func; gles2_flush_errors()
diff --git a/include/rootston/output.h b/include/rootston/output.h
index 9682e4f5..a852a204 100644
--- a/include/rootston/output.h
+++ b/include/rootston/output.h
@@ -19,7 +19,8 @@ struct roots_output {
struct wlr_output_damage *damage;
struct wl_listener destroy;
- struct wl_listener frame;
+ struct wl_listener damage_frame;
+ struct wl_listener damage_destroy;
};
void handle_new_output(struct wl_listener *listener, void *data);
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index 8481c590..5919b934 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -14,6 +14,7 @@ struct wlr_compositor {
struct {
struct wl_signal new_surface;
+ struct wl_signal destroy;
} events;
};
diff --git a/include/wlr/types/wlr_idle.h b/include/wlr/types/wlr_idle.h
index 689c33a4..1744f07c 100644
--- a/include/wlr/types/wlr_idle.h
+++ b/include/wlr/types/wlr_idle.h
@@ -19,7 +19,9 @@ struct wlr_idle {
struct wl_event_loop *event_loop;
struct wl_listener display_destroy;
- struct wl_signal activity_notify;
+ struct {
+ struct wl_signal activity_notify;
+ } events;
void *data;
};
diff --git a/include/wlr/util/log.h b/include/wlr/util/log.h
index 3d3f25f9..5528664b 100644
--- a/include/wlr/util/log.h
+++ b/include/wlr/util/log.h
@@ -28,13 +28,13 @@ void wlr_log_init(log_importance_t verbosity, log_callback_t callback);
void _wlr_log(log_importance_t verbosity, const char *format, ...) ATTRIB_PRINTF(2, 3);
void _wlr_vlog(log_importance_t verbosity, const char *format, va_list args) ATTRIB_PRINTF(2, 0);
-const char *_strip_path(const char *filepath);
+const char *wlr_strip_path(const char *filepath);
#define wlr_log(verb, fmt, ...) \
- _wlr_log(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
+ _wlr_log(verb, "[%s:%d] " fmt, wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
#define wlr_vlog(verb, fmt, args) \
- _wlr_vlog(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, args)
+ _wlr_vlog(verb, "[%s:%d] " fmt, wlr_strip_path(__FILE__), __LINE__, args)
#define wlr_log_errno(verb, fmt, ...) \
wlr_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno))
diff --git a/include/wlr/xwm.h b/include/wlr/xwm.h
index 242ff9cc..65681607 100644
--- a/include/wlr/xwm.h
+++ b/include/wlr/xwm.h
@@ -93,7 +93,8 @@ struct wlr_xwm {
const xcb_query_extension_reply_t *xfixes;
- struct wl_listener compositor_surface_create;
+ struct wl_listener compositor_new_surface;
+ struct wl_listener compositor_destroy;
struct wl_listener seat_selection;
struct wl_listener seat_primary_selection;
};
diff --git a/meson.build b/meson.build
index 2fc78d33..d5ae7863 100644
--- a/meson.build
+++ b/meson.build
@@ -140,6 +140,8 @@ wlr_deps += [
math,
]
+symbols_file = 'wlroots.syms'
+symbols_flag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbols_file)
lib_wlr = library(
meson.project_name(),
version: '.'.join(so_version),
@@ -147,6 +149,7 @@ lib_wlr = library(
dependencies: wlr_deps,
include_directories: wlr_inc,
install: true,
+ link_args : symbols_flag,
)
wlroots = declare_dependency(
diff --git a/rootston/output.c b/rootston/output.c
index b47d9129..a354ebf8 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -560,12 +560,6 @@ damage_finish:
}
}
-static void output_damage_handle_frame(struct wl_listener *listener,
- void *data) {
- struct roots_output *output = wl_container_of(listener, output, frame);
- render_output(output);
-}
-
void output_damage_whole(struct roots_output *output) {
wlr_output_damage_add_whole(output->damage);
}
@@ -727,19 +721,37 @@ static void set_mode(struct wlr_output *output,
}
}
-static void output_handle_destroy(struct wl_listener *listener, void *data) {
- struct roots_output *output = wl_container_of(listener, output, destroy);
-
+static void output_destroy(struct roots_output *output) {
// TODO: cursor
//example_config_configure_cursor(sample->config, sample->cursor,
// sample->compositor);
wl_list_remove(&output->link);
wl_list_remove(&output->destroy.link);
- wl_list_remove(&output->frame.link);
+ wl_list_remove(&output->damage_frame.link);
+ wl_list_remove(&output->damage_destroy.link);
free(output);
}
+static void output_handle_destroy(struct wl_listener *listener, void *data) {
+ struct roots_output *output = wl_container_of(listener, output, destroy);
+ output_destroy(output);
+}
+
+static void output_damage_handle_frame(struct wl_listener *listener,
+ void *data) {
+ struct roots_output *output =
+ wl_container_of(listener, output, damage_frame);
+ render_output(output);
+}
+
+static void output_damage_handle_destroy(struct wl_listener *listener,
+ void *data) {
+ struct roots_output *output =
+ wl_container_of(listener, output, damage_destroy);
+ output_destroy(output);
+}
+
void handle_new_output(struct wl_listener *listener, void *data) {
struct roots_desktop *desktop = wl_container_of(listener, desktop,
new_output);
@@ -768,8 +780,10 @@ void handle_new_output(struct wl_listener *listener, void *data) {
output->destroy.notify = output_handle_destroy;
wl_signal_add(&wlr_output->events.destroy, &output->destroy);
- output->frame.notify = output_damage_handle_frame;
- wl_signal_add(&output->damage->events.frame, &output->frame);
+ output->damage_frame.notify = output_damage_handle_frame;
+ wl_signal_add(&output->damage->events.frame, &output->damage_frame);
+ output->damage_destroy.notify = output_damage_handle_destroy;
+ wl_signal_add(&output->damage->events.destroy, &output->damage_destroy);
struct roots_output_config *output_config =
roots_config_get_output(config, wlr_output);
diff --git a/rootston/seat.c b/rootston/seat.c
index 38c26628..1b7d05c4 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -408,10 +408,10 @@ static void handle_keyboard_destroy(struct wl_listener *listener, void *data) {
struct roots_keyboard *keyboard =
wl_container_of(listener, keyboard, device_destroy);
struct roots_seat *seat = keyboard->seat;
- roots_keyboard_destroy(keyboard);
wl_list_remove(&keyboard->device_destroy.link);
wl_list_remove(&keyboard->keyboard_key.link);
wl_list_remove(&keyboard->keyboard_modifiers.link);
+ roots_keyboard_destroy(keyboard);
seat_update_capabilities(seat);
}
diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c
index 008f2e51..f27655c0 100644
--- a/types/wlr_compositor.c
+++ b/types/wlr_compositor.c
@@ -90,6 +90,7 @@ void wlr_compositor_destroy(struct wlr_compositor *compositor) {
if (compositor == NULL) {
return;
}
+ wlr_signal_emit_safe(&compositor->events.destroy, compositor);
wl_list_remove(&compositor->display_destroy.link);
wl_global_destroy(compositor->wl_global);
free(compositor);
@@ -195,6 +196,7 @@ struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
wl_list_init(&compositor->wl_resources);
wl_list_init(&compositor->surfaces);
wl_signal_init(&compositor->events.new_surface);
+ wl_signal_init(&compositor->events.destroy);
compositor->display_destroy.notify = handle_display_destroy;
wl_display_add_destroy_listener(display, &compositor->display_destroy);
diff --git a/types/wlr_idle.c b/types/wlr_idle.c
index 51963aea..a3981479 100644
--- a/types/wlr_idle.c
+++ b/types/wlr_idle.c
@@ -122,7 +122,7 @@ static void create_idle_timer(struct wl_client *client,
wl_signal_add(&timer->seat->events.destroy, &timer->seat_destroy);
timer->input_listener.notify = handle_input_notification;
- wl_signal_add(&idle->activity_notify, &timer->input_listener);
+ wl_signal_add(&idle->events.activity_notify, &timer->input_listener);
// create the timer
timer->idle_source =
wl_event_loop_add_timer(idle->event_loop, idle_notify, timer);
@@ -181,7 +181,7 @@ struct wlr_idle *wlr_idle_create(struct wl_display *display) {
return NULL;
}
wl_list_init(&idle->idle_timers);
- wl_signal_init(&idle->activity_notify);
+ wl_signal_init(&idle->events.activity_notify);
idle->event_loop = wl_display_get_event_loop(display);
if (idle->event_loop == NULL) {
@@ -204,5 +204,5 @@ struct wlr_idle *wlr_idle_create(struct wl_display *display) {
}
void wlr_idle_notify_activity(struct wlr_idle *idle, struct wlr_seat *seat) {
- wlr_signal_emit_safe(&idle->activity_notify, seat);
+ wlr_signal_emit_safe(&idle->events.activity_notify, seat);
}
diff --git a/types/wlr_surface.c b/types/wlr_surface.c
index e2588167..d63fc1f1 100644
--- a/types/wlr_surface.c
+++ b/types/wlr_surface.c
@@ -170,12 +170,6 @@ static bool wlr_surface_update_size(struct wlr_surface *surface,
height = tmp;
}
- struct wlr_frame_callback *cb, *tmp;
- wl_list_for_each_safe(cb, tmp, &state->frame_callback_list, link) {
- wl_resource_destroy(cb->resource);
- }
- wl_list_init(&state->frame_callback_list);
-
bool update_damage = false;
if (width != state->width || height != state->height) {
// Damage the whole surface on resize
diff --git a/util/log.c b/util/log.c
index 327402e6..2adcae2d 100644
--- a/util/log.c
+++ b/util/log.c
@@ -73,7 +73,7 @@ void _wlr_log(log_importance_t verbosity, const char *fmt, ...) {
// e.g. '/src/build/wlroots/backend/wayland/backend.c' and
// '../backend/wayland/backend.c' will both be stripped to
// 'backend/wayland/backend.c'
-const char *_strip_path(const char *filepath) {
+const char *wlr_strip_path(const char *filepath) {
static int srclen = sizeof(WLR_SRC_DIR);
if (strstr(filepath, WLR_SRC_DIR) == filepath) {
filepath += srclen;
diff --git a/wlroots.syms b/wlroots.syms
new file mode 100644
index 00000000..93d6fe51
--- /dev/null
+++ b/wlroots.syms
@@ -0,0 +1,49 @@
+WLROOTS_0_0_0 {
+ global:
+ wlr_*;
+ _wlr_log;
+ local:
+ wlr_data_device_keyboard_drag_interface;
+ wlr_data_device_pointer_drag_interface;
+ wlr_data_device_touch_drag_interface;
+ wlr_drm_backend_get_session;
+ wlr_drm_check_features;
+ wlr_drm_connector_cleanup;
+ wlr_drm_connector_start_renderer;
+ wlr_drm_event;
+ wlr_drm_get_connector_props;
+ wlr_drm_get_crtc_props;
+ wlr_drm_get_plane_props;
+ wlr_drm_get_prop;
+ wlr_drm_get_prop_blob;
+ wlr_drm_plane_surfaces_init;
+ wlr_drm_renderer_finish;
+ wlr_drm_renderer_init;
+ wlr_drm_resources_free;
+ wlr_drm_resources_init;
+ wlr_drm_restore_outputs;
+ wlr_drm_scan_connectors;
+ wlr_drm_surface_finish;
+ wlr_drm_surface_get_front;
+ wlr_drm_surface_init;
+ wlr_drm_surface_make_current;
+ wlr_drm_surface_mgpu_copy;
+ wlr_drm_surface_post;
+ wlr_drm_surface_swap_buffers;
+ wlr_egl_get_buffer_age;
+ wlr_libinput_event;
+ wlr_libinput_keyboard_create;
+ wlr_libinput_pointer_create;
+ wlr_libinput_tablet_pad_create;
+ wlr_libinput_tablet_tool_create;
+ wlr_libinput_touch_create;
+ wlr_log_stderr;
+ wlr_signal_emit_safe;
+ wlr_subsurface_destroy;
+ wlr_wl_output_for_surface;
+ wlr_wl_output_layout_get_box;
+ wlr_wl_output_move_cursor;
+ wlr_wl_output_update_cursor;
+ wlr_wl_registry_poll;
+ *;
+};
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index 94dfdaab..0d957260 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -1019,11 +1019,11 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) {
return count;
}
-static void handle_compositor_surface_create(struct wl_listener *listener,
+static void handle_compositor_new_surface(struct wl_listener *listener,
void *data) {
- struct wlr_surface *surface = data;
struct wlr_xwm *xwm =
- wl_container_of(listener, xwm, compositor_surface_create);
+ wl_container_of(listener, xwm, compositor_new_surface);
+ struct wlr_surface *surface = data;
if (wl_resource_get_client(surface->resource) != xwm->xwayland->client) {
return;
}
@@ -1043,6 +1043,16 @@ static void handle_compositor_surface_create(struct wl_listener *listener,
}
}
+static void handle_compositor_destroy(struct wl_listener *listener,
+ void *data) {
+ struct wlr_xwm *xwm =
+ wl_container_of(listener, xwm, compositor_destroy);
+ wl_list_remove(&xwm->compositor_new_surface.link);
+ wl_list_remove(&xwm->compositor_destroy.link);
+ wl_list_init(&xwm->compositor_new_surface.link);
+ wl_list_init(&xwm->compositor_destroy.link);
+}
+
void wlr_xwayland_surface_activate(struct wlr_xwayland_surface *xsurface,
bool activated) {
struct wlr_xwayland_surface *focused = xsurface->xwm->focus_surface;
@@ -1124,7 +1134,8 @@ void xwm_destroy(struct wlr_xwm *xwm) {
wl_list_for_each_safe(xsurface, tmp, &xwm->unpaired_surfaces, link) {
wlr_xwayland_surface_destroy(xsurface);
}
- wl_list_remove(&xwm->compositor_surface_create.link);
+ wl_list_remove(&xwm->compositor_new_surface.link);
+ wl_list_remove(&xwm->compositor_destroy.link);
xcb_disconnect(xwm->xcb_conn);
free(xwm);
@@ -1407,9 +1418,12 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
xwm_selection_init(xwm);
- xwm->compositor_surface_create.notify = handle_compositor_surface_create;
+ xwm->compositor_new_surface.notify = handle_compositor_new_surface;
wl_signal_add(&wlr_xwayland->compositor->events.new_surface,
- &xwm->compositor_surface_create);
+ &xwm->compositor_new_surface);
+ xwm->compositor_destroy.notify = handle_compositor_destroy;
+ wl_signal_add(&wlr_xwayland->compositor->events.destroy,
+ &xwm->compositor_destroy);
xwm_create_wm_window(xwm);