mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Use #if instead of #ifdef for wlroots config data
This prevents some annoying issues when e.g. not including wlr/config.h or making a typo in the guard name.
This commit is contained in:
parent
3181c4bec0
commit
51bfdd620e
25 changed files with 69 additions and 61 deletions
|
|
@ -619,7 +619,7 @@ static bool view_at(struct roots_view *view, double lx, double ly,
|
|||
_surface = wlr_wl_shell_surface_surface_at(view->wl_shell_surface,
|
||||
view_sx, view_sy, &_sx, &_sy);
|
||||
break;
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
case ROOTS_XWAYLAND_VIEW:
|
||||
_surface = wlr_surface_surface_at(view->wlr_surface,
|
||||
view_sx, view_sy, &_sx, &_sy);
|
||||
|
|
@ -890,14 +890,14 @@ struct roots_desktop *desktop_create(struct roots_server *server,
|
|||
desktop->tablet_v2 = wlr_tablet_v2_create(server->wl_display);
|
||||
|
||||
const char *cursor_theme = NULL;
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
const char *cursor_default = ROOTS_XCURSOR_DEFAULT;
|
||||
#endif
|
||||
struct roots_cursor_config *cc =
|
||||
roots_config_get_cursor(config, ROOTS_CONFIG_DEFAULT_SEAT_NAME);
|
||||
if (cc != NULL) {
|
||||
cursor_theme = cc->theme;
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
if (cc->default_image != NULL) {
|
||||
cursor_default = cc->default_image;
|
||||
}
|
||||
|
|
@ -912,7 +912,7 @@ struct roots_desktop *desktop_create(struct roots_server *server,
|
|||
setenv("XCURSOR_THEME", cursor_theme, 1);
|
||||
}
|
||||
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
desktop->xcursor_manager = wlr_xcursor_manager_create(cursor_theme,
|
||||
ROOTS_XCURSOR_SIZE);
|
||||
if (desktop->xcursor_manager == NULL) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include <wlr/xcursor.h>
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
#include <wlr/xwayland.h>
|
||||
#endif
|
||||
#include "rootston/config.h"
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
setenv("WAYLAND_DISPLAY", socket, true);
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
if (server.desktop->xwayland != NULL) {
|
||||
struct roots_seat *xwayland_seat =
|
||||
input_get_seat(server.input, ROOTS_CONFIG_DEFAULT_SEAT_NAME);
|
||||
|
|
@ -72,7 +72,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
wl_display_run(server.wl_display);
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
wlr_xwayland_destroy(server.desktop->xwayland);
|
||||
#endif
|
||||
wl_display_destroy_clients(server.wl_display);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ sources = [
|
|||
'xdg_shell_v6.c',
|
||||
]
|
||||
|
||||
if conf_data.get('WLR_HAS_XWAYLAND', false)
|
||||
if conf_data.get('WLR_HAS_XWAYLAND', 0) == 1
|
||||
sources += 'xwayland.c'
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ static void view_for_each_surface(struct roots_view *view,
|
|||
wlr_wl_shell_surface_for_each_surface(view->wl_shell_surface, iterator,
|
||||
user_data);
|
||||
break;
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
case ROOTS_XWAYLAND_VIEW:
|
||||
wlr_surface_for_each_surface(view->wlr_surface, iterator, user_data);
|
||||
break;
|
||||
|
|
@ -94,7 +94,7 @@ static void view_for_each_surface(struct roots_view *view,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
static void xwayland_children_for_each_surface(
|
||||
struct wlr_xwayland_surface *surface,
|
||||
wlr_surface_iterator_func_t iterator, struct layout_data *layout_data,
|
||||
|
|
@ -164,7 +164,7 @@ static void output_for_each_surface(struct roots_output *output,
|
|||
|
||||
view_for_each_surface(view, layout_data, iterator, user_data);
|
||||
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
if (view->type == ROOTS_XWAYLAND_VIEW) {
|
||||
xwayland_children_for_each_surface(view->xwayland_surface,
|
||||
iterator, layout_data, user_data);
|
||||
|
|
@ -400,7 +400,7 @@ static bool has_standalone_surface(struct roots_view *view) {
|
|||
return wl_list_empty(&view->xdg_surface->popups);
|
||||
case ROOTS_WL_SHELL_VIEW:
|
||||
return wl_list_empty(&view->wl_shell_surface->popups);
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
case ROOTS_XWAYLAND_VIEW:
|
||||
return wl_list_empty(&view->xwayland_surface->children);
|
||||
#endif
|
||||
|
|
@ -530,7 +530,7 @@ static void render_output(struct roots_output *output) {
|
|||
// 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 WLR_HAS_XWAYLAND
|
||||
if (view->type == ROOTS_XWAYLAND_VIEW) {
|
||||
xwayland_children_for_each_surface(view->xwayland_surface,
|
||||
render_surface, &data.layout, &data);
|
||||
|
|
@ -593,7 +593,7 @@ static bool view_accept_damage(struct roots_output *output,
|
|||
if (output->fullscreen_view == view) {
|
||||
return true;
|
||||
}
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
if (output->fullscreen_view->type == ROOTS_XWAYLAND_VIEW &&
|
||||
view->type == ROOTS_XWAYLAND_VIEW) {
|
||||
// Special case: accept damage from children
|
||||
|
|
|
|||
|
|
@ -1131,7 +1131,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
|
|||
|
||||
bool unfullscreen = true;
|
||||
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
if (view && view->type == ROOTS_XWAYLAND_VIEW &&
|
||||
view->xwayland_surface->override_redirect) {
|
||||
unfullscreen = false;
|
||||
|
|
@ -1160,7 +1160,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef WLR_HAS_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
if (view && view->type == ROOTS_XWAYLAND_VIEW &&
|
||||
!wlr_xwayland_or_surface_wants_focus(
|
||||
view->xwayland_surface)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue