From 86fc2199f85ac0e1089bb7fd5a0b5cbc432bdb67 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 25 Nov 2022 18:15:31 +0100 Subject: [PATCH] build: unify naming for HAVE_* defines We sometimes used HAS_, sometimes polluted the LIBINPUT_ namespace, etc. --- backend/libinput/events.c | 6 +++--- backend/libinput/meson.build | 4 ++-- backend/libinput/pointer.c | 2 +- backend/x11/backend.c | 8 ++++---- include/backend/libinput.h | 2 +- include/backend/x11.h | 4 ++-- include/meson.build | 2 +- include/xwayland/xwm.h | 4 ++-- render/allocator/gbm.c | 2 +- render/allocator/meson.build | 2 +- xwayland/xwm.c | 8 ++++---- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 5f5fb08a..85724c90 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -174,12 +174,12 @@ void handle_libinput_event(struct wlr_libinput_backend *backend, handle_pointer_button(event, &dev->pointer); break; case LIBINPUT_EVENT_POINTER_AXIS: -#if !LIBINPUT_HAS_SCROLL_VALUE120 +#if !HAVE_LIBINPUT_SCROLL_VALUE120 /* This event must be ignored in favour of the SCROLL_* events */ handle_pointer_axis(event, &dev->pointer); #endif break; -#if LIBINPUT_HAS_SCROLL_VALUE120 +#if HAVE_LIBINPUT_SCROLL_VALUE120 case LIBINPUT_EVENT_POINTER_SCROLL_WHEEL: handle_pointer_axis_value120(event, &dev->pointer, WLR_AXIS_SOURCE_WHEEL); @@ -250,7 +250,7 @@ void handle_libinput_event(struct wlr_libinput_backend *backend, case LIBINPUT_EVENT_GESTURE_PINCH_END: handle_pointer_pinch_end(event, &dev->pointer); break; -#if LIBINPUT_HAS_HOLD_GESTURES +#if HAVE_LIBINPUT_HOLD_GESTURES case LIBINPUT_EVENT_GESTURE_HOLD_BEGIN: handle_pointer_hold_begin(event, &dev->pointer); break; diff --git a/backend/libinput/meson.build b/backend/libinput/meson.build index 368ae0f9..f4592891 100644 --- a/backend/libinput/meson.build +++ b/backend/libinput/meson.build @@ -29,5 +29,5 @@ features += { 'libinput-backend': true } wlr_deps += libinput # libinput hold gestures and high resolution scroll are available since 1.19.0 -internal_config.set10('LIBINPUT_HAS_HOLD_GESTURES', libinput.version().version_compare('>=1.19.0')) -internal_config.set10('LIBINPUT_HAS_SCROLL_VALUE120', libinput.version().version_compare('>=1.19.0')) +internal_config.set10('HAVE_LIBINPUT_HOLD_GESTURES', libinput.version().version_compare('>=1.19.0')) +internal_config.set10('HAVE_LIBINPUT_SCROLL_VALUE120', libinput.version().version_compare('>=1.19.0')) diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index 48f8ae12..a1d5ff9f 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -124,7 +124,7 @@ void handle_pointer_axis(struct libinput_event *event, wl_signal_emit_mutable(&pointer->events.frame, pointer); } -#if LIBINPUT_HAS_SCROLL_VALUE120 +#if HAVE_LIBINPUT_SCROLL_VALUE120 void handle_pointer_axis_value120(struct libinput_event *event, struct wlr_pointer *pointer, enum wlr_axis_source source) { struct libinput_event_pointer *pevent = diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 1bb94410..df761898 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -198,7 +198,7 @@ static void backend_destroy(struct wlr_backend *backend) { wlr_drm_format_set_finish(&x11->dri3_formats); wlr_drm_format_set_finish(&x11->shm_formats); -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS xcb_errors_context_free(x11->errors_context); #endif @@ -629,7 +629,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display, shm_format->format, DRM_FORMAT_MOD_INVALID); } -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS if (xcb_errors_context_new(x11->xcb, &x11->errors_context) != 0) { wlr_log(WLR_ERROR, "Failed to create error context"); return false; @@ -673,7 +673,7 @@ error_x11: } static void handle_x11_error(struct wlr_x11_backend *x11, xcb_value_error_t *ev) { -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS const char *major_name = xcb_errors_get_name_for_major_code( x11->errors_context, ev->major_opcode); if (!major_name) { @@ -711,7 +711,7 @@ log_raw: static void handle_x11_unknown_event(struct wlr_x11_backend *x11, xcb_generic_event_t *ev) { -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS const char *extension; const char *event_name = xcb_errors_get_name_for_xcb_event( x11->errors_context, ev, &extension); diff --git a/include/backend/libinput.h b/include/backend/libinput.h index 36c4794b..d469eb7c 100644 --- a/include/backend/libinput.h +++ b/include/backend/libinput.h @@ -72,7 +72,7 @@ void handle_pointer_button(struct libinput_event *event, struct wlr_pointer *pointer); void handle_pointer_axis(struct libinput_event *event, struct wlr_pointer *pointer); -#if LIBINPUT_HAS_SCROLL_VALUE120 +#if HAVE_LIBINPUT_SCROLL_VALUE120 void handle_pointer_axis_value120(struct libinput_event *event, struct wlr_pointer *pointer, enum wlr_axis_source source); #endif diff --git a/include/backend/x11.h b/include/backend/x11.h index 704d48f1..f66fed2a 100644 --- a/include/backend/x11.h +++ b/include/backend/x11.h @@ -19,7 +19,7 @@ #include "config.h" -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS #include #endif @@ -99,7 +99,7 @@ struct wlr_x11_backend { // The time we last received an event xcb_timestamp_t time; -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS xcb_errors_context_t *errors_context; #endif diff --git a/include/meson.build b/include/meson.build index f97e76ac..e6698003 100644 --- a/include/meson.build +++ b/include/meson.build @@ -30,7 +30,7 @@ install_subdir('wlr', ) foreach name, have : internal_features - internal_config.set10('HAS_' + name.underscorify().to_upper(), have) + internal_config.set10('HAVE_' + name.underscorify().to_upper(), have) endforeach wlr_files += configure_file( output: 'config.h', diff --git a/include/xwayland/xwm.h b/include/xwayland/xwm.h index 7ed97b15..c057e1b7 100644 --- a/include/xwayland/xwm.h +++ b/include/xwayland/xwm.h @@ -8,7 +8,7 @@ #include "config.h" #include "xwayland/selection.h" -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS #include #endif @@ -126,7 +126,7 @@ struct wlr_xwm { const xcb_query_extension_reply_t *xfixes; const xcb_query_extension_reply_t *xres; uint32_t xfixes_major_version; -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS xcb_errors_context_t *errors_context; #endif unsigned int last_focus_seq; diff --git a/render/allocator/gbm.c b/render/allocator/gbm.c index a41065b5..149ff6b9 100644 --- a/render/allocator/gbm.c +++ b/render/allocator/gbm.c @@ -41,7 +41,7 @@ static bool export_gbm_bo(struct gbm_bo *bo, int i; int32_t handle = -1; for (i = 0; i < attribs.n_planes; ++i) { -#if HAS_GBM_BO_GET_FD_FOR_PLANE +#if HAVE_GBM_BO_GET_FD_FOR_PLANE (void)handle; attribs.fd[i] = gbm_bo_get_fd_for_plane(bo, i); diff --git a/render/allocator/meson.build b/render/allocator/meson.build index 1fdfe557..730a2a41 100644 --- a/render/allocator/meson.build +++ b/render/allocator/meson.build @@ -21,5 +21,5 @@ if gbm.found() features += { 'gbm-allocator': true } has = cc.has_function('gbm_bo_get_fd_for_plane', dependencies: [gbm]) - internal_config.set10('HAS_GBM_BO_GET_FD_FOR_PLANE', has) + internal_config.set10('HAVE_GBM_BO_GET_FD_FOR_PLANE', has) endif diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 9dcc0da6..61d29f91 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1534,7 +1534,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) { -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS const char *major_name = xcb_errors_get_name_for_major_code(xwm->errors_context, ev->major_opcode); @@ -1572,7 +1572,7 @@ log_raw: } static void xwm_handle_unhandled_event(struct wlr_xwm *xwm, xcb_generic_event_t *ev) { -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS const char *extension; const char *event_name = xcb_errors_get_name_for_xcb_event(xwm->errors_context, @@ -1797,7 +1797,7 @@ void xwm_destroy(struct wlr_xwm *xwm) { if (xwm->event_source) { wl_event_source_remove(xwm->event_source); } -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS if (xwm->errors_context) { xcb_errors_context_free(xwm->errors_context); } @@ -2072,7 +2072,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *xwayland, int wm_fd) { return NULL; } -#if HAS_XCB_ERRORS +#if HAVE_XCB_ERRORS if (xcb_errors_context_new(xwm->xcb_conn, &xwm->errors_context)) { wlr_log(WLR_ERROR, "Could not allocate error context"); xwm_destroy(xwm);