Remove WLR_HAS_XCB_ERRORS
wlroots' dependency on this library doesn't change the features exposed to compositors. It's purely a wlroots implementation detail. Thus downstream compositors shouldn't really care about it. Introduce an "internal_features" dictionary to store the status of such internal dependencies.
This commit is contained in:
parent
78befa59f9
commit
1eb38e0015
|
@ -191,7 +191,7 @@ static void backend_destroy(struct wlr_backend *backend) {
|
||||||
wlr_drm_format_set_finish(&x11->dri3_formats);
|
wlr_drm_format_set_finish(&x11->dri3_formats);
|
||||||
free(x11->drm_format);
|
free(x11->drm_format);
|
||||||
|
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
xcb_errors_context_free(x11->errors_context);
|
xcb_errors_context_free(x11->errors_context);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -617,7 +617,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
if (xcb_errors_context_new(x11->xcb, &x11->errors_context) != 0) {
|
if (xcb_errors_context_new(x11->xcb, &x11->errors_context) != 0) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create error context");
|
wlr_log(WLR_ERROR, "Failed to create error context");
|
||||||
return false;
|
return false;
|
||||||
|
@ -663,7 +663,7 @@ error_x11:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_x11_error(struct wlr_x11_backend *x11, xcb_value_error_t *ev) {
|
static void handle_x11_error(struct wlr_x11_backend *x11, xcb_value_error_t *ev) {
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
const char *major_name = xcb_errors_get_name_for_major_code(
|
const char *major_name = xcb_errors_get_name_for_major_code(
|
||||||
x11->errors_context, ev->major_opcode);
|
x11->errors_context, ev->major_opcode);
|
||||||
if (!major_name) {
|
if (!major_name) {
|
||||||
|
@ -701,7 +701,7 @@ log_raw:
|
||||||
|
|
||||||
static void handle_x11_unknown_event(struct wlr_x11_backend *x11,
|
static void handle_x11_unknown_event(struct wlr_x11_backend *x11,
|
||||||
xcb_generic_event_t *ev) {
|
xcb_generic_event_t *ev) {
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
const char *extension;
|
const char *extension;
|
||||||
const char *event_name = xcb_errors_get_name_for_xcb_event(
|
const char *event_name = xcb_errors_get_name_for_xcb_event(
|
||||||
x11->errors_context, ev, &extension);
|
x11->errors_context, ev, &extension);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/present.h>
|
#include <xcb/present.h>
|
||||||
|
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
#include <xcb/xcb_errors.h>
|
#include <xcb/xcb_errors.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ struct wlr_x11_backend {
|
||||||
// The time we last received an event
|
// The time we last received an event
|
||||||
xcb_timestamp_t time;
|
xcb_timestamp_t time;
|
||||||
|
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
xcb_errors_context_t *errors_context;
|
xcb_errors_context_t *errors_context;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
#mesondefine WLR_HAS_XWAYLAND
|
#mesondefine WLR_HAS_XWAYLAND
|
||||||
|
|
||||||
#mesondefine WLR_HAS_XCB_ERRORS
|
|
||||||
|
|
||||||
#mesondefine WLR_HAS_XDG_FOREIGN
|
#mesondefine WLR_HAS_XDG_FOREIGN
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <wlr/config.h>
|
#include <wlr/config.h>
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
#include <xcb/render.h>
|
#include <xcb/render.h>
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
#include <xcb/xcb_errors.h>
|
#include <xcb/xcb_errors.h>
|
||||||
#endif
|
#endif
|
||||||
#include "xwayland/selection.h"
|
#include "xwayland/selection.h"
|
||||||
|
@ -113,7 +113,7 @@ struct wlr_xwm {
|
||||||
struct wlr_xwayland_surface *drag_focus;
|
struct wlr_xwayland_surface *drag_focus;
|
||||||
|
|
||||||
const xcb_query_extension_reply_t *xfixes;
|
const xcb_query_extension_reply_t *xfixes;
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
xcb_errors_context_t *errors_context;
|
xcb_errors_context_t *errors_context;
|
||||||
#endif
|
#endif
|
||||||
unsigned int last_focus_seq;
|
unsigned int last_focus_seq;
|
||||||
|
|
13
meson.build
13
meson.build
|
@ -86,9 +86,11 @@ features = {
|
||||||
'libseat': false,
|
'libseat': false,
|
||||||
'x11-backend': false,
|
'x11-backend': false,
|
||||||
'xwayland': false,
|
'xwayland': false,
|
||||||
'xcb-errors': false,
|
|
||||||
'xdg-foreign': false,
|
'xdg-foreign': false,
|
||||||
}
|
}
|
||||||
|
internal_features = {
|
||||||
|
'xcb-errors': false,
|
||||||
|
}
|
||||||
|
|
||||||
wayland_server = dependency('wayland-server', version: '>=1.19')
|
wayland_server = dependency('wayland-server', version: '>=1.19')
|
||||||
wayland_client = dependency('wayland-client')
|
wayland_client = dependency('wayland-client')
|
||||||
|
@ -143,6 +145,13 @@ subdir('xwayland')
|
||||||
|
|
||||||
subdir('include')
|
subdir('include')
|
||||||
|
|
||||||
|
foreach name, have : internal_features
|
||||||
|
add_project_arguments(
|
||||||
|
'-DHAS_@0@=@1@'.format(name.underscorify().to_upper(), have.to_int()),
|
||||||
|
language: 'c',
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
|
|
||||||
wlr_inc = include_directories('.', 'include')
|
wlr_inc = include_directories('.', 'include')
|
||||||
proto_inc = include_directories('protocol')
|
proto_inc = include_directories('protocol')
|
||||||
|
|
||||||
|
@ -172,7 +181,7 @@ wlroots = declare_dependency(
|
||||||
|
|
||||||
meson.override_dependency('wlroots', wlroots)
|
meson.override_dependency('wlroots', wlroots)
|
||||||
|
|
||||||
summary(features, bool_yn: true)
|
summary(features + internal_features, bool_yn: true)
|
||||||
|
|
||||||
if get_option('examples')
|
if get_option('examples')
|
||||||
subdir('examples')
|
subdir('examples')
|
||||||
|
|
|
@ -56,10 +56,9 @@ foreach lib, desc : xwayland_optional
|
||||||
required: get_option(lib),
|
required: get_option(lib),
|
||||||
not_found_message: '\n'.join(msg).format(lib),
|
not_found_message: '\n'.join(msg).format(lib),
|
||||||
)
|
)
|
||||||
if dep.found()
|
|
||||||
xwayland_libs += dep
|
internal_features += { lib: dep.found() }
|
||||||
features += { lib: true }
|
xwayland_libs += dep
|
||||||
endif
|
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
wlr_files += files(
|
wlr_files += files(
|
||||||
|
|
|
@ -1330,7 +1330,7 @@ static void xwm_handle_focus_in(struct wlr_xwm *xwm,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xwm_handle_xcb_error(struct wlr_xwm *xwm, xcb_value_error_t *ev) {
|
static void xwm_handle_xcb_error(struct wlr_xwm *xwm, xcb_value_error_t *ev) {
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
const char *major_name =
|
const char *major_name =
|
||||||
xcb_errors_get_name_for_major_code(xwm->errors_context,
|
xcb_errors_get_name_for_major_code(xwm->errors_context,
|
||||||
ev->major_opcode);
|
ev->major_opcode);
|
||||||
|
@ -1368,7 +1368,7 @@ log_raw:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xwm_handle_unhandled_event(struct wlr_xwm *xwm, xcb_generic_event_t *ev) {
|
static void xwm_handle_unhandled_event(struct wlr_xwm *xwm, xcb_generic_event_t *ev) {
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
const char *extension;
|
const char *extension;
|
||||||
const char *event_name =
|
const char *event_name =
|
||||||
xcb_errors_get_name_for_xcb_event(xwm->errors_context,
|
xcb_errors_get_name_for_xcb_event(xwm->errors_context,
|
||||||
|
@ -1598,7 +1598,7 @@ void xwm_destroy(struct wlr_xwm *xwm) {
|
||||||
if (xwm->event_source) {
|
if (xwm->event_source) {
|
||||||
wl_event_source_remove(xwm->event_source);
|
wl_event_source_remove(xwm->event_source);
|
||||||
}
|
}
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
if (xwm->errors_context) {
|
if (xwm->errors_context) {
|
||||||
xcb_errors_context_free(xwm->errors_context);
|
xcb_errors_context_free(xwm->errors_context);
|
||||||
}
|
}
|
||||||
|
@ -1840,7 +1840,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *xwayland, int wm_fd) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WLR_HAS_XCB_ERRORS
|
#if HAS_XCB_ERRORS
|
||||||
if (xcb_errors_context_new(xwm->xcb_conn, &xwm->errors_context)) {
|
if (xcb_errors_context_new(xwm->xcb_conn, &xwm->errors_context)) {
|
||||||
wlr_log(WLR_ERROR, "Could not allocate error context");
|
wlr_log(WLR_ERROR, "Could not allocate error context");
|
||||||
xwm_destroy(xwm);
|
xwm_destroy(xwm);
|
||||||
|
|
Loading…
Reference in New Issue